Question

I have 3 domains pointing to the same website, with no redirects, so domain1.com, domain2.com and domain3.com show the same content and do not redirect between each other.

If I want to track all domains, do I have to check Multiple top-level domains in the "What you are tracking" section and add this the following for each domain

_gaq.push(['_setDomainName', 'domain1.com']);
_gaq.push(['_setDomainName', 'domain2.com']);
_gaq.push(['_setDomainName', 'domain3.com']);

Or is it enough to just set it for domain1.com? Or maybe the regular tracking code under "A single domain" will do?

Thank you.

Was it helpful?

Solution

Don't use multiple _setDomainName in a tracking code, only the last will be used.

_setDomainName "attribute" the cookies to a domain. If you use _gaq.push(['_setDomainName', 'domain1.com']); only domain1.com can use the cookie.

So you need to use :

  • _gaq.push(['_setDomainName', 'domain1.com']); alone on domain1.com
  • _gaq.push(['_setDomainName', 'domain2.com']); alone on domain2.com
  • _gaq.push(['_setDomainName', 'domain3.com']); alone on domain".com
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top