Ever come across an issue and spend an enormous amount of time looking for the solution? It usually happens when I need to get a project up and running with a hard deadline that is ticking away. Hopefully this article will help others with the issue that I recently tacked.
Third party shopping carts
Third party shopping carts hosted on a different server than the one your website is hosted on can cause some issues with tracking results within Google Analytics. Without cross domain tracking setup, Google Analytics will track all of the source traffic as a referral from your website. Not very useful when you are trying to track different advertising channels and their results.
Google Developer Knowledge Base
You can try reading this article from Google. Kinda useful but not really thorough. Where do I add the code? To the main website? The shopping cart?
I love when people make YouTube videos that solve issues. Thank you! Than you!
Here’s a youtube video that also talks about the issue. It is definitely more descriptive.
Great, here’s the code that I need to add:
_gaq.push(['_setDomainName', 'none']); _gaq.push(['_setAllowLinker, true]);
Here’s the answer that I needed to get the cross domain tracking for Google Analytics setup correctly.
1. Where do you put the code? On the main website google analytics code or the shopping cart?
The answer is both.
Adding the code to the main site will track the traffic entering the main website and share that with the analytics data on the shopping cart.
If you have links pointing from the shopping cart back to the main site, you will also need to add the code to the shopping cart Google analytics to track the traffic entering the main website from the shopping cart.
The rest is pretty simple. Add this code:
<a href="https://www.my-example-blogsite.com/intro.html" onclick="pageTracker._link('https://www.my-example-blogsite.com/intro.html'); return false;"> See my blog</a>
to any link that it pointing to either website (make sure to change the website urls).
Hope this helps someone else!