Graeme Benge

Cross Domain Tracking For Multiple ccTLDs In Google Analytics

20th Dec 2013 Analytics 4 minutes to read

bigstock-Internet-Web-Site-Search-Colla-9198098One of the most useful benefits of Google Analytics is the ability to track a user’s sessions across multiple domains by implementing the Cross Domain Tracking snippet customisation provided by GA.

This customisation passes your user’s cookie from site to site allowing you to ignore self-referrers i.e. having a paid search user from Site A being classed as a referrer on Site B. Instead one user session will be tracked across the two sites as a user that came via paid search.

When Would I Use Cross Domain Tracking To Track Sock Buyers?

Breaking that down to its component parts, my fictitious blog may find itself a new visitor from an organic searcher clicking on a post that has ranked well (hooray). Now I may have a limited edition run of highly desirable socks (Shh it could happen). Because I don’t want to spend the time and money on developing eCommerce functionality within my site, I opt to use a third party payment platform such as SagePay, FoxyCart or Shopify. (Fresh Egg produced a useful guide to shopping cart solutions back in May this year.)

Cross Domain Tracking now allows you to join those sessions together as one giving you the ability to understand from start to finish the user behaviour that lead to that conversion.

Our own Gemma put together a video that looked at How To Track Multiple Websites With Google Analytics which you can see below:

This post focuses on another scenario becoming more common that sees companies using multiple country code specific Top Level Domains (ccTLDs). For instance, following the world realising that Led Zeppelin socks are THE thing to own, I might decide to market online internationally with country specific domains and GA codes such as:

  • – UA-12345678-2
  • – UA-12345678-3
  • – UA-12345678-4
  • In addition to my original domain – UA-12345678-1

Tracking International Sock Buying Behaviour

Having found my purpose in life, worldwide domination, one sock at a time seems the next logical step.

Conceivably, a determined sock connoisseur may have stumbled upon one of my sites and found that there is a language variant more suited to their sock chasing needs. Clicking from one ccTLD to another without Cross Domain Tracking would see two user sessions recorded as a new cookie is used for the arrival to the second site.

  • Cookie one would pass Google Analytics the original traffic source of the user
  • Cookie two would pass Google analytics Referral as the traffic source of a new user despite us knowing that it isn’t the case

So a typical scenario may be:

French speaking sock hoarder, big fan of Jimmy Page, lands on and then navigates to as the content is presumed to be more meaningful in their native language. 

The Code

The code modifications to achieve cross domain tracking are relatively straight forward.  We need to add two lines to set the domain name and to activate the ‘AllowLinker’ command. These are the lines to use

  • ._setDomainName’, ‘]);
  • ._setAllowLinker’, true

I’ve used a naming convention of ‘Global’ for my – UA-12345678-1 View that is collecting everything. For the international domains I’ve specified ‘Local’ as well as the relevant Google Analytics UA code so that we can ensure that data is passed to the right View.

Adding the ._setDomainName and ._set AllowLinker needs to be done for both Global and Local accounts. Take care to ensure you’ve added the dots highlighted in the image below:

XDT Code

We also need to add an event to the link the users clicks to move from one domain to the other. Typical solutions that solve this for the user tend to involve selecting a country flag or a country name from a drop down menu.

The event would look similar to this:

<a href=” ‘'”   onclick=”_gaq.push([‘Global._link’,’]); return false;”>Francais</a>

Google Analytics Refinements

It’s all well and good having customised the code and implemented it on my portfolio of high quality classic rock socks. I need to be able to make sense of the data.

In Google Analytics, Views and filters are a powerful way of enhancing your measurement. Best practice here dictates that within your GA account a raw unfiltered and untouched View is a must in case of any data loss on filtered Views.

Another View worth its weight in pixels is one that enhances your content report, taking the URI and appending the Domain to the URI. This way you can compare within the same report how your Home pages or other key landing pages perform across your domains.

To do this, follow the below steps to set up a View with a filter that pulls in the domain as well the URI :

Other Filter

Then the obvious step is to set up a View for the audience targets for each domain. I’m using different domains to target different locations so I only want to pull in data from those locations.

•    (UA-12345678-2) for the UK

•    (UA-12345678-3) for France

•    (UA-12345678-4) for Germany

To isolate traffic from IP addresses in these locations, within their own Views, I’ve applied an ‘Include’ filter as shown below:

Filter Information

Implementing Cross Domain Tracking with Google Analytics will give site owners optimising in multiple locations a massive leg up in useful data.

Here are some really useful articles worth referring to when carrying out the implementation.

 Image Credit

Internet Web Site Search Collage via Bigstock

Share this post


What do you think?

Kelly-Anne Crean

SEO and Internal Links: Common Mistakes to Avoid

Kelly-Anne Crean
1st Jun 2023
SEO Blog
Stacey Cavagnetto

How to Do PR for Small Businesses

Stacey Cavagnetto
25th May 2023
Digital PR Blog

Digital Ideas Monthly

Sign up now and get our free monthly email. It’s filled with our favourite pieces of the news from the industry, SEO, PPC, Social Media and more. And, don’t forget - it’s free, so why haven’t you signed up already?

Free Digital Marketing Audit

Are you a UK business that needs some expert help to uncover what’s holding your digital marketing back? Let us show you for free!


Call us on 0330 353 0300, email or fill out our Contact Form.

Map of Hampshire Digital Marketing Agency
Hampshire Digital Marketing Agency
Merlin House 4 Meteor Way Lee-on-the-Solent, PO13 9FU, UK
Map of Lancashire Digital Marketing Agency
Lancashire Digital Marketing Agency
Cotton Court Business Centre Church Street, Preston Lancashire, PR1 3BY, UK
Map of London Digital Marketing Agency
London Digital Marketing Agency
Albert House 256 - 260 Old Street London, EC1V 9DD, UK

Unlike 08 numbers, 03 numbers cost the same to call as geographic landline numbers (starting 01 and 02), even from a mobile phone. They are also normally included in your inclusive call minutes. Please note we may record some calls.

Circle Cross