Install the snippet
Add the cookieless tracking script to any site: attributes, SPA support, outbound links, custom events and troubleshooting.
- 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
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
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
localhostis ignored by default, so test on a deployed URL (or seedata-allow-localhostbelow).
What is tracked automatically
- Pageviews, including single-page-app navigation: the tracker hooks
pushState,replaceStateandpopstate, 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
sessionStoragethat 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
| Attribute | What it does |
|---|---|
data-site | Required. 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-hash | Counts URL hash changes as pageviews, for hash-based routers. |
data-allow-localhost | Counts localhost traffic. Useful while developing; leave it off in production. |
data-api | Overrides the collection endpoint. Defaults to /api/event on the script's own origin; set this if you proxy the script. |
<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:
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-sitematches 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) andconnect-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.