Mobile app version of vmapp.org
Login or Join
Kimberly868

: Do I need to pass my website URL in Google Analytics? I have just noticed that google analytic is providing analytic code with following parameter : ga('create', 'UA-XXXXXXXX-X', 'auto'); But

@Kimberly868

Posted in: #GoogleAnalytics

I have just noticed that google analytic is providing analytic code with following parameter :

ga('create', 'UA-XXXXXXXX-X', 'auto');

But in some sites I have noticed like :

ga('create', 'UA-XXXXXXXX-X', 'www.example.com');

So is there any different effect between "auto" and "actual web URL" ?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Kimberly868

1 Comments

Sorted by latest first Latest Oldest Best

 

@Odierno851

The third parameter in the create method sets the domain to which the GA cookie will be applied. If it is set to auto, then the cookie will be set at the highest domain name possible. Alternatively, you can set it explicitly by providing the domain name yourself.

In your example with "www.example.com", if you set the cookie parameter to auto (which just evaluates to window.location.hostname), then GA will set the cookie domain to "example.com". But if you explicitly set it to "www.example.com", then GA will set the cookie domain to "www.example.com".

You can read more about this here: developers.google.com/analytics/devguides/collection/analyticsjs/domains?hl=en#auto

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme