Cross-domain tracking
Track one visitor across your main site and subdomains.
Last updated June 3, 2026
Use this when your marketing site, app, docs, or checkout live on subdomains of the same domain. A visitor who lands on example.com and then opens app.example.com should stay one visitor in Grometrics, not become two separate people.
Nothing extra to configure
Install the normal tracking snippet on each related host with the same data-site value. Grometrics handles the shared visitor cookie automatically.
Steps
Use the same snippet everywhere
Paste the same Grometrics script on your main site, app subdomain, docs, and any checkout pages you control.
Replace YOUR_SITE_ID with your site ID from Settings > Tracking.
HTML
1<script defer src="https://usegrometrics.com/g.js" data-site="YOUR_SITE_ID"></script>Keep the visitor together
When someone moves between subdomains, the tracker reuses the same anonymous visitor id where the browser allows it.
Still see where events happened
Each event keeps its real hostname, so you can still filter traffic from the main site, app, docs, or checkout.
Common Setups
| Path | Visitor | Reports |
|---|---|---|
example.com to app.example.com | Same anonymous visitor | Events show the real hostname |
docs.example.com to app.example.com | Same anonymous visitor | Docs and app traffic stay filterable |
example.com to an external checkout | Separate browser domain | Use checkout metadata or a return URL to reconnect revenue |
What happens next
To check it, open Realtime, visit the main site, move to a subdomain, and confirm one visitor timeline includes both hostnames.
Troubleshooting
It still looks like two visitors
Confirm both hosts use the same data-site value and that the browser is not blocking first-party cookies.
A third-party checkout breaks the path
Use the supported checkout integration or return URL so payment attribution can reconnect the sale to the original visitor.
Was this page helpful?