Install the tracker
Versuch installs with one script tag. No SDK, no build step. Once it is on the page, pageviews (including SPA route changes) and clicks are captured automatically.
The snippet
Section titled “The snippet”Add this tag so it loads on every page, immediately before the closing </body> tag:
<script defer src="https://cdn.versuch.ai/v.js" data-site-id="vpk_live_…" data-api="https://edge.versuch.ai"></script>data-site-id is your public ingest key (it looks like vpk_live_…). Copy it from the dashboard under Install & keys. It is write-only and safe to commit and ship in client code. data-api defaults to https://edge.versuch.ai.
The v.js loader is small: it installs the API stub, reads your data-* config, and injects the content-hashed tracker. Releases ship behind the loader automatically, so you never change the tag again.
Install by framework
Section titled “Install by framework”Paste the tag before </body> in your shared layout, footer, or template so it loads on every page.
<!-- … page content … --> <script defer src="https://cdn.versuch.ai/v.js" data-site-id="vpk_live_…" data-api="https://edge.versuch.ai"></script> </body></html>Use next/script inside <body> in app/layout.tsx:
import Script from "next/script";
export default function RootLayout({ children }: { children: React.ReactNode }) { return ( <html lang="en"> <body> {children} <Script src="https://cdn.versuch.ai/v.js" data-site-id="vpk_live_…" data-api="https://edge.versuch.ai" strategy="afterInteractive" /> </body> </html> );}Add the tag to pages/_document.tsx inside <body>:
import { Html, Head, Main, NextScript } from "next/document";
export default function Document() { return ( <Html lang="en"> <Head /> <body> <Main /> <NextScript /> <script defer src="https://cdn.versuch.ai/v.js" data-site-id="vpk_live_…" data-api="https://edge.versuch.ai" /> </body> </Html> );}Add the tag to index.html before </body>. It loads once for the whole SPA.
<body> <div id="root"></div> <script type="module" src="/src/main.tsx"></script> <script defer src="https://cdn.versuch.ai/v.js" data-site-id="vpk_live_…" data-api="https://edge.versuch.ai"></script> </body>Add it to your root layout before </body> so every page inherits it.
<body> <slot /> <script defer src="https://cdn.versuch.ai/v.js" data-site-id="vpk_live_…" data-api="https://edge.versuch.ai"></script> </body>Verify it works
Section titled “Verify it works”-
Run your site and open it in a browser to fire a pageview.
-
Open the Versuch dashboard under Install & keys. Events should appear within a few seconds.
-
If nothing shows up, confirm the tag is before
</body>and thatdata-site-idis unchanged.
Next steps
Section titled “Next steps”- Track events for conversions and experiment goals.
- Identify users to link anonymous visitors to your accounts.
- Advanced options: SPA tracking, cookieless mode, first-party proxy, and batching.