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?
Cross-domain measurement is a Google Analytics feature that allows you to see sessions from two related sites (such as an ecommerce site and a separate shopping cart site) as a single session, rather than as two separate ones.
When you have multiple websites to track, you can use a single account to add multiple sites in Google Analytics, which can be done in two ways. You can either add all your sites under a single Analytics account as different properties or add a unique Analytics account ID to each individual site.
Cross-domain tracking is a way of allowing Google Analytics to track a visitor as a continuous session on two or more related sites. For example when tracking www.sitea.com and www.siteb.com in the same GA Web Property.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With