Skip to content
Tracking and technical

What is cross-domain tracking?

3 min read · Updated · By the Reveata team

Short answerCross-domain tracking links a visitor's activity across two or more websites with different root domains, such as example.com and example-app.io, so the move from one to the other continues the same visit and keeps its original source instead of starting over as a new visitor.

Brown wooden bridge over the river
Photo by Patrick Adcock on Unsplash

Browsers keep cookies separate for each site. An analytics id stored on example.com cannot be read on example-app.io. So when someone reads your marketing site and then signs up in your app on another domain, a basic setup sees two people: one who left, and a new one who arrived from a referral, your own marketing site. The sign-up, and any revenue, is credited to the wrong place.

When you need it

  • A marketing site and an app on different domains (brand.com and brandapp.io).
  • Separate country sites (example.de, example.fr) under one analytics property.
  • A shop or booking system you host on its own domain.

You do not need it for subdomains of one domain, such as www.example.com and app.example.com. Those can share cookies; see subdomain tracking.

How it works in general

Because cookies cannot travel, the id travels in the link. When a visitor clicks from domain A to domain B, the script adds a parameter carrying the visitor id to the link. On domain B, the script reads it, stores the same id in its own cookies and carries on.

The weak spot is that anyone could copy such a link and share it, making strangers look like one visitor. Good implementations limit how long the parameter is valid and where it is accepted from.

How Reveata does it

  1. Add the other root domain under Settings → General → Additional domains. Up to 20 additional domains are allowed per website.
  2. Use the same snippet on each domain, listing the others in data-domains:
html
<script defer data-website-id="ws_your_tracking_id" data-domains="example-app.io" src="https://reveata.com/js/script.js"></script>

At the moment of the click, the script adds a short _dt parameter to links to those domains. The other domain accepts it only if the link is less than 2 minutes old, the page was opened from one of its own data-domains (the referrer says so) and the ids are well formed. It then stores the ids and removes _dt from the address bar. A copied or old link simply starts a new visitor (Cross-domain tracking).

Links you open from JavaScript are not clicked, so pass them through reveata.decorate(url) first (JavaScript API).

Limits to know

  • Only real link clicks. Redirects from your server, forms posting to the other domain and window.location changes carry no id unless decorated.
  • The referrer must arrive. Referrer-Policy: no-referrer or rel="noreferrer" on the link removes it, and the ids are ignored. The browser default works. See Referrer-Policy.
  • Cookieless mode stores no ids, so there is nothing to pass. Visits only join up when the server's daily id matches.
  • Hosted checkouts from Stripe, Polar or Dodo Payments are linked through the checkout itself, not cross-domain tracking (Connect a payment provider).

Testing it

Open the first domain in a private window from a link ending in ?ref=crossdomain-test, click through to the other domain, and check Realtime: you should see one visitor whose pages span both hosts, still credited to crossdomain-test.

Frequently asked questions

Why does my second domain show my first domain as a referrer?

The visitor id did not carry over, so the second site saw a new visitor coming from a link. Check that both snippets list each other in data-domains, that the domain is under Additional domains, and that the link has no rel="noreferrer".

Is cross-domain tracking allowed under privacy law?

It links activity across sites you own, using the same pseudonymous id. Whether you need consent depends on your setup and your visitors' countries, not on the number of domains; describe it in your privacy notice. This is not legal advice.

Can I track across domains I do not own?

No. Additional domains must belong to the same website, and Reveata refuses events from hosts that are not listed.

See it with your own numbersReveata ties every visit and sale to the source that brought it. Add your website in a minute.
Get started
Was this page useful?
GlossaryWhat is subdomain tracking?Subdomain tracking means measuring several subdomains of one domain, such as www.example.com, blog.example.com and app.example.com, as a single website, so a person who moves between them stays one visitor with one visit and one traffic source.GlossaryWhat is a first-party cookie?A first-party cookie is a small piece of data stored by the website shown in the address bar, on that site's own domain. Only that site can read it, which is why it is used for sign-in sessions, shopping baskets and first-party analytics.GlossaryWhat is Referrer-Policy?Referrer-Policy is an HTTP header, meta tag or link attribute that tells the browser how much of the current page's address to send in the Referer header when a visitor follows a link or the page loads a resource, from the full URL to nothing at all.GlossaryWhat are Core Web Vitals?Core Web Vitals are three measurements Google uses to describe a page's real-world user experience, namely Largest Contentful Paint (loading), Interaction to Next Paint (responsiveness) and Cumulative Layout Shift (visual stability).GlossaryWhat are event properties?Event properties are key–value details attached to an analytics event, such as the plan chosen or the button clicked on a signup event, so you can break one event down by those details instead of creating a separate event for every variation.GlossaryWhat is a canonical URL?A canonical URL is the one preferred address you want search engines to index and show for a page whose content is reachable at several URLs, usually declared with a rel="canonical" link in the page's head.