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

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

问题描述

我试图在两个完全不同的域(不是子域)之间建立跨域跟踪。仔细查看Google文档的不同页面,似乎给了我有关在 _setDomainName 方法中放置什么的不同建议。



我无法弄清楚什么时候我应该使用以下三种:

  _gaq.push(['_ setDomainName','mysite.com']); 
_gaq.push(['_ setDomainName','.mysite.com']);
_gaq.push(['_ setDomainName','none']);

任何人都可以给我一些指导或解释吗?
<本文最好的解释是在Google文档页面 - 解决方案

/gaTrackingSite.html#domainToNone\">http://code.google.com/apis/analytics/docs/tracking/gaTrackingSite.html#domainToNone 。了解这个页面,有很多方法可以配置您的GA设置,并且没有明确的方式来说明这是您需要设置跨域跟踪的方式,而无需更多地了解您所需的配置。使用 _setDomainName 的不同变体有三个不同的原因。




  • 'none' - 当您想跟踪顶级域名时,只需要使用此功能它的子域,因为这个参数将使一个域的cookie不能被其子域访问。

  • - 在另一个域的域和子目录之间进行跟踪时使用此项。例如,您的'mysite.com'个人资料也应记录来自'yourblog.othersite.com'的匹配。


  • '。mysite.com' - 使用此当你想跟踪一个域及其子域。这将把顶级域和子域视为一个实体并在同一个配置文件中进行跟踪。例如,'mysite.com'个人资料应记录'blogs.mysite.com'和'shop.mysite.com'。




我建议设置一些测试配置文件并尝试使用您的配置,这样您就不会弄脏您的真实数据。 希望这有助于您! / p>

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!

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

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