New: Free plan is live 7 August 2026 · View changelog →
Antlytics logoAntlytics

Plain HTML / vanilla JS

Works with any site that lets you add a <script> tag — static HTML, GitHub Pages, Squarespace custom code, or any CMS with a custom head field.

Prerequisites

  • An Antlytics account and at least one site created in your dashboard
  • The tracking ID (UUID) from Settings → Tracking Snippet

1. Copy your tracking ID

Sign in to your Antlytics dashboard and open Settings → Tracking Snippet. The snippet shown there is pre-filled with your tracking ID for the selected site.

2. Add the snippet to your <head>

Paste the block below into the <head> of every page you want to track. Replace YOUR_SITE_ID with the UUID from your dashboard.

<script
  defer
  src="https://www.antlytics.com/tracker.js"
  data-tracking-id="YOUR_SITE_ID"
  data-api-host="https://www.antlytics.com"
></script>

Prefer copying the exact snippet from Settings → Tracking Snippet in your dashboard — it always matches the live generator output. The hosted script includes 30-minute visit timeout, sticky first-touch UTMs, engagement beacons, and Antlytics.track().

3. Verify data is flowing

Open your live site in a browser, then check the real-time count in your Antlytics dashboard. Data appears within seconds. Full traffic charts refresh on page reload.

What the snippet does

  • Sends one pageview on initial load.
  • Tracks SPA navigations via History API patches and popstate (pathname changes only).
  • Sticky first-touch UTMs + referrer for the visit; 30-minute idle visit timeout.
  • Engagement beacons (scroll depth + active time) on hide/unload.
  • No cookies for identity. The visit ID lives only in sessionStorage.

Troubleshooting

If data does not appear after a few minutes:

  • Check the browser Network tab for a POST to /api/ingest/pageview — the response should be 200.
  • Confirm the tracking ID in the snippet matches the one in Settings → Tracking Snippet.
  • If you use an ad blocker in your own browser, test in an incognito window, or set up the first-party proxy.
  • Check that nothing blocks loading https://www.antlytics.com/tracker.js (CSP script-src or a script-blocking plugin).

See Troubleshooting for more common issues.

Something missing? Get in touch and we will update these docs.