Google is now offering Universal Analytics as the standard Google Analytics installation. For the most part, it much simpler, flexible and feature rich than previous models of the software. One thing that has changed is the way we implement cross domain tracking. While previously, you had to call the link method, with Universal Analytics, there are few different steps. In this post we look at how to set up cross domain tracking in Universal Analytics. This will allow us to correctly collect goals, ecommerce, etc. without the use of Google Tag Manager.
Get your Tracking Code Installed
For the purpose of this blog, I am going to assume you already have upgraded to Universal Analytics and tracking code is on both domains.
How to Install Cross Domain Tracking with Universal Analytics
Set up AutoLink Plugin
So the main thing that we need to accomplish is that we need to pass the visitor tracking cookie from site A to site B (B is the shopping cart site). Once you have your tracking code in place, the easiest thing you can do is use the autoLink plugin from Google. According to Google, “The Cross Domain Auto Link plugin is the recommended way to implement cross domain linking with analytics.js.”
On your .site without the shopping cart (site A), add the following JavaScript code to all your pages. Important, make sure this is added after your Universal Analytics tracking code.
….
ga(‘send’, ‘pageview’);
// Load the plugin.
ga(‘require’, ‘linker’);
// Define which domains to autoLink.
ga(‘linker:autoLink’, [‘abccart.com’]);
According to Why Measure That, “If you have implemented the autoLink plugin correctly, whenever you click on links that lead to the 3rd party (e.g. shopping cart) domain, you should see the URL is attached with the _ga query string.”
On the shopping cart website you also need to add code. Create the call as listed below.
ga('create', 'UA-XXXXXX-X', {
'allowLinker': true
});
Add Referral Exclusion
After you have installed the autoLink plugin it is time to add your referral exclusion. First, find your property and then navigate to referral exclusion list. Once you are there, click add referral exclusion. You need to exclude website A from the profile.
Now when you utilize Google analytics you should now longer have issues with seeing your own domains as referring site traffic! I hope you enjoyed setting up cross domain tracking in Universal Analytics. If you didn’t get it right, send us a note.
Sources
- Cross Domain Tracking (Google Analytics and Universal Analytics), 2014. Google