Analytics: How to Enable Cross-Domain Tracking in Google Analytics
Enabling cross-domain tracking in Google Analytics allows sessions to continue across properties for tracking purposes.
For example, with cross-domain tracking in place, if a visitor loads your homepage and then follows a link to your news page on a different subdomain, they are treated as a single visitor, consuming multiple pages in a single session.
If your tracking is handled by the SAS tag, follow the instructions below to include a domain in your cross-domain tracking settings:
- Sign in to Google Analytics
- Click on Admin
- Go to Account>>Property and choose the relevant property
- Under the Property column choose tracking info
- In the Tracking Info drop down menu choose Referral Exclusions List
- Click on +ADD REFERRAL EXCLUSION
- Enter the domain of the site you wish to include in cross-domain tracking.
- Click Create to save
- Follow steps 1-5 from above
- In the table, click remove in the row of the domain you want to remove.
- Click Delete Domain to save
If SAS does not handle tags for your station, setting up cross-domain tracking involves editing the tracking code snippet. First, you must edit the tracking code for your primary domain:
- Find the create line in the snippet. For a website called example-1.com, with tracking ID UA-XXXXXXX-Y, it looks like this:
- Make the following changes, where example-2 is your secondary domain name (changes are in red).
ga('create', 'UA-XXXXXXX-Y', 'auto', {'allowLinker':true});
ga('require', 'linker');
ga('linker:autoLink', ['donate.chicagopublicmedia.org']);
In this example, UA-XXXXXX-Y is the tracking ID.
For linking multiple domains, amend the autoLink plugin like so:
More information: Google's documentation on cross-domain tracking
Did you find this article helpful?