问题描述
我在写一个应用嵌入到其他人的网站(类似于一个小部件)的Web应用程序。我使用Google Analytics(分析)来跟踪所有访问嵌入网站上我脚本的所有实例的用户。问题是,我不知道如何使用它,以便它不干扰这些网站自己的Google Analytics(分析)帐户。我将tracker变量存储在命名空间,所以我认为应该这样做,但我还没有意识到,GA存储其设置在cookie(__utma,__utmz等),这些cookie是由两个跟踪器使用,如果有两个在同一页上...因此,例如,如果我使用_setVar在Google Analytics(分析)中存储某种用户定义的变量,嵌入网站也是这样,我们重写彼此的值...
当然,如果Google提供了一种方法来将cookie的名称更改为自定义cookie,那么这将是最简单的,但是我找不到任何办法。我想过使用cookie域或路径来强制一个单独的cookie,但这不工作,因为如果我设置域或路径为非真实的域/路径,那么cookie是不可读的页面重新加载后。 ..
有没有人知道在一个网页上有两个跟踪器,并使他们使用单独的Cookie,以便他们不会覆盖彼此的设置?
或者,如果这是完全不可能的 - 是否有任何其他分析服务与GA类似的功能,这是可能的? (它必须具有高级功能,例如事件和广告系列跟踪...)
码。 :)
I'm writing a web application that's supposed to be embedded in other people's websites (kind of a widget). I'm using Google Analytics to track all the people that visit all instances of my script on the embedding websites. The problem is that I don't know how to use it so that it doesn't interfere with those websites' own Google Analytics accounts. I'm storing the tracker variable in a namespace, so I thought that should do it, but I haven't realized that GA stores its settings in cookies (__utma, __utmz etc.), and those cookies are used by both trackers, if there are two of them on the same page... So for example if I use _setVar to store some kind of user-defined variable in Google Analytics, and the embedding site does the same, we overwrite each other's values...
Of course it would be easiest if Google provided a way to change the name of the cookies to a custom one, but I can't find any way to do it. I thought about using cookie domain or path to force a separate cookie, but this doesn't work, because if I set domain or path to something other than the real domain/path, then the cookie is not readable for the page after reload...
Does anyone know a way to have two trackers on one page and make them use separate cookies so that they don't overwrite each other's settings?
Or, if that's completely impossible - is there any other analytics service with similar functionality as GA in which this is possible? (it would have to have advanced features like event and campaign tracking...)
Now made easy with the new asynchronous tracking code. :)
https://developers.google.com/analytics/devguides/collection/gajs/#MultipleCommands
这篇关于Google Analytics(分析) - 一个网页上的多个跟踪链接(Cookie冲突)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!