In this post we will discuss on how to setup cross domain tracking using Google Tag manager.
What is cross domain tracking?
Cross domain tracking is an approach to allow Google Analytics to track a visitor as a continuous session on two or more related sites, domains or subdomains. You can track one user on multiple domains, or subdomains, with one session. This will be helpful to determine where your user is coming from, and what the best traffic sources are to convert them.
Cross-domain tracking using GTM
Google Tag Manager makes life simple in implementing cross domain tracking in Google Analytics. Throughout the post we will use the two example domains, example1.com and example2.com
In Universal Analytics (analytics.js) you can use the Auto Link Domains method for cross domain tracking. In this post I am going to explain how to implementing cross domain tracking in GTM through ‘Auto Link Domains’
To successfully implement cross domain tracking for your domain you need to configure your GTM as well as Google Analytics settings. Read further on how to achieve this.
GTM configuration for example1.com
Ø Login to Google Tag Manager account
Ø Edit your Page View tags under Tags
Ø Edit the Configure Tag
Ø Look for More Settings - Fields to Set. Set allowLinker to True and cookieDomain to auto
Ø Scroll down and look for Cross Domain TrackingàAuto Link Domains (under ‘More Settings) and enter ‘example2.com’ (for multiple domains enter comma separated list like “example2.com, example3.com, example4.com” etc.)
Ø In case your source domain link to destination domain through form and you would like to share cookie information on form submission then set the Decorate Forms to True.
Ø Click on Save and you are done!
You are done with the GTM cross domain tracking setup.
Once the GTM setup is done you need to configure the google analytics setting for cross domain tracking to work flawlessly.
Google Analytics Configuration for example2.com:
With this step we are telling Google Analytics not to create a new session whenever they see traffic coming from the other domain (in this case, example2.com)
Ø Login in to your Google Analytics and navigate to your Admin section on top right. Under property setting you will find ‘Referral Execution List’
Ø Now Add ‘example2.com’ in the ‘referral exclusion’ list:
Repeat the above GTM and Google Analytics configuration steps to set bidirectional cross domain tracking (i.e. linking from example1.com to example2.com and vice versa).
Note: we did the linking for example1.com in the above steps.