Reputation: 2558
As per the doc , 'auto
' in ga('create' 'ua-' 'auto')
is described as below.
opt_configObject – An optional object containing configuration field/value pairs.
But, I am not sure, I completely get this.
What is the difference between ga('create' 'ua-' 'auto')
and say I give ga('create' 'ua-' 'mysite.com')
?
Upvotes: 6
Views: 8260
Reputation: 11
I had a similar issue awhile back where a client had all of his domains say: ga('create' 'ua-' 'mysite.com') That's basically an old method of specifying the cookie to a domain. Might as well change when google changes correct? I changed them to 'auto' because it simplifies subdomain tracking. See the official youtube video. Google YouTube Video
Upvotes: 1
Reputation: 30441
I agree the method signature and the myriad of valid combination can make it confusing.
ga('create', 'UA-XXXXX-Y', 'auto');
is the same as
ga('create', 'UA-XXXXX-Y', {
cookieDomain: 'auto'
});
More info on using 'auto' for cookieDomain can be found here: https://developers.google.com/analytics/devguides/collection/analyticsjs/domains#auto
To answer your questions, there's no difference between specifying 'auto'
and 'mysite.com'
if your site's domain name is 'mysite.com', but there would be a difference if your site were hosted at 'subdomain.mysite.com'.
Upvotes: 8