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')
?
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'.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With