我想通过 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>
为什么它不起作用?
最佳答案
根据 Google 文档
:
<a href="http://www.example.com/files/map.pdf" onClick="javascript: _gaq.push(['_trackPageview', '/downloads/map']);">
要验证 _trackPageview 是否被正确调用,您可以在执行更新的跟踪代码 24-48 小时后检查热门内容报告。您应该能够在报告中看到指定的页面名称。
关于javascript - Google Analytics - 下载链接事件跟踪,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9374942/