# Install the tracker

> The one script tag that installs Venbit Intelligence, what each attribute does, and examples for plain HTML, Next.js and Google Tag Manager.

Source: https://venbit.com/docs/developer-guide/install-the-tracker
Part of the Venbit Intelligence docs (Developer Guide). Index of every page: https://venbit.com/docs/llms.txt
Last updated: 2026-11-30

Venbit installs with a single script tag in the `<head>` of every page. The file is about 23 KB gzipped and loads deferred. You don't need any other code.

```html
<script defer crossorigin="anonymous" src="https://vnbt.app/m.js?s=KEY" data-site="KEY"></script>
```

Replace `KEY` with your site's key. There's no need to build the line by hand. In the [dashboard](https://venbit.com/dashboard), open **Settings**, then **Tracking**, and press **Copy the line** under **Your tracker line**. Your key is already in both places in the copied line.

## Where the line goes

Put it once, wherever every page shares markup: the root layout, the shared head template, the theme header, or `index.html` for a single-page app. Pages you add later need it too.

![The Tracking tab in Settings: the tracker line for the website, a Copy the line button, a Send to your dev/AI agent menu, and platform buttons that open the steps for WordPress, Wix, Squarespace, Shopify, Webflow, GoDaddy, Tag Manager, Square Online, HubSpot and hand-built sites](https://venbit.com/images/docs/settings-tracking-light.webp "Settings, Tracking. Pick a platform there to see its steps beside your own line.")

Keep the tag as written. Don't bundle the file, download a copy of it, or move the tag to the end of `<body>`.

### Plain HTML

```html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Harbor Roofing</title>
    <script defer crossorigin="anonymous" src="https://vnbt.app/m.js?s=KEY" data-site="KEY"></script>
  </head>
  <body>
    <h1>Roof repair in Everett</h1>
  </body>
</html>
```

### Next.js (app router)

The tag goes in the root layout, `app/layout.tsx`. Route changes get counted on their own (see [Single-page apps](https://venbit.com/docs/md/developer-guide/single-page-apps.md)).

```tsx
export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <head>
        <script
          defer
          crossOrigin="anonymous"
          src="https://vnbt.app/m.js?s=KEY"
          data-site="KEY"
        />
      </head>
      <body>{children}</body>
    </html>
  );
}
```

### Google Tag Manager

Paste the line into a **Custom HTML** tag that fires on **All Pages**. When Tag Manager rebuilds the script tag it drops every `data-*` attribute, and that's why the line carries the key in its address as well (`?s=KEY`). Leave that part in and the install works. [Platform guides](https://venbit.com/docs/md/developer-guide/platform-guides.md) has the click-by-click steps.

## Hand the install to someone else

The **Send to your dev/AI agent** menu sits next to **Copy the line** and has two choices:

- **Email your developer**: Venbit emails them the line and where it goes.
- **Copy a prompt for an AI agent**: copies a ready prompt for Claude Code, Cursor or the agent that builds your website. Paste it into the agent's chat and it adds the line.

Or paste this into a coding agent yourself, with your key filled in where it says:

```prompt
Add the Venbit Intelligence tracker to this website. Put this tag once in the <head> that every page shares (the root layout, e.g. app/layout.tsx in Next.js, the shared head template, the theme header, or index.html for a single-page app): <script defer crossorigin="anonymous" src="https://vnbt.app/m.js?s=KEY" data-site="KEY"></script> with KEY replaced by [your site key] in both places. Keep defer and crossorigin, don't bundle or download the file, and don't move it to the end of <body>. Tell me which file you changed.
```

## What each part of the line does

| Part | What it does |
| --- | --- |
| `src="https://vnbt.app/m.js?s=KEY"` | Where the tracker loads from. `?s=KEY` is a second copy of the key that survives tools that strip attributes. |
| `data-site="KEY"` | Says which site the visits belong to. |
| `defer` | The browser downloads the file without pausing the page and runs it once the HTML is parsed. |
| `crossorigin="anonymous"` | The file is requested without cookies or credentials. |

Once it has loaded from `vnbt.app`, the tracker fetches its current copy from `venbit.com` and sends visits to `https://venbit.com/api/e`. If your site has a [Content Security Policy](https://venbit.com/docs/md/developer-guide/content-security-policy.md), allow both hosts.

Older installs that load `https://venbit.com/m.js` keep working. You don't need to replace them.

## Optional script tag attributes

| Attribute | Value | What it does |
| --- | --- | --- |
| `data-site` | Your key | Which site this is. Required unless the key is in `?s=` or `window.venbitSite`. |
| `data-mode` | `app` | App mode: only the sign-ups and payments your code reports are sent. No page views, clicks or forms. See [Sign-ups and purchases](https://venbit.com/docs/md/developer-guide/sign-ups-and-purchases.md). |
| `data-endpoint` | A URL or path | Sends visits to this address in place of `https://venbit.com/api/e`. Used when you serve the tracker from your own domain. See [First-party proxy](https://venbit.com/docs/md/developer-guide/first-party-proxy.md). |
| `data-capture` | `off` | Nothing a visitor types is captured, on any form. See [Privacy controls](https://venbit.com/docs/md/developer-guide/privacy-controls.md). |
| `data-allow-local` | Any non-empty value, such as `1` | Lets the tracker run on localhost and other local addresses, where it normally stays silent. |

## Globals for when the tag cannot carry attributes

Some tools rebuild or merge script tags and lose the attributes and the query string along the way. For that case there are two globals. Set them in an inline script that runs before the tracker.

```html
<script>
  window.venbitSite = "KEY";
</script>
```

| Global | Same as | Use it when |
| --- | --- | --- |
| `window.venbitSite` | `data-site` | The tag reaches the page with no `data-site` and no `?s=KEY`, for example after a script-combining plugin. |
| `window.venbitEndpoint` | `data-endpoint` | You run a first-party proxy and the tool that injects the tag drops `data-endpoint`. Set it to the same value, for example `"/vb/api/e"`. Leave it out otherwise. |

Key lookup order: `data-site` first, then `?s=`, then `window.venbitSite`.

## Where visits are counted

Only the domain registered for the site counts visits, with or without `www`, plus every subdomain. Paste the same line on some other domain and it counts nothing. To add a second domain or move to a new one, open **Settings**, then **Tracking**, and press **Change** under **Your website**.

A few other places where the tracker stays silent:

- **Local addresses.** `localhost`, loopback and private network addresses (`127.x`, `10.x`, `192.168.x`, `172.16` to `172.31`), hosts ending in `.local`, `.test` or `.localhost`, and pages opened from disk (`file:`).
- **Iframes.** A page shown inside a frame isn't a second visit.
- **Automated browsers.** Browsers driven by test automation are skipped.
- **Opted-out browsers.** Once a browser opens the site with `?vb_optout=1`, it sends nothing until it opens `?vb_optout=0`. See [Privacy controls](https://venbit.com/docs/md/developer-guide/privacy-controls.md).
- **Pages nobody has looked at.** Prerendered pages and pages opened in a background tab are counted when they're first shown, and not before.

### Test on localhost

With `data-allow-local="1"` on the tag, the tracker runs on a local address and you can watch its requests in the network tab before you ship. It needs a value. A bare `data-allow-local` does nothing.

```html
<script defer crossorigin="anonymous" src="https://vnbt.app/m.js?s=KEY" data-site="KEY" data-allow-local="1"></script>
```

> **Heads up:** This proves the tracker runs and sends. Visits still count only on your registered domain, so check the numbers on the live site. Take the attribute out before you deploy. An opted-out browser stays opted out even with it set.

## One copy per page

Sometimes the line ends up on a page twice, usually a tag manager plus a hard-coded tag. The second copy stops and nothing gets counted double.

## Common questions

### Where do I find my Venbit site key?

In the Venbit dashboard, open **Settings**, then **Tracking**. **Your tracker line** shows the whole install line, and **Copy the line** copies it with your key already in both places (`?s=KEY` and `data-site`).

### Does the Venbit tracker run on localhost?

Not by default. It stays silent on localhost, private network addresses, `.local` and `.test` hosts and `file:` pages. Add `data-allow-local="1"` to the tag to watch its requests locally, then remove it before you deploy, since visits still count only on your registered domain.

### Can I put the Venbit script at the end of the body?

Keep it in the `<head>` as written. The install instructions say not to bundle the file, download a copy of it, or move the tag to the end of `<body>`.

### Can Venbit count visits on more than one domain?

It counts the domain registered for the site, with or without `www`, and every subdomain. On any other domain the same line counts nothing. To add a second domain or move to a new one, press **Change** under **Your website** in **Settings**, then **Tracking**.

### Does Venbit work with Google Tag Manager?

Yes. Paste the line into a **Custom HTML** tag that fires on **All Pages**. Tag Manager drops the `data-site` attribute, so leave `?s=KEY` in the address and the tracker reads the key from there.
