Tracker

Script attributes

data-domain, data-api, and data-hash. Everything else is inferred server-side.

AttributeDefaultPurpose
data-domainlocation.hostnameMust match a registered site
data-api{script host}/api/eventOverride the ingest URL
data-hashoffCount #hash changes as pageviews

data-domain

Always set this in production. If you omit it, www.example.com and example.com become two sites unless you registered both. Vector 5 normalizes the domain on ingest, but the dashboard site you created is the source of truth.

data-api

If you vendor the script from your own CDN, you must set data-api or events will post to the CDN host.

vendored
<script defer
  data-domain="example.com"
  data-api="https://analytics.example.com/api/event"
  src="https://cdn.example.com/v5.js"></script>

data-hash

Set data-hash="true" for docs sites and older SPAs that route on the fragment. Modern pushState apps do not need it — those navigations are already hooked.

Something off? Open an issue · Edit on GitHub