You are on page 1of 14

Setting up cross-domain tracking

using Google Tag Manager


Last Updated / Reviewed: April 1st, 2020
Execution Time: 15-30 minutes

Goal: To correctly implement and test cross-domain tracking in Google Analytics.

Ideal Outcome: You will be able to correctly collect all the traffic data that comes to the
domains that are under your control and analyze how users interact across them.

Pre-requisites or requirements:
● To follow this SOP you will need to have installed Google Tag Manager on all
your domains. If you haven’t done so already and you are using WordPress you
can follow SOP 004.
● You will also need to have Google Analytics running on all your domains. if you
don’t have it yet, you can follow the steps described in SOP 009.

Why this is important: Cross domain tracking makes it possible to unify what would
otherwise be considered as two (or more) separate sessions that occur under two (or
more) of your domains.

Where this is done: In Google Tag Manager and Google Analytics.

When this is done: When you add a new domain to your business that you want to
track under the same Google Analytics property.

Who does this: The person responsible for website management or analytics.

Click here to get the most up-to-date version of this SOP


� Setting up Cross-domain tracking

Important:
1. Some specific cases are outside of the scope of this SOP. If you’re using
redirects between your domains, if your code is removing parameters from the
URLs, or if you are using iframes this might not work for you.
2. This SOP assumes you already have the same Google Analytics property set up
in both domains.

Important #2: If you don’t have Google Tag Manager set up on your website, you will
want to follow the procedure covered in SOP 004 - Add Google Tag Manager to a
Wordpress Site

1. Go to http://tagmanager.google.com and sign in with your account details.


2. Select the container that is set up on your website.
a. Note: This SOP assumes you’re using the same container in both
domains. If that is not the case you will need to perform these steps twice,
one time for each of the containers.

3. Click “Variables” → “New”

4. Rename the variable

Click here to get the most up-to-date version of this SOP


5. Click “Choose a variable type to begin set-up…” → “Constant”

6. Type the domains you will want to link, separated by commas.


a. Note: If you want to setup cross-domain tracking for all the domains and
subdomains you only need to input your main domain. If you only want to
implement cross-domain tracking between a few subdomains you should
enter your subdomains instead.
Example:
i. [asiteaboutemojis.com, anothersiteaboutemojis.com] will work for
all these cases:
a. User arrives at asiteaboutemojis.com and clicks a link to
anothersiteaboutemojis.com;
b. User arrives at shop.asiteaboutemojis.com and clicks a link
to tools.anothersiteaboutemojis.com;
ii. [shop.asiteaboutemojis.com, course.anothersiteaboutemojis.com]
will implement cross-domain tracking for this case:
a. User arrives at shop.asiteaboutemojis.com and clicks a link
to course.anothersiteaboutemojis.com;
But will not work for:
b. User arrives at asiteaboutemojis.com and clicks a link to
anothersiteaboutemojis.com;

Click here to get the most up-to-date version of this SOP


7. Click “Save”:

8. Locate your Google Analytics settings variable, in your list of variables. It should
have its type set to “Google Analytics settings”. Click that variable.
a. Note: If you can’t find this variable your setup might not be using it. If that
is the case it is recommended that you start using it. You can refer back to
SOP 009 to understand how you can configure your variable.

Click here to get the most up-to-date version of this SOP


9. Click “More Settings” → “Cross Domain Tracking”:

10. In the field “Auto Link Domains” click the “+” icon and select the variable you’ve
just created. In Step 4 of this SOP.

11. Set the field “Decorate Forms” to “True”.


12. Still under “More Settings” → click “Fields to Set” → “+ Add Field”:

Click here to get the most up-to-date version of this SOP


13. Add these settings:
a. Field Name: allowLinker
b. Value: true
14. Click “Save” on the top right corner:

Click here to get the most up-to-date version of this SOP


14. If you now click on “Overview” on the sidebar, this is how your Google Tag
Manager overview dashboard should look like:

15. If everything looks ok, you are now ready to hit “Submit”

16. In the “Submission Configuration” panel you will be given the chance to add a
name and description to this version. After you have done so, hit “Publish”.
a. Note: Adding a name and description is optional but recommended. You
should enter information here that will make it easy to know what changes
are being made.

Click here to get the most up-to-date version of this SOP


17. That’s it! You will now be taken to see the summary of the changes you’ve just
made:

� Adding your new domain to the referral exclusion


list:

1. Open your Google Analytics account settings by clicking here or clicking “Admin”
in the sidebar.
2. Select the correct Google Analytics Account and Property

Click here to get the most up-to-date version of this SOP


3. Click “Tracking Info” → “Referral Exclusion List”

4. You should see your root domain on the list:

5. Click “+Add Referral Exclusion”


6. Type your new domain:

Click here to get the most up-to-date version of this SOP


7. Click “Create”, and that’s it! You should now see your other domain in the
Referral Exclusion List:

� Checking if cross-domain tracking is working as


intended

1. Open your website using Chrome and navigate to one of the pages in your first
domain where you have a link pointing to your second domain.

Click here to get the most up-to-date version of this SOP


2. Click on the Google Tag Assistant Chrome extension and click “Record”:

3. Refresh your page.


4. Click any link pointing to your second domain.
a. Note: Make sure the link you are clicking on opens in the same tab and
not a new one, otherwise the Google Tag Assistant recording might not
record you whole session.
b. Note 2: You should see a “_ga” parameter being added to the URL.

5. Once the page loads click again on the Google Tag Assistant Chrome extension
and click “Stop Recording” and then click “Show Full Report”:


Click here to get the most up-to-date version of this SOP
6. Select “Google Analytics Report”:

7. Select the view that you want to test and click “Ok”:

8. Check the “Alerts” section and make sure you’re not seeing an alert regarding
the Cross Domain implementation.
a. Note: This is how an alert would look like If you had one:

9. Scroll down in the report until you find the “Flow” section. You should see at least
2 Page loads there:
a. Click “Page load 1” → The “URL” field should be an URL belonging to your
first domain.
b. Click “Page load 2” → The “URL” field should be an URL belonging to your
second domain.

Click here to get the most up-to-date version of this SOP


10. That’s it, if everything looks good your property will start collecting data correctly
from both domains.

� Adding a Hostname filter to include your subdomain


data

Note: This is an optional step and depending on your current Google Analytics setup it
might impact other configurations such as custom reports and goals.

1. Log In to your Google Analytics account.


2. Check If you already have a filter implemented, you can do so under filters, or by
heading over to Behaviour → Site Content → All pages.
3. If you have the standard set up you will see the page path in the reports:
a. Note: By default Google Analytics will aggregate data from all the
domains and subdomains, so you should bear in mind that in fact the

Click here to get the most up-to-date version of this SOP


page “/” is not only your main domain’s homepage but also the homepage
of all your domains and subdomains being tracked by the same property if
their homepages are also in the root of the subdomain.

4. If you want to display the domain and subdomain information on your reports
straight away, you can follow SOP 035 - Displaying subdomains in your Google
Analytics Reports.
5. That’s it. By the end of the SOP you will be seeing the domain and subdomain
information straight on your reports:

Click here to get the most up-to-date version of this SOP

You might also like