I'm trying to set up cross domain tracking between two totally different Domains (not sub-domains). Looking through different pages of Google's documentation seem to give me different suggestions for what to put in the _setDomainName
method.
I can't figure out when I'm supposed to use which of these three:
_gaq.push(['_setDomainName', 'mysite.com']);
_gaq.push(['_setDomainName', '.mysite.com']);
_gaq.push(['_setDomainName', 'none']);
Can anyone out there give me some guidance or an explanation?
Ben, the best explanation is on the Google Documentation page - http://code.google.com/apis/analytics/docs/tracking/gaTrackingSite.html#domainToNone. Get to know this page, there are a lot of ways to configure your GA setup and there is no definitive way of saying 'this is how you need to setup cross domain tracking' without knowing a lot more about your desired configuration. The scenarios on that page should certainly help.
There are 3 distinct reasons for using the different variations of
_setDomainName
.'none' - you only need to use this feature when you want to track a top-level domain independently from any of its sub-domains, since this parameter will make the cookies of a domain inaccessible by its sub-domains.
'mysite.com' - Use this when tracking between a domain and a sub-directory on another domain. For example, your 'mysite.com' profile should also record hits from 'yourblog.othersite.com'.
'.mysite.com' - Use this when you want track across a domain and its subdomains. This will treat top- and sub-domains as one entity and track in the same profile. For example, 'mysite.com' profile should record 'blogs.mysite.com' and 'shop.mysite.com'.
I recommend setting up some test profiles and experimenting with your configuration, that way you don't 'dirty' your real data.
Hope this helps!