简体   繁体   English

Google Analytics:我可以将trackEvent和trackPageView合并到一个调用中吗?

[英]Google Analytics: can I combine trackEvent and trackPageView into a single call?

I am combining Google Analytics' _trackEvent and _trackPageview into a single call, like the following: 我将Google Analytics的_trackEvent和_trackPageview合并为一个调用,如下所示:

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-20822178-2']);
_gaq.push(['_setCustomVar', 1, 'My Custom Page View Variable', 'My Value']);
_gaq.push(['_trackEvent', 'My Category', 'My Action']);
_gaq.push(['_trackPageview']);
[...GA snippet insertion...]

This generates two __utm.gif requests to Google. 这会向Google生成两个__utm.gif请求。 This would be okay except that the request with the _trackEvent information ALSO contains the CustomVar info, which leads me to believe that Google counts the pageview on BOTH requests. 这可以,但带有_trackEvent信息的请求还包含CustomVar信息,这使我相信Google会根据BOTH请求计算综合浏览量。 I don't want to double count my page requests... so is Google smart enough to throw away the pageview info sent with the _trackEvent call? 我不想重复计算我的页面请求... Google是否足够聪明,可以丢弃使用_trackEvent调用发送的_trackEvent浏览量信息?

Thanks! 谢谢!

It won't double count page views but it is double counting your custom var. 它不会重复计算页面查看次数,但它会重复计算您的自定义var。 If you don't want that, reorder the pushes, make the trackpageview come first, then the custom var, then the event 如果您不想这样,请重新排序推送,首先是trackpageview,然后是自定义var,然后是事件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM