Custom / your own site Available (v1)
Got your own website or a hand-built framework? Add the snippet to your
site-wide template / layout — right before </head>:
<script async src="https://cdn.visz.ai/v1/snippet.js?id=vz_your_key"></script>What matters is that the line loads on every page (via the shared layout/template), not just on the homepage.
Single-page apps (React / Vue / Next / SPA)
SPAs are detected automatically — no extra setup needed. Visz hooks into
history.pushState / replaceState and the bfcache, so route changes without a
real reload are counted correctly as new pageviews.
Next.js: Put the snippet in the root layout <head>, or use next/script
with strategy="afterInteractive":
import Script from "next/script";
export default function RootLayout({ children }) {
return (
<html>
<body>
{children}
<Script
src="https://cdn.visz.ai/v1/snippet.js?id=vz_your_key"
strategy="afterInteractive"
/>
</body>
</html>
);
}Notes
- Astro: add the snippet with the
is:inlinedirective to your layout’s<head>— withoutis:inline, Astro rebundles the script. - There is no npm package in Layer One — the plain snippet is the official way, including for React/Vue/Next.
- Custom events are captured afterwards via the JS API:
visz('event', name, props).
Next: Continue to verification.
Last updated:
Last updated on