How to Set Up Cross Domain Tracking via Google Analytics

  • Mar 08, 2018

  • by Saurabh Kumar

0
Get in
touch
How to Set Up Cross Domain Tracking via Google Analytics

What is Google Analytics Cross Domain Tracking?

Cross domain tracking enables Google Analytics to view different sessions on related sites as a single session. Such kind of tracking is also known as site linking. 

In the absence of cross-domain tracking, when a user lands on your online shopping site and later moves to a third party shopping cart/ecommerce site, he is accounted for as two separate users. These separate users, in Google Analytics, are shown to have separate sessions.

For instance, a user lands on website.com. Upon further navigation, he reaches thirdpartywebsite.com. The user’s visits on both the site will be accounted for as two separate sessions even though in reality it constitutes a single session.

Your domains without cross domain tracking

When one combines multiple domains together and views the reports in a single property in Google Analytics, it’s called cross-domain tracking. Your report is likely to look like this, post the implementation of the tracking code:

Here are your domains with cross domain tracking

Cross domain tracking allows one to track and analyse numerous websites in a single view.  

Is there really a need for cross-domain tracking?

Cross-domain tracking enables in centralisation of data.  However, if you don’t have more than one domain, you clearly don’t need cross-domain tracking.

The need for cross-domain tracking arises so as to facilitate the easy tracking and analysis of a user’s journey across multiple domains. In case a user visits your website but makes a purchase through a third-party website, he is counted as two unique users in Google Analytics in the absence of a cross-domain tracking code. The user’s session on both the platforms will be counted as unique sessions having different durations. 

So, Google Analytics ends up generating incorrect reports without the cross-domain tracking codes in place in terms of number of users, number of sessions, session duration etc. This makes understanding the source of lead conversion, user behaviour and user journey very tedious and inaccurate.

Basic Requirements for Understanding and Implementing Cross Domain Tracking

While tracking multiple domains, the client ID must be setup. The value of the client ID should be transferred from the primary domain to the secondary domain using autoLink plugin. 

The following steps can be carried out so as to establish cross-domain tracking: 

1. Modification of tracking code

1.1 Make changes to the default tracking code for the primary/main domain to incorporate cross-domain tracking. 

Look for the ‘create’ line in the snippet. For instance, if the website is called example-1.com, it will look like this:

ga('create', 'UA-XXXXXXX-Y', 'website.com');

Make the following changes to the snippet (the changes you need to make are in bold red text):

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXXXX-Y', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['thirdpartywebsite.com']);
ga('send', 'pageview');

Don’t forget to replace the example tracking ID (UA-XXXXXX-Y) with your own tracking ID. Interchange the example secondary domain (thirdpartywebsite.com) with the secondary domain.

1.2 Make changes to the tracking code for the secondary domain.

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXXXX-Y', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['website.com']);
ga('send', 'pageview');

2. Setting up of referral exclusions

Create and add a list of all the domain names that shouldn’t be considered as referral traffic on the ‘Referral Exclusion List’ page. 

To do so, click on the Admin tab of the Google Analytics account. Go to the ‘Tracking Info’ option under the middle property column. This will enable a new set of links to pop up including that of the ‘referral Exclusion List’.  

Navigate to Referral Exclusions for cross domain tracking in Google Analytics Admin

Common Bloopers with Google Analytics Cross Domain Tracking

Firstly, most people implement cross domain tracking in Google Analytics without actually understanding the need and requirements of the same. There is a possibility that you don’t need cross-domain tracking at all, so delve deeper to assess if you need to implement such tracking. 

Secondly, people often get confused between tracking across different domains and tracking across subdomains leading to incorrect implementation of tracking codes.  

Thirdly, the problem of self referrals can be avoided by not opting for the default setting i.e. putting all the domains, subdomains and other assets under one property.

Fourthly, one tends to implement cross-domain tracking and leave it at that. However, it is vital for one to keep going back to their cross domain tracking set-up to ensure its accuracy. Ideally, one should perform test-purchases using UTM parameters to track implementation across domains.  

Conclusion

Setting up cross domain tracking codes is usually not that big of an issue. What’s more important is to figure out whether you need such tracking or not? Will it serve any purpose? 

Merely implementing cross domain tracking in your Google Analytics is not enough. One must know how to make sense of the cross-domain traffic, sessions and other relevant information. This information will not appear automatically in the Analytics reports. Separate properties will have to be created housing different reports for one to make sense of all that data.

Let's Work Together

Begin With a Free Quote

About author

Saurabh Kumar
  • Saurabh Kumar

A marketing enthusiast with a fascination for technology, an interest in tinkering with data and systems, and 4+ years of experience at ebookers, Saurabh Kumar Founder Envigo, a digital marketing agency, in the year 2007. His passion for Digital Marketing led him to launch a data-driven digital marketing solutions agency.

View posts by Saurabh Kumar

You might also like

Start your project


  • No comment added.
Download