Cross-domain tracking has been the bane of any analyst’s experience for, oh, just about ever. It is probably the hardest thing to get right in a Google Analytics implementation, and in our experience, more people ask us for help with this one issue than any other.
Over the years we’ve dealt with this problem in different ways. jQuery made it easy to drop in a couple lines of code to track behavior across domains, but even then it wasn’t exactly automatic.
Then along came Universal Analytics and Google Tag Manager – the perfect 1-2 punch combo to knock out cross domain tracking once and for all. We held a webinar to show people step-by-step how to implement cross-domain tracking in Google Tag Manager. Below is a recording of the webinar, along with the written step-by-step instructions.
*NOTE: Since the webinar, there have been some updates to Google Tag Manager and Universal Analytics that make cross domain tracking even easier and more intuitive. If you follow the directions in the webinar, it will still work. But the written instructions below are up to date with the newest features.
Step-By-Step Instructions – Universal Analytics
The following instructions will guide you to setting up cross-domain tracking through Google Tag Manager with Universal Analytics.
Create the following macros
* For the value, replace the Xs and Yx above with your UA number.
2. cross domains
3. element url (if you don’t already have it)
Tagging cross-domain links
Create a tag for your Universal Analtyics tracker (I recommend naming it Google Analytics – Universal). The Track Type for this tag should be Page View. If you already have a tag for Universal Analytics, modify it to match the following settings:
1. For Tracking ID, use your uaid macro
2. Under More Settings > Cookie Configuration, set the value of Cookie Domain to auto.
3. Under More Settings > Cross Domain Tracking, set the value of Auto Link Domains to your cross domains macro, and set the Allow Linker drop down menu to True.
* This step has changed since the webinar was recorded. You used to have to go into Fields to Set, and add a Field Name of allowLink with a value of true. Now you can just use the drop down menu pictured above.
4. Set the firing rule for this tag to All pages.
Tagging cross-domain forms
1. Create tag – name it Form Submit
2. Create tag – name it Cross-Domain – Forms
A. Create a copy of your Google Analytics – Universal tag. To do this, click on your Google Analytics – Universal tag and scroll to the bottom. In the lower right corner, click on the Copy this tag button.
B. Name your new copy Cross-Domain – Forms.
C. Change the Track Type to Decorate Form.
D. Remove the All pages rule and add the following 2 rules (which you will need to create):
i. On Form Submit to siteA.com
ii. On Form Submit to siteB.com
Update web property settings
Go into your Google Analytics Admin settings. Under Property Settings, Tracking Info > Referral Exclusion List, add both sites (if not already added).