One 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 www.ledzepsocks.com 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:
- www.ledzepsocks.co.uk – UA-12345678-2
- www.ledzepsocks.fr – UA-12345678-3
- www.ledzepsocks.de – UA-12345678-4
- In addition to my original domain www.ledzepsocks.com – 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 www.ledzepsocks.co.uk and then navigates to www.ledzepsocks.fr 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’, ‘.ledzepsocks.com]);
- ._setAllowLinker’, true
I’ve used a naming convention of ‘Global’ for my www.ledzepsocks.com – 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:
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=” ‘https://www.ledzepsocks.fr’” onclick=”_gaq.push([‘Global._link’, https://www.ledzepsocks.fr’]); 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 :
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.
• www.ledzepsocks.co.uk (UA-12345678-2) for the UK
• www.ledzepsocks.fr (UA-12345678-3) for France
• www.ledzepsocks.de (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:
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.
- Cross Domain Tracking developers guide – Google
- Himanshu’s SEOTakeaways Google Analytics Cross Domain Tracking – Complete Guide
Image Credit
Internet Web Site Search Collage via Bigstock
Leave a Reply