Web
Tracking script
The core script is about 2 KB (gzip), loads asynchronously and sets no cookies. It works on any website.
Install
Add the script to the <head> of every page. Pageviews are collected automatically; window.trackd is then available for custom events and revenue.
<script defer src="https://trackd.one/t.js" data-website="YOUR_WEBSITE_ID"></script>
It works on any website — static HTML, React, Vue, Next.js, WordPress, Shopify etc. Web Vitals are loaded as an optional module (≈ 1.5 KB).
Attributes
| Attribute | Meaning |
|---|---|
data-website |
your website ID (required) |
data-host |
points to your self-hosted instance instead of trackd.one |
data-do-not-track="true" |
disables tracking on this page |
data-heatmap="true" |
enables click collection for heatmaps |
data-vitals="false" |
turns off the Web Vitals module |
data-vitals-sample="0.1" |
measures Web Vitals for a share of pageviews only (here 10%) |
Single-page apps
Client-side routing is detected automatically: history.pushState, replaceState, popstate and hashchange each create a pageview. Hash routers (#/path, #!/path) are treated like normal paths.
What is sent
Exactly one request per pageview to POST /api/collect:
{
"type": "pageview",
"website_id": "YOUR_WEBSITE_ID",
"url": "https://example.com/pricing?utm_source=newsletter",
"referrer": "https://www.google.com/",
"title": "Pricing",
"utm_source": "newsletter"
}
- Query parameters with sensitive names (e.g.
token,email,password) are removed before sending; email addresses in URLs are replaced with[email]. - The script reads no device properties such as screen size or language; the server derives language and device type from request headers.
- Of the URL only the path and
utm_*parameters are stored, of the referrer only origin and path.
Domain check
Web requests must come from the registered domain or a subdomain (www. is ignored), otherwise the server answers 403. Visits on localhost are therefore not counted.
Opt-out
Visitors can opt out via Global Privacy Control or “Do Not Track”, your site additionally via window.trackdOptOut = true. See Privacy & GDPR.
Ready in minutes
Create a free account, add your website or app, copy the snippet.