Install the snippet

Add the cookieless tracking script to any site: attributes, SPA support, outbound links, custom events and troubleshooting.

  1. 1

    Copy your snippet

    Each site has its own snippet with its public site id filled in. Open the site in Numative, click the gear at the foot of the navigation on the left, and find it under Tracking snippet. Or use the template below and replace YOUR_SITE_ID:

    html
    <script defer src="https://app.numative.com/numative.js" data-site="YOUR_SITE_ID"></script>
  2. 2

    Paste it into your site's <head>

    Add the line to every page you want counted, ideally in the shared layout or template so it ships everywhere. The script loads with defer, weighs about 5 KB over the wire and does not block rendering.

    Moving from another analytics tool? Run the import before this step. Imports skip any day the site already has data for, a whole day at a time, so installing first leaves the changeover day half empty.

  3. 3

    Verify

    Open your site in a browser and load a page. The visit appears on the site's Overview within a minute or two, and the live visitors badge turns on. Traffic from localhost is ignored by default, so test on a deployed URL (or see data-allow-localhost below).

What is tracked automatically

  • Pageviews, including single-page-app navigation: the tracker hooks pushState, replaceState and popstate, so React, Vue and similar routers work with no extra code. Rapid duplicate pageviews are deduplicated.
  • Visitors and sessions, cookielessly. Sessions use a random id in the visitor's own sessionStorage that rotates after 30 minutes of inactivity.
  • Referrers, screen size, browser and OS family, and approximate location. Details on what is and is not collected are in Privacy & data.
  • How far and how long. Scroll depth and time actually spent on screen, reported once as the page is left. Time only runs while the tab is visible, so a page left open in a background tab does not inflate it.
  • Every click, described by the element it landed on (selector and visible label, never a typed value). Powers the Clicks view and dead-click detection; unbilled. See Click autocapture.
  • Form submissions, named by the form's own name or id, beside the clicks on its submit button, so forms people try and fail to send are visible; unbilled. See Enhanced measurements.
  • JavaScript errors: uncaught exceptions and unhandled promise rejections, grouped by bug in the Errors section; unbilled. See Error tracking.
  • Web vitals: each visit's own LCP, INP, CLS, FCP and TTFB, powering the Speed view; unbilled.
  • Page-change fingerprints. Once per page per session, the tracker sends a small hash of the page's own content so edits are detected on the first visit after they happen. See Change detection. These do not count against your pageview quota.

Script attributes

AttributeWhat it does
data-siteRequired. Your site's public id; links events to the right site.
data-outbound="false"Turns OFF the automatic outbound-link and file-download tracking (pdf, zip, csv, xls, doc, ppt, dmg, exe, mp4, mp3, wav). It is on by default.
data-autocapture="false"Turns OFF automatic click capture. It is on by default and unbilled.
data-forms="false"Turns OFF form-submission capture. It is on by default and unbilled.
data-errors="false"Turns OFF JavaScript error capture. It is on by default and unbilled.
data-propsA JSON object of context your server knew and the browser can't: that the response was a 404, the term behind a search page, the post's author. It rides every pageview as properties. See Enhanced measurements.
data-hashCounts URL hash changes as pageviews, for hash-based routers.
data-allow-localhostCounts localhost traffic. Useful while developing; leave it off in production.
data-apiOverrides the collection endpoint. Defaults to /api/event on the script's own origin; set this if you proxy the script.
data-fallbackA second endpoint retried when a request to data-api fails at the network level (an ad blocker). Emitted automatically by the proxied install snippets; see Count blocked visitors.

A share of visitors run ad blockers that stop the script or its requests from reaching Numative at all. To count them too, serve the tracker from your own domain: see Count blocked visitors.

Example: with outbound link tracking disabledhtml
<script
  defer
  src="https://app.numative.com/numative.js"
  data-site="YOUR_SITE_ID"
  data-outbound="false"
></script>

Custom events

The snippet exposes a global numative() function for conversions, properties and revenue:

js
numative("Signup")
numative("Signup", { props: { plan: "growth" } })
numative("Purchase", { revenue: { amount: 19.99, currency: "USD" } })

See Custom events, goals & revenue for goals and funnels built on top of these.

Excluding yourself

Open Settings for the site. Under Excluded IP addresses, Numative shows the address you are browsing from and offers a one-click button to exclude it. That covers every browser, browser profile and device behind that connection at once, and it is enforced on our side, so nothing depends on a flag in your browser that clearing site data would wipe.

Add a CIDR range (203.0.113.0/24) to exclude a whole office network. See Site settings for the details, including what to do about a home address that changes.

Troubleshooting

  • No data appearing. Confirm the script tag is in the served HTML, data-site matches the id in Settings, you are not testing on localhost, and your own address is not in the site's excluded-IP list.
  • Content Security Policy. If your site sets a CSP, allow the app origin in both script-src (the script) and connect-src (the event endpoint).
  • Numbers differ from GA4. Expected: Numative filters known bots, counts cookielessly and does not sample. Directionally the two track together; absolute counts will differ.
On WordPress, skip the manual paste: the Numative Analytics plugin injects the snippet with one checkbox and adds server-side AI crawler capture and instant publish pings.