Easy Google Analytics Cross Domain Tracking

Theo Bennett - February 24, 2016

Earlier this year, we posted a walkthrough to help you deploy Google Analytics Cross Domain Tracking via Google Tag Manager. (To learn more about this topic, check out our quick video which covers all the benefits of cross domain tracking in Google Analytics).

This post will cover the same topic, but instead of using Google Tag Manager, we will customize the base Google Analytics Tracking Code (GATC).

As we did in out last post, let’s begin with the sample use case:

Your site links to another top level domain where some sort of conversion (sale, registration, etc.) takes place.

e.g. A visitor lands on example.com and registers on conversion.com

In this scenario and using the default version of the GATC, your conversions will all show as referrals from example.com and the original channel data (organic, email, paid, etc.) will be lost. That makes it very hard to determine which channels, sources, keywords and campaigns are effective!

The solution:

By using cross domain tracking, a code customization for GA, your site can “pass” the cookie data to the other domain and your conversion will now be attributed to the proper marketing initiatives.

Step by Step:

First, modify the tracking code. The standard GATC snippet looks something like this:

gatc snippet

The customized version will have two additional lines of code:

ga(‘require’, ‘linker’);


ga(‘linker:autoLink’, [ ‘example.com’, ‘conversion.com’ ]);

And here is how the full GATC would look:

linker gatc

When installed properly, just before the closing of the head tag of both sites, this code will look for any links that go to either example.com or conversion.com and append a special parameter to the link. (Please note that this will not work on advanced implementations where links are determined via JavaScript or in some cases where JavaScript is tied to click actions. Please see the link at the bottom of this post to the full documentation on how to modify implementations like these or how to add to forms with more custom code.)

With the cross domain version of the GATC now in place, whenever a link is clicked on example.com that leads to conversion.com, GA will append the link with information that allows the two sites to share the data (in the same analytics account) between the domains. The link will have a parameter added that looks something like this:


If you have any forms that submit to the third-party domain, you’ll want to follow the link at the bottom of this post and review the in depth documentation from Google.

Lastly, you will need to go into the Google Analytics Admin settings (you will need “edit” access on the property level to complete this) and select “Referral Exclusion List” and click “Add Referral Exclusion.”

Referral Exclusion

Add the domains that visitors will traverse on your site:

exclude domain tracking

Make sure you have goals set up to measure these conversions so that when you review your source/medium and other acquisition reports your goals will be attributed to the proper last-click source and your multi-channel conversion will show how channels interact to support your business.

As always, this customization only allows you to collect better data. Make sure that you allocate resources to analyze the data. Please check out these resources for more information from Google.



© 2024 MoreVisibility. All rights reserved.