Google Analytics 跨域跟踪无需将 Cookie 附加到 URL?
有没有一种方法可以在 Google Analytics 中跟踪两个域,而无需在 URL 中传递 cookie 信息?
Is there a way to track two domains in Google Analytics without passing the cookie information in the URL?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于 GA 不支持第 3 方 cookie,并且 cookie 传递不是您想要的(无论如何它在所有情况下都不起作用),因此您只能更改工具或执行一些高度自定义的操作,例如某些操作像这样:
域 1 和 2 共享一个数据库(表),其中保存每个访问者的 GA-cookie。如果访问者从域 1 转到域 2(或反之亦然),您将在服务器端的 DB 中检查(访问者的匹配应使用 IP + 用户代理 + 可能是引荐来源网址)中的 cookie(在 GA 有时间执行之前)如果匹配则写入它们,以便 GA 将具有相同的可用 cookie。
请记住,cookie 包含信息,例如当前访问期间的页面浏览量,这些信息必须在写入 cookie 之前增加。
每次加载页面时都必须执行此操作,并且引荐来源网址不是内部的。
如果您确实想这样做,那么它会起作用,但要省去一些麻烦和头痛,并获得一个合适的 WA 系统。
Since GA doesn't support 3rd party cookies and the cookie passing isn't what you want (it doesn't work in all the cases anyway), you're left with either changing the tool or doing some highly customized stuff, e.g. something like this:
Domains 1 and 2 share a database (table) where the GA-cookies of each visitor are kept. If the visitor goes from domain 1 to domain 2 (or vice versa) you check (the matching of visitor should be done with IP + User Agent + maybe referrer) for cookies in DB at the server side (before GA has time to execute) and write them if it matches, so that GA will have the same cookies available.
Remember that the cookies contain information, like the number of page views during current visit, which would have to be grown before writing the cookie.
You have to do this every time the page loads and the referrer is not internal.
It would work if you really want to do this, but save yourself some trouble and headache and get a proper WA system.