AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
2.5K members online now
2.5K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Google Analytics tracking script settings when using siteSpeedSampleRate

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hello,

looking at the documentation it is not clear what to do/what happens w.r.t. cookieDomain field, when you set siteSpeedSampleRate param.

 

Here it's suggested to use:

 

ga('create', 'UA-XXXXX-Y', 'auto');

Specifying 'auto' as the cookieDomain enables automatic cookie domain configuration, which tells analytics.js to automatically determine the best cookie domain to use.

 

 

However, if someones needs to set a custom siteSpeedSampleRate (most probably because you want to get a higher sampling of pages w.r.t. loading time), here it's suggested to use

ga('create', 'UA-XXXX-Y', {'siteSpeedSampleRate': 10});

 

What happens to the 'auto' param used for the cookieDomain then?

Looking at the documentation here, it seems that by default cookieDomain value it's set to 

document.location.hostname (normalized)

but then it's not clear it that's the same than setting to 'auto'.

 

Any help on this?

Thanks!

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Michele D
November 2016

Re: Google Analytics tracking script settings when using siteSpeedSampleRate

Top Contributor
# 2
Top Contributor

Hi,

 

The code should look like this:

 

ga('create', 'UA-XXXX-Y', 'auto', {'siteSpeedSampleRate': 10});

 

"The recommended JavaScript tracking snippet sets the string 'auto' for the cookieDomain field"

 

"Specifying 'auto' as the cookieDomain enables automatic cookie domain configuration, which tells analytics.js to automatically determine the best cookie domain to use."

 

https://developers.google.com/analytics/devguides/collection/analyticsjs/cookies-user-id#automatic_c...

 

Hope this helps.


Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital

View solution in original post

Marked as Best Answer.
Solution
Accepted by topic author Michele D
November 2016

Re: Google Analytics tracking script settings when using siteSpeedSampleRate

Top Contributor
# 2
Top Contributor

Hi,

 

The code should look like this:

 

ga('create', 'UA-XXXX-Y', 'auto', {'siteSpeedSampleRate': 10});

 

"The recommended JavaScript tracking snippet sets the string 'auto' for the cookieDomain field"

 

"Specifying 'auto' as the cookieDomain enables automatic cookie domain configuration, which tells analytics.js to automatically determine the best cookie domain to use."

 

https://developers.google.com/analytics/devguides/collection/analyticsjs/cookies-user-id#automatic_c...

 

Hope this helps.


Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital

Google Analytics tracking script settings when using siteSpeedSampleRate

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Thanks for the quick reply.

Are you sure the syntax you propose follows the create syntax (cfr. https://developers.google.com/analytics/devguides/collection/analyticsjs/command-queue-reference#cre...)?

 

Thanks a lot.

Google Analytics tracking script settings when using siteSpeedSampleRate

Top Contributor
# 4
Top Contributor

Hi,

 

Yes, here is an example from the docs:

 

ga('create', 'UA-XXXX-Y', 'auto', {'legacyHistoryImport': false});

 

https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#legacyHisto...

 

Let me know if you have more questions.


Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital