Google Analytics Cross Domain Tracking and _setDomainName()

后端 未结 4 735
予麋鹿
予麋鹿 2020-12-24 13:27

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

4条回答
  •  轮回少年
    2020-12-24 14:11

    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!

提交回复
热议问题