Google Analytics(分析)Cookie与静态内容的子网域 [英] Google Analytics cookies vs subdomain for static content

查看:173
本文介绍了Google Analytics(分析)Cookie与静态内容的子网域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在www.example.com上有一个网站,并使用Google Analytics(分析)。我还设置了static.example.com来提供所有的静态内容。

I have a website on www.example.com and use Google Analytics. I've also set up static.example.com which serves all static content.

问题是GA的默认行为是在.example上发出cookie。 com,但我不希望静态内容流量携带GA Cookie的权重。

The problem is that the default behavior of GA is to issue cookies on ".example.com" but I don't want the static content traffic to be carrying the weight the GA cookies.

我尝试 pageTracker._setDomainName(none); ,它对Cookie问题很好,但它完全搞乱了平均网站时间报告(从平均5分钟到40分钟,直到我回复_setDomainName调用的那一天)。

I tried pageTracker._setDomainName("none"); and it worked well for the cookies problem but it completely messed up the "Avg. Time on Site" report (from 5 mins average it went to 40 mins until the day I reverted the _setDomainName call).

任何想法为什么会发生这种情况,我该如何解决?

Any idea why this is happening and how could I fix it?

推荐答案

解决方案是执行 pageTracker._setDomainName(www.example.com),然后GA会向.example.com发送Cookie。这样,分析仍然可以正常工作,并且Cookie不会泄漏到其他静态子域。

The solution is to do pageTracker._setDomainName("www.example.com") and then GA will issue the cookies to ".www.example.com". That way analytics still works fine and the cookies do not leak into the other static subdomain.

这篇关于Google Analytics(分析)Cookie与静态内容的子网域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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