Cross Domain Tracking with Universal Analytics.js – Google Analytics.

November 14th, 2014 admin Location: Raleigh, NC, Topic: Web Design | Digital Media

So I know that you could go to the Google Analytics blog and simply try to understand all the information that they have to offer about how to track several domains with the same Google Analytics Profile. However, I wanted to post a simpler way to get going fast and easy with the cross domain tracking without having to spend 3 hours. Before we begin, let’s say why this is important. Let’s say that you have an e-commerce cart, and let’s say that that e-commerce cart is located in an external domain. If you implement Google analytics the normal way you’re going to end up increasing unnecessarily the referral count. More importantly those referrals are going to show as if they are coming from your own website.

So, without further adieu, let me share with you the secrets of implementing cross domain tracking in Google Analytics, specifically with the universal tracking code.

1. I am going to be assuming that you are using Universal Analytics and not ga.js. The easy way to know is to search your page’s code and see if you find analytics.js or ga.js. If you have analytics.js you are using Universal Analytics.

2. Once you are in the new code, in order to group several domains into the same tracking (for example for an external shopping cart) then all you need to do is let Google Analytics know that those two domains are expected to have the same tracking code – or be LINKED.

3. The way to do this is as follows:

3.1. Go to your admin section in Google Analytics:


3.2. Go to property and then “Referral Exclusion List” – there make sure to add each domain that you want to track. NOTE: Please add each domain, not subdomains. If you want to track subdomains specifically, then you may need to read the implementation of the code with Regular Expressions instead of the one given here.

3.3. In the code, for your main property – let’s call it – you must update your tracking info to be like this:

/*Comment of Code*/
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

  ga('create', 'UA-xxxxxxxx-x', 'auto', {'allowLinker': true});
  ga('require', 'linker');
  ga('linker:autoLink', ['', '', ''] );
  ga('send', 'pageview');
/*End of Code*/

This is the regular code used for Universal analytics, except with a couple of additions: 1. The require, linker one. This one is needed to activate the autolinker feature. 2. The next line lists all the domains that you want to link together (again domains – not subdomains). Everything else you can keep the same as you have it.

That’s it – now to test it if it is working, all you have to do is go to your RealTime analytics dashboard and in another browser visit your site. While you click to go to sites: x, y and z – you shouldn’t see appear as a referral source at all. If it doesn’t you are golden! You have done it!

Hope this is helpful friends.

Until next time.


About the Author

Alex Centeno MBA., is an international creative director and digital media strategist. Currently residing minutes away from the Research Triangle Park (RTP) - North Carolina, and with over 10 years of interactive marketing training and experience, Alex leads Merkados' international clients to maximizing their online business strategies. One of Alex's biggest strengths is his world-class capacity to effectively combine interactive marketing, digital media design and web development.

You may find further information about Alex Centeno MBA. at: and Twitter.

Sobre el Autor

Alex Centeno MBA., Es un director creativo y estratega de medios digitales reconocido internacionalmente. En la actualidad reside a tan solo minutos del Research Triangle Park (RTP) - Carolina del Norte, y con más de 10 años de entrenamiento y experiencia en marketing interactivo, Alex lidera a los clientes internacionales de Merkados™ para maximizar sus estrategias de negocios en línea. Una de las mayores fortalezas de Alex es su capacidad global de combinar de manera efectiva, mercadeo interactivo, diseño de medios digitales y desarrollo web.

Para más información sobre Alex Centeno MBA. puede visitar: y Twitter.