Do I Need Cross‑Domain Tracking?

August 1, 2016
Do I Need Cross-Domain Tracking?

Cross-domain tracking is one of the more complex, confusing and often misunderstood areas of web analytics. It involves cookies, browser security settings, and an understanding of your overall measurement strategy.

I hope to simplify some of this for you with a simple flowchart, that will tell you whether or not you need cross-domain tracking to begin with. This is the first question that frequently stumps web analysts.

But before you dive into the flowchart, let’s get some things straight:

Let’s Define domain and subdomain

We’ll be defining domain and subdomain for the purposes of cross-domain tracking in Google Analytics.

As such, this is a simplistic explanation of the distinctions, and doesn’t fully examine the subtle differences. If you’d like to learn more, the Wikipedia entry for Domain name is rather extensive.

The domain (also called the root domain) is the part of the website address immediately before the .com (or .net, .edu, .org, etc.). For example:

Full Website URL: http://www.example.com

The Domain Is: example

The subdomain is the part between the http:// and the first dot (.). In our example, www is the subdomain, but consider the following examples:

Full Website URL: http://video.example.com

Full Website URL: http://blog.example.com

Full Website URL: https://shop.example.com

The Subdomains Are: video, blog, and shop, respectively.

Bonus: For extra credit, the part at the end – com, org, edu, etc. – is called the top level domain, or TLD. This is important because from the perspective of cross-domain tracking, example.com and example.org are considered two separate domains.

Do I Need Cross-Domain Tracking?

We use cross-domain tracking with Google Analytics to track multiple websites into one property and to make sure that one user that travels between multiple sites is tracked as a single user. Generally this means that even though there are multiple domains, they serve the same audience and appear to the user as if they’re the same site.

Sometimes, cross-domain tracking is not necessary. Take a look this flowchart:

Cross-Domain Tracking Flowchart

If you followed the chart and determined that cross-domain tracking is necessary, then we’ve got a great setup guide for Google Tag Manager. You’ll need to be able to make changes to your website code or through Google Tag Manager, and you’ll need to follow several steps, which we’ve outlined for you.

What About Subdomains?

Cross-domain tracking only applies if you have multiple domains. If you have a single domain with multiple subdomains, cross-domain tracking is not necessary!

If you have two or more subdomains that you’re tracking into the same Property in Google Analytics, the default tracking code for that Google gives you to put on your site is already set up to automatically work across your subdomains.

Google Analytics Tracking Code

This wasn’t always the case. With the older versions of the Google Analytics tracking code (anything before Universal Analytics and the analytics.js library), you had to modify your tracking code to explicitly tell Google Analytics to set the cookie at the root domain level. That way, all of your subdomains would be able to read and write to the same cookie. Now, that happens automatically.

There are two easy steps for cross-subdomain tracking, 1) Set the Cookie Domain and 2) Update Your Referral Exclusion List. For more information, check out our guide here: