Skip to main content

The script

Subdomains and multiple domains

Which hostnames a site accepts events from, and how to add more.

Subdomains work with no configuration

A site registered as example.com accepts events from:

  • example.com

  • www.example.com

  • blog.example.com

  • docs.example.com

  • anything.deeper.example.com

Paste the same tag, with the same data-domain="example.com", on all of them. They all report into one dashboard.

www. is ignored entirely, so www.example.com and example.com are the same host in both directions.

Telling them apart on the dashboard

They currently share one Top pages list keyed by path. So /pricing on your marketing site and /pricing in your docs are the same row.

There is no hostname breakdown yet. Until there is, the workaround is either to give each subdomain its own TrueStat site, or to accept the merge if the paths do not collide.

Giving each subdomain its own site costs a site against your tier's limit — 1 on Starter, 25 on Pro. See Plans compared.

A different domain entirely

example.org is not a subdomain of example.com, so it needs listing.

In the site's settings, add it under Allowed hostnames. Or on the tag:

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

Comma-separated, hostnames only. Each entry also covers its own subdomains, on the same rule as data-domain.

What happens if you forget to list one

The event is still recorded. Nothing is lost.

What changes is that the collector does not return the header that makes its response readable to the browser, so your console shows a CORS error. That is a diagnostic telling you to add the hostname; it is not data loss.

We chose it that way round on purpose: a customer who adds a subdomain and forgets to list it should see their traffic, not a silent hole in it.

Internal links between your own hostnames

By default, a click from example.com to blog.example.com records the blog view with example.com as its referrer — so it lands in your Referrers breakdown as if it were an outside site sending you traffic.

To make internal navigation count as Direct instead, list your own hostnames under Self hosts in the site's settings. Every hostname you list there is treated as "not an external referrer".

This affects how visits are sorted into channels — see Channels.

Visitor identity across subdomains

On the default first-party cookie mode, a visitor moving from example.com to blog.example.com is recognised as the same visitor, because the cookie is set on the registrable domain.

On the two cookieless modes, identity is derived from the request and the hostname is not part of it, so cross-subdomain recognition also works — for as long as the identifier lasts, which is a day on rotating hash and an hour on strict. See Identity and cookieless mode.

Truly cross-domain tracking

Following one person from example.com to partner.example.org and knowing it is the same person is not supported, on any mode. It requires passing an identifier between the two domains, which is the kind of cross-site linking TrueStat is built not to do. The two domains can report into one dashboard; the same visitor on both counts twice.

Was this page helpful?

Last updated August 28, 2026