This resource will help you set up and implement cross domain tracking via Google Tag Manager.

This resource does not explain the basics of cross domain tracking, we assume that you already have a working knowledge of and know the basics of Google Tag Manager.

There are essentially two different methods you are able to use to deploy cross domain tracking using Google Tag Manager, they are as follows:

  • Decorate link and decorate form tags.
  • Auto link domains (can only be used with analytics.js).

For this resource we are going to concentrate on the second method - auto link domains.

In order to explain the cross domain tracking concept we will presume we are linking two sites called 123.com and 456.com. The 123.com site will be the source domain and 456.com will be the destination domain. Both of the domains contain different Universal Analytics accounts and are deemed to be two distinctly separate website's.

Configuring Google Analytics for source domain (123.com)

The first thing you will need to do is create a copy of your main Google Analytics view of 123.com, you can do this by clicking on Admin > View > View Settings > Copy View as you can see below:



Once you have copied the view you will need to rename it. Make sure you use a logical name for the view such as '123.com Cross Domain Tracking View', after renaming your view you will need to add some custom advanced filters to the newly renamed view.

Apply the following filter to your new view, it will add the host name (domain name) to the request URI.



We now need to create a referral exclusion, this can easily be done by going to Admin > Property > Tracking Info > Referral Exclusion List, remember this is still in the property for 123.com. Add your 123.com domain to the list.

Configuring Google Tag Manager for the source domain (123.com)

Now we need to move over to Google Tag Manager to do some configuration for the cross domain tracking. Let's start by logging into Tag Manager, make sure this is the account of 123.com and edit the tag you used to deploy Universal Analytics.



The next step is to locate the 'more settings' section of the tag, then find the 'fields to set' section and set the first field to allowLinker with the value of true and the second field to cookieDomain and the value to auto as shown in the image below:



Now continue to scroll down the page and find the section labeled Cross Domain Tracking, in this section locate the auto link domains (it is under the more settings drop down) and enter the domain for 456.com.

It is also possible to implement the cross domain tracking across multiple domains, just make sure each domain is separated by a comma.

If your domain link is to a destination that is a form you might well want to share the cookie information on the form submission. To do this you will need to set 'Decorate Forms' setting to True as shown below:



Your Universal Analytics tag should now be set up, remember create a new version of the container, test it and publish it.

Configuring Google Analytics for 465.com

Essentially you are replicating what you did in the first part of this resource, so we have just listed the steps in bullet points below:

  1. Create a copy of the main Google Analytics view for 465.com.
  2. Name the new view to 456.com Cross Domain Tracking View.
  3. Apply the custom advanced filter to the new view (append domain name to request URI).
  4. Add 456.com in the referral exclusion list.

Configuring Google Tag Manager for 456.com

The Google Tag Manager configuration for 456.com are again very similar to those described in the first part of this resource document. The steps you need to take are listed below:

  1. Login to Google Tag Manager for 456.com.
  2. Edit tag for Universal Analytics using:
    • allowLinker = true
    • cookieDomain = auto
  3. Set cross domain tracking to 123.com.
  4. Decorate form = True

Configuring tracking across primary domain and its sub domains

Universal Analytics by default can track visitor data across all sub domains of your website. You will need to configure your Google Analytics and Google Tag Manager platforms so that you can determine the data from different domains within your reports.

The following steps will allow you to track across primary domain (say 123.com) and its sub domain say blog.123.com.

  1. Use the Tag Manager Container for 123.com and place it on every one of the pages in blog.123.com.
  2. Edit the tag you used to deploy Universal Analytics on 123.com and blog.123.com.
  3. Find the field More Settings > Fields To Set and then set 'cookieDomain' to auto.

Configuration of Google Analytics for 123.com

  1. Create a copy of the main Google Analytics view of 123.com.
  2. Rename the new view to 123.com Cross Domain Tracking View.
  3. Apply the custom advanced filter to the new view.
  4. Add www.123.com in the referral exclusion list.

Configuring Google Analytics for blog.123.com

  1. Create a copy of the main Google Analytics view of blog.123.com.
  2. Rename the new view 123.com Blog Cross Domain Tracking View.
  3. Apply the custom advanced filter to the new view.
  4. Add blog.123.com in the referral exclusion list.