get a personalised recommendation in minutes with our solutions advisor

Tracking Cross Domains in GA and ‘Onclick’ Tracking.

When I started working in Google Analytics religiously – it’s brilliant, I love it as much as Excel. Geek alert I know – I had to get my head around cross domain tracking. This is when your traffic isn’t contained in just one website. Maybe you have a subdomain, a payment gateway which directs people…

When I started working in Google Analytics religiously – it’s brilliant, I love it as much as Excel. Geek alert I know – I had to get my head around cross domain tracking.

This is when your traffic isn’t contained in just one website. Maybe you have a subdomain, a payment gateway which directs people off site and then back on. Maybe you have forms which open in an iframe or a blog hosted by someone else.

You can still track this in Analytics. Never fear!

What you need to do though is set up cross domain tracking. This will mean you add GA codes to the pages of site one and the same code to the pages of the second site, or third.

It’s best to use async codings as it’s the most up to date. To pull the code, head into your GA account and to the code area, just select cross domain and enter the urls of the domains. Sorted. You must take out any previous GA coding on the site when you update it with this one.

You must also tag the buttons to carry the cookie across. So for example if the second site is a payment gateway, you need to tag the ‘Checkout’ or equivalent button to ensure it pushes the cookie through. Otherwise the second site will record the hit as ‘direct’ as it doesn’t know where the user originally came from. If for example, the original vist was from PPC, this will push the AdWords cookie through with the click allowing the payment site to identify the traffic as paid.

This is really important and you need to identify every button on site which pushes users to the second site.

If you don’t do this, every visit on the second site will be ‘direct’ and you won’t be able to optimise effectively.

The push code (onclick event) should look something like the below. You need to update the ‘link’ aspect to read the site domain of the site you are sending users to.

<a href=”http://example.com/test.html” onlcick=”_gag_push ([‘_link’, ‘http://example.com/test.html‘]); return false;”>click me </a?

You need to update the ‘link’ aspect – in bold. The first link shown needs to be the url of the 1st website they would have hit. The second link needs to be the redirect. The ‘Click Me’ aspect is whatever is written on the button you want users to click, so in this case that may be ‘Checkout’. Only add this code on the pages where a button is that directs to the next website in the customer journey.

You’re welcome.

About the author

Yell Business Avatar

Give us a call to see how we can help with your business