Blast Analytics and Marketing

Analytics Blog

Supporting Leaders to EVOLVE

2 Simple Steps to Cross Domain Tracking in Universal Analytics

November 24, 2014

Cross domain tracking has been one of those thorns in Google Analytics implementations. Although, it isn’t technically that complicated, there are many things that can (and usually do) go wrong.

For most implementations, it isn’t much of a problem once the initial implementation is figured out. However, for the larger enterprise level companies with an expanding number of websites, it can get to be one of those persistent thorns you have to keep an eye out for.

Fortunately, Google’s Universal Analytics simplifies the setup process, and we’ve provided some valuable tips in this article that will help you solve common needs and avoid typical issues.

Why is Cross Domain Tracking Important?

In case you aren’t familiar with cross domain tracking, it’s mainly used when you have scenarios where people are moving between domains, and it’s important for the session (and visitor identification) to be retained. This is especially true when you have a website with a checkout process hosted on a separate or secured domain.

If your Goals or Conversions take place on the separate domain, you will lose traffic attribution data unless your implementation is configured properly for cross-domain tracking. The adverse impact on your reports is that they will show most all conversions tied to either direct traffic or the domain itself (which is considered a self-referral).

I’m pretty sure tracking the source of your conversions is vital, so you can evaluate the effectiveness of your marketing campaigns. So let’s talk about how to fix this.

Two Step Process for Cross Domain Tracking in UA

Universal Analytics, along with all the wonderful new features has truly simplified this process. It’s down to a simple 2 step process:

STEP #1: Exclude Self Referrals

You need to configure your Google Analytics property to ignore the domains you are looking to track across within the admin section of the Google Analytics web interface under “Tracking Info > Referral Exclusion List”.

