Mobile app version of vmapp.org
Login or Join
Deb1703797

: Two properties for same website with Universal Analytics I need to track a website with Universal Analytics in two different properties of the same account. Following a guide here http://www.tjkelly.com/blog/google-analytics-tw

@Deb1703797

Posted in: #Analytics #UniversalAnalytics

I need to track a website with Universal Analytics in two different properties of the same account.

Following a guide here www.tjkelly.com/blog/google-analytics-two-tracking-codes-on-same-page-2014/ I put this as last solution:

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create','UA-xxxxxxx-1','domain.co');
ga('create','UA-yyyyyyyy-2',{'name':'b'});
ga('send','pageview');
ga('b.send','pageview');


Is this correct? It seems to work but it's pretty different from the guidelines developers.google.com/analytics/devguides/collection/analyticsjs/advanced#multipletrackers and

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Deb1703797

1 Comments

Sorted by latest first Latest Oldest Best

 

@Welton855

The 'auto' setting just says to set the cookie at the highest available domain possible, which in this case is domain.com. Leaving the cookie domain blank does the same thing and GA will again set the cookie to the highest domain available. Defining the cookie domain sets the cookie domain to exactly that.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme