Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In ga('create' 'ua-' 'auto'), what does 'auto' stand for?

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') ?

like image 957
hop Avatar asked Apr 29 '15 19:04

hop


Video Answer


2 Answers

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'.

like image 165
Philip Walton Avatar answered Sep 28 '22 08:09

Philip Walton


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

like image 28
Ravey Avatar answered Sep 28 '22 08:09

Ravey