Google Analytics: How To Set Up & Test Cross Domain Tracking in GA & Tag Manager

By Marcin
May 14, 2019
3 min read

Making Sure Your Properties Are Set Up Correctly

If your business website is set up across multiple domains, you might want each of them to report to a separate Google Analytics property or view. There are however, more than a few good reasons to have each domain report to a single view as well. If you're not sure, it's relatively simple to do both.

If you'd like to learn why why you might want all your domains and sub-domains reporting to a single view, you can email me and ask.

For now however, I'm going to show you how I did it.

This will contain all the domains you want to link together. Later, we'll use this variable to indicate which domains should be linked together.

In this instance, I am using example domains. However, at the end of this guide, I'll show you how to test this and make sure it was properly implemented.

Step 2: Create a Google "Universal Analytics" Tag & Modify Configuration in Google Tag Manager

Now that we have a variable which auto-magically links your domains together, we're going to put it to work inside of our pageview tag. Make sure to select the correct UA variable under "Google Analytics Settings." The view corresponding to the UA code here is the one which all our data will display to.

Fields to Set: allowLinker: true

Selecting "allowLinker: true" enables GTM to include the additional data in the URL which links all the sequential page visits across the site together as a session. If you forget a specific domain in the "autoLink variable" above, this chain will be broken at that domain, and cross domain tracking will not work on those pages.

Fields to Set: cookieName: _rollup

Make sure all pages included in this instance of cross domain tracking share the same cookie name. Here I am using a common term "rollup" to designate that this cookie is going to push data to the cross domain view in Google Analytics. This is an incidental detail, you can name your whatever you'd like.

Tag Configuration: Cross Domain Tracking Section

Finally, you'll notice that the constant made in the previous step is selected here under "auto link domains." At first, I write "true" but correct it by selecting the variable name.

At this point, cross domain tracking should be working - but it's always important to make sure! There are more than 1 way to test this.

Testing: Real Time Reporting Method

You can do it in "real time" by visiting the domains you linked together and viewing the real time reports. If you, a single user, is showing up as 2 or more users (1 user per page), then it is not correctly set up. However, if you have lots of traffic on your site this method will not work. You simply won't be able to tell if the difference between the numbers is significant or accurate.

Step 3: The UTM Method of Testing The Success of Your Cross Domain Tracking

3.1 Create UTM and Browse All Domains

We know it works when a user's journey across multiple domains are linked together in a single session. We can track the desired session by creating a UTM and visiting the site, then visiting all the other linked domains as well.

3.2 Create Segment and View Pages

Under site content > all pages: create a segment using traffic source, insert your UTM info, then apply it. The result is a list of all the domains you traveled to in that session, in order from most traveled to least.

Note: Make sure you're viewing the data in a view that is not filtering your IP in Google Analytics. I actually did this and wasted some time trying to figure out what was wrong.


No Comments.