Skip to main content

The script

Tracking one visitor across two domains

Count a person who moves between your domains once, not twice.

A visitor who reads example.com and then clicks through to example.org is two visitors, not one, unless you tell us the two domains belong together.

Subdomains need none of this — blog.example.com is already covered. This page is for genuinely different domains.

When you need it

  • A marketing site on one domain and the app on another

  • A main site and a store on separate domains

  • Several brand domains that share one funnel

Setup

Open the site's settings

Sites → your site → Settings.

List the other domains

Under Additional hostnames, one per line:

example.org
myapp.io

Each entry covers its own subdomains, so example.org also means app.example.org.

Install the same tag on every domain

Same data-website-id, same data-domain. Do not give the second domain its own site — that is what splits the visitor in two.

<script
  defer
  data-website-id="ts_a1b2c3d4e5f6"
  data-domain="example.com"
  data-allowed-hostnames="example.org,myapp.io"
  src="https://truestat.io/js/t.js"
></script>

data-allowed-hostnames is optional if you have already listed the domains in settings. Setting it in both places is fine; they mean the same thing.

How it works

When someone clicks a link to one of your listed domains, the script adds a short-lived parameter to that link carrying their visitor id. The receiving page reads it, adopts the identity instead of minting a new one, and removes the parameter from the address bar before anyone sees it.

The back button still works — replacing the URL does not add a history entry.

A shared link does not carry an identity

The parameter contains a timestamp and is refused after 60 seconds.

This matters because a decorated address can be copied. Someone pastes a link into Slack, ten people click it, and without an expiry all ten would arrive carrying the first person's identity and be counted as one visitor. A real click happens in under a second; a shared link almost never does.

What it does not do

It only works between the domains you list. A link to any other site is untouched — no identifier is attached to it. Following people across sites you do not own is the thing this product is built not to do.

It does not work on the cookieless modes. There, identity is derived from the request and never stored in the browser, so there is nothing to carry. That is not a gap to be fixed; it is what those modes are for. If you need cross-domain counting, the default first-party cookie mode is the one that provides it. See Identity and cookieless mode.

Checking it worked

  1. Open your first domain in a fresh browser profile

  2. Click a link to the second one

  3. In the dashboard, look at Visitors for the period covering both

One visitor, and the second domain's visit shows its real source rather than Direct. If you see two, check that both pages carry the same data-website-id and that the second domain is listed in settings.

Was this page helpful?

Last updated August 30, 2026