Google Analytics 跨域跟踪和 _setDomainName() [英] Google Analytics Cross Domain Tracking and _setDomainName()

查看:23
本文介绍了Google Analytics 跨域跟踪和 _setDomainName()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在两个完全不同的域(不是子域)之间设置跨域跟踪.浏览 Google 文档的不同页面似乎给了我关于在 _setDomainName 方法中放置什么的不同建议.

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,最好的解释是在 Google 文档页面 - http://code.google.com/apis/analytics/docs/tracking/gaTrackingSite.html#domainToNone.了解这个页面,有很多方法可以配置您的 GA 设置,并且没有明确的方式说这是您需要设置跨域跟踪的方式",而无需更多地了解您所需的配置.该页面上的场景肯定会有所帮助.

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.

使用 _setDomainName 的不同变体有 3 个不同的原因.

There are 3 distinct reasons for using the different variations of _setDomainName.

  • 'none' - 只有当您想独立于其任何子域跟踪顶级域时才需要使用此功能,因为此参数将使域的 cookie 无法被其子域访问-域.

  • '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' - 在一个域和另一个域上的子目录之间进行跟踪时使用它.例如,您的mysite.com"个人资料还应记录来自yourblog.othersite.com"的点击次数.

'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' - 当您想要跨域及其子域进行跟踪时使用此选项.这会将顶级域和子域视为一个实体并在同一配置文件中进行跟踪.例如,mysite.com"个人资料应记录blogs.mysite.com"和shop.mysite.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.

希望这有帮助!

这篇关于Google Analytics 跨域跟踪和 _setDomainName()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