Docs menu · Install the script

Docs › Get started

Install the script

The one line to paste, where it goes on each platform, how to let your AI assistant install it, and how to check it works.

The line

Every site gets its own script with its site code already in it. Paste it into the <head> of every page:

<script defer src="https://nviv.io/js/NV-XXXXXXX.js"></script>

You find your line in Settings › Installation (/app/<your-domain>/install). The script is smaller than 1 kB (gzip), loads with defer and never holds up your page.

There is no inline code, so the line also works on sites with a strict Content-Security-Policy. If you use one, allow https://nviv.io in both script-src and connect-src.

By platform

Platform Where the line goes
HTML In the <head> of every page, or in your shared layout.
WordPress The “WPCode” plugin or your theme: paste the code under “Header”.
Webflow Site settings → Custom code → Head code.
Framer Site settings → General → Custom code → Start of <head> tag.
Shopify Online Store → Themes → Edit code → theme.liquid, just before </head>.
Next.js In app/layout.tsx with <Script src="https://nviv.io/js/NV-XXXXXXX.js" strategy="afterInteractive" /> from next/script.
Google Tag Manager New tag → Custom HTML → paste the code → trigger “All Pages”.

Let your AI assistant do it

Working with Claude Code, Cursor, Lovable or Bolt? On the installation page, choose Copy the prompt for your AI and paste it there. The prompt contains your line, the right place for each framework (plain HTML, Next.js, Astro, SvelteKit, Nuxt, Vite with React or Vue, Remix and React Router, Google Tag Manager), when the queue for early calls is needed, what to do with a Content-Security-Policy, the rules for custom events, and the link to check that it works.

Check that it works

Open the installation page, paste the line and visit your site in another tab. The page checks every 3 seconds and switches to It works as soon as something arrives, with the time and the address of that page. A new site opens on this page by itself until its first visit arrives.

When nothing arrives any more

If a site has not sent a single event yet, its Overview says so and links to the installation. After 48 hours without events, the Overview warns you as well, and the site gets the label Quiet on Your websites. A script that disappeared with a new theme or a release is noticed right away, not a month later.

Installed twice?

If the script ends up on a page twice (a theme and a plugin, or Tag Manager and by hand), the first copy counts and the others stop at once. No pageview is counted twice.

Older form

The older line <script defer src="https://nviv.io/s.js" data-site="NV-XXXXXXX"></script> still works, but it does not follow the per-site choices in What the script measures. Use the line from the installation page.

Choices without changing your code

Whether the script counts clicks on outbound links and downloads, and whether hash routes (#/page) count as pages, is set per site in Settings › What the script measures. Your visitors get the new version within ten minutes; you do not need to change the line or release anything. See Script reference for everything the script does.