我在我的web应用程序中使用了异步google分析跟踪。google analytics JS代码也集成到第三方网页中。我需要跟踪访客在第三方网站分别到我自己的网站。这就是我使用多个跟踪器的原因,如下所示。
我需要匿名的IP地址来追踪。但我不想影响第三方网站的追踪。我正在尝试用下面的代码来实现这一点。
// create a tracker for use on my own web-site
var _gaq = _gaq || [];
_gaq.push(['myWebSiteTracker._setAccount', 'UA-65432-1']);
_gaq.push(['_gat._anonymizeIp']);
_gaq.push(['myWebSiteTracker._trackPageview']);
// In the same webpage that the code above is running, the 3rd-party
// webpage could idself create a tracker using...
_gaq.push(['thirdPartyTracker._setAccount', 'UA-65432-2']);
_gaq.push(['thirdPartyTracker._trackPageview']);但是,使用上面的代码,在推送_gat._anonymizeIp之后调用的每个跟踪事件都会将IP匿名,但我只希望myWebsiteTracker跟踪器上记录的事件是匿名的,这可能吗?
发布于 2012-09-12 05:21:18
AnonymizeIp会影响一切,它不是每个跟踪器的配置。但是您可以做的是更改顺序,使其在thirdPartyTracker触发时不起作用。
// In the same webpage that the code above is running, the 3rd-party
// webpage could idself create a tracker using...
_gaq.push(['thirdPartyTracker._setAccount', 'UA-65432-2']);
_gaq.push(['thirdPartyTracker._trackPageview']);
// create a tracker for use on my own web-site
var _gaq = _gaq || [];
_gaq.push(['myWebSiteTracker._setAccount', 'UA-65432-1']);
_gaq.push(['_gat._anonymizeIp']);
_gaq.push(['myWebSiteTracker._trackPageview']);https://stackoverflow.com/questions/12356725
复制相似问题