Google Analytics - 下载链接事件跟踪
我想通过 Google Analytics 事件来统计我的下载量。不幸的是,我的统计数据中没有显示任何内容。 这是 GA 代码:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12345678-1']);
_gaq.push(['_setDomainName', 'example.com']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
我的链接:
<a href="advanced-pack.zip" onClick="_gaq.push(['_trackEvent', 'Download', 'Pack', 'Advanced']);">Download</a>
为什么它不起作用?
I would like to count my downloads through Google Analytics events. Unfortunately nothing shows up in my statistics.
This is the GA code:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12345678-1']);
_gaq.push(['_setDomainName', 'example.com']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
And my link:
<a href="advanced-pack.zip" onClick="_gaq.push(['_trackEvent', 'Download', 'Pack', 'Advanced']);">Download</a>
Why it is not working?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据
Google 文档
:要验证 _trackPageview 是否被正确调用,您可以在执行更新的跟踪代码 24-48 小时后检查热门内容报告。您应该能够在报告中看到分配的页面名称。
According to
Google Documentations
:To verify that _trackPageview is being called correctly, you can check your Top Content report 24-48 hours after the updated tracking code has been executed. You should be able to see the assigned pagename in your report.