2

I am wondering is Google analytics track all of my properties?

  • https://www.example.com (SSL + www)
  • https://example.com (SSL - www)
  • http://www.example.com (Non-SSL + WWW)
  • http://example.com (Non-SSL - www)

Example of the GA tracking code I am using:

<script type="text/javascript" >
  window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
  ga('create', 'UA-1234567891-0', { 'cookieDomain': 'example.com' } );
  // Plugins
  ga('require', 'linkid', 'linkid.js');ga('require', 'outboundLinkTracker');
  ga('send', 'pageview');
</script>
1

If the same tracking code is embedded on all these URLs - yes. It should set cookies on all subdomains. Regardless if SSL or Non-SSL.

But i would suggest not to use a specific cookie domain if not reeeeally necessary. And it looks like "not necessary" in your case :-)

<script type="text/javascript" >
  window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
  ga('create', 'UA-1234567891-0', 'auto');
  // Plugins
  ga('require', 'linkid', 'linkid.js');ga('require', 'outboundLinkTracker');
  ga('send', 'pageview');
</script>
  • If you don't specify the cookie domain there can be problems when users visit first www.example.com and then example.com. by default Google will use www.example.com as the cookie domain for the first, then those cookies won't be visible to the second. Putting your registered domain name in as the cookie domain is good practice for GA. That way all subdomains (including www) will be able to share users. See developers.google.com/analytics/devguides/collection/… for the documentation about how GA set the domain by default. – Stephen Ostermiller May 8 '18 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.