Two separate sites, one ecommerce site Google Analytics question
We have two separate families of sites (example.com and offspring [example.co.uk etc.] and different.com and offspring). example.com sites and different.com sites are tracked separately using Google Analytics.
example.com sites uses ourstore.com for ecommerce, with GA code for example.com being on ourstore.com. If 开发者_开发百科we also want to use different.com site with ourstore.com is this possible: i.e. can we have two different GA codes on the one ecommerce site?
Yes, you can have track data into multiple GA profiles - you just need to make sure that you use a different call to getTracker for each GA profile.
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src=’" + gaJsHost + "google-analytics.com/ga.js’ type=’text/javascript’%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var firstTracker = _gat._getTracker("UA-XXXXXXX");
firstTracker._initData();
firstTracker._trackPageview();
var secondTracker = _gat._getTracker("UA-XXXXXXX");
secondTracker._setDomainName("example.com");
secondTracker._setAllowLinker(true);
secondTracker._initData();
secondTracker._trackPageview();
</script>
精彩评论