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. Find it under Sites > your site > Settings, 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 under 2 KB and does not block rendering.

  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.
  • 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 event quota.

Script attributes

AttributeWhat it does
data-siteRequired. Your site's public id; links events to the right site.
data-outboundAuto-tracks outbound link clicks and file downloads (pdf, zip, csv, xls, doc, ppt, dmg, exe, mp4, mp3, wav) as events.
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.
Example: with outbound link trackinghtml
<script
  defer
  src="https://app.numative.com/numative.js"
  data-site="YOUR_SITE_ID"
  data-outbound
></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

Visit any page of your site with ?numative_ignore=true appended to the URL. The preference is stored in your browser's localStorage and your visits are no longer counted on that site. Use ?numative_ignore=false to undo it.

Troubleshooting

  • No data appearing. Confirm the script tag is in the served HTML, data-site matches the id in Settings, and you are not testing on localhost or with the opt-out set.
  • 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.