On the Referral Exclusion List page, click the ‘+ Add Referral Exclusion’ button and add your origination domain (e.g. and target domain (e.g. to the list (as shown below).


STEP #2: Modify Tracking Code

Make the following changes to your Google Universal Analytics Tracking Code:

  • Set “allowLinker” to true on the domains involved (shown in line 6 of sample code below)
  • Add a line of code to include a “linker” plugin (shown in line 8 of sample code below)
  • Set the “linker” to “autoLink” and provide an array with all of the domain names to cross domain to (shown in line 9 of sample code below)

Sample Code

To help you further, here’s some sample Google Universal Analytics code to serve as a reference for our provided cross domain tracking changes. Feel free to grab and use as you desire:

Code Option 1: Hash/Anchor

As an option, if you want to have the autolinker use a hash/anchor (#) instead of passing the cookie info as a query, modify the linker:autolink line of code by adding a “true” at the end like this (Note: In this configuration, you don’t have to set allowAnchor for cross-domain to get this working):

ga(‘linker:autoLink’, [‘’,’’], true);

Code Option 2: Add Form Support

If you want your forms to handle cross domain linking, modify the linker:autolink line of code (which is line 8 in the Sample Code above) by adding another “true” parameter as shown below:

ga(‘linker:autoLink’, [‘’,’’], true, true);

Caveat Emptor

Last thing, a bit of a warning. This may not work on pages with particular methods of linking. More specifically, it would not work if:

  • your site has JavaScript within the href of the link to load the link, instead of a clean URL (example below)<a id=”ApplyButton” class=”apply top” href=”javascript:doSomething();”>apply</a>
  • you have an element with an “onclick” attribute, the URL specified in the onclick (example below)<a id=”ApplyButton” class=”apply top” href=”#” onclick=”doSomething()”>apply</a>

In either situation, the doSomething() function will probably have a return false or preventDefault() to keep the anchor from working normally. The function will do something and then redirect the page to the desired URL. You’ll need to modify your doSomething() function to use a decorated URL. See the “Decorate Utility Method” on the Google Developers pages.

Finally, you’ll want to be aware of the following:

  • If you are migrating from Classic Google Analytics to Universal, don’t be alarmed when you don’t see those __utm* parameters after the cross domain jump. Google has simplified this so that you’ll now see a single querystring parameter named ‘_ga’.
  • By using the linker param via autoLink or the other methods that Google provides, you’ll solve another issue that is created when a user shares the link with the cross-domain parameter with a friend. The friend can show up as the same user as the original user which causes interesting issues in data quality. Google fixes this by placing a hashed timestamp in the _ga parameter that expires after 2 minutes.

Now sit back and reminisce with a smile about the times when you had to worry about creating a JavaScript or jQuery script to capture anchor links leading to the domains and how there was always that one link or two that would fail to work. Cheers to all of those Google Analytics Implementation specialists who share the pain of the old way of doing things and are jumping for joy at the beauty of the new method. Thanks Google!

If you have questions or comments, we encourage you to post below. If you’d like even more details on cross domain tracking, the Google Analytics team does a great job in documenting all of the capabilities of Cross Domain Tracking.

  • Yaser Arshad

    great post.. looking forward to more of your posts

  • amme john

    Its really amazing Post. Thanks

  • Miguel Moreink

    Olaf, I’ve been trying to set up cross domain tracking for my website, which uses a booking engine on a different domain.

    It’s all set up via Google Tag Manager, and it seems to be working fine, since I can track the presence of the user on both domains, via my Google Analytics account.

    However, and I check it by following my dummy-visit through GA’s Real-Time, once the user jumps from the first to the second domain, the info on the Source/Medium is lost (eg. from ‘google/organic’ to ‘(direct) / (not-set)’).

    How can I keep all the info intact, cross-domain? Is this a common problem?


    • Jon Ward

      Did you ever figure this out? I’m having the same issue.

  • Victoria Percival

    Thanks Olaf – does the same code need to be added to both the main and target sites? Also, will this code track a form submission (e.g. main site sends user to target site, they then complete a form) – will the main site receive this information?

  • Hi Olaf –

    What’s your take on using separate properties/accounts for each domain of a cross domain project, vs using a shared id across the domains, vs doing both in a rollup?

  • Best way to track the conversion source, want some more post like this. Looking forward to read more.

  • jacksoggetto

    I get to understand that you need to to put the example code in the main website (apyment website where I have the secure tracking). But on the other website (that one that sends the clients to the secure website) what shall I do?
    The main question want to be:
    is te UA-XXXXXXXX-X the same for both websites?

  • romeobagga

    thanks for post, i have successfully done the setup.

    but how i can check the traffic to each domain ? i mean how many visits to a particular domain

  • Utpal

    i have tow template for indexing . i,default and ii,fb

    default is indexing everytime but i want to index fb template when user come from facebook. Have any way for this .

  • Stefania

    Hi, I set up the cross domain but I have a problem, GA doesn’t link the visit on the site1 with the site on the site2. Actually the user arrives to the site1 by facebook ads and makes a lead generation, and then, by a dem, arrives to site2 and makes the conversion.
    I can see the lead generation and the conversion but GA doesn’t link the two sessions so I can’t see the first touch point of the final conversion.
    What could I do? Implementing something ID user track?
    Stefania Vichi

    • Andy Smith

      Our clients browse our website, enquire by a form on, our sales team then handle the query offline and send a booking form link to a different domain to book
      My objective is to track when a booking is made (completed form on, back to the original source | medium on, and extract the booking reference number from the confirmation page on
      Is this possible with cross-domain tracking, or does it fall down due to there being no link between and xyz?

      • @disqus_QN6H6bqsZ4:disqus If the user is not clicking a link or taking an action to directly jump to the other domain (form submission for example), then there’s no way for the 1st party _ga cookie to be passed through to the resulting page. You can though record the _ga cookie value as part of the form submission on and then when you send the email, you append the same _ga value in the querystring so that the user will appear as the same user on that domain. It is important if you want to see the original source that you prevent a new source from overwriting when the user comes back in through

        • Andy Smith

          Thanks Joe.

          If you append the ga cookie to the link in the email is it simply something like

          Also, can you achieve the same by passing it into a data layer on and this then firing back to GA. xyz is a SalesForce Domain and there is quite a complicated logic to build the URL and adding another parameter may cause complications.


Olaf Calderon
About the Author

Olaf is the Director of Implementation at Blast Analytics & Marketing. He and the implementation team, handle configuration, installation and training of analytics tools. He spends the majority of time developing tracking code and He loves the challenges that every project presents and is always finding more efficient ways for our clients to collect, read and analyze their data. His passion is developing tools, processes or methods to make everyone's life easier.

Add Olaf to your circles on Google+ Olaf Calderon has written on the Web Analytics Blog.

Ready To Do More With Your Data?

If you have questions or you’re ready to discuss how Blast can help you EVOLVE your organization, talk to an Analytics Consultant today.

Call 1 (888) 252-7866 or contact us below.