1

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.

Francisc
  • 77,430
  • 63
  • 180
  • 276

1 Answers1

2

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
greg
  • 2,339
  • 1
  • 18
  • 23
  • I don't understand something - how will google know that domain2.com belongs to me? when I open google analytics account, I will define my site to be domain1.com, and then I will put the same google ID accross all the 3 mentioned domains. There is no place where the other 2 domains are registered. For example, what stops me from putting to my domain1.com the Analytics ID of stackoverflow.com? – Andy Oct 08 '12 at 12:49
  • Nothing stops you to do that. But : 1) stackoverflow can easily filter there stats to only include there domain, 2) Analytics team can ban your domain from the system. – greg Oct 10 '12 at 10:03