我不确定我的展示位置是否正确......这是我需要帮助的部分...谷歌分析文件下载没有解雇,放置问题?
我有一个web应用程序,它将动态生成可用资源的列表,和文件信息的变量的分辨率完美的作品......我越来越装出来的代码锚标记像这样:
<ul id="ul_4" class="resources_list fa-ul h_4">
<li>
<a onclick="var that=this;_gaq.push(['_trackEvent','Resources: Tools','Download','Policy template: Access to confidential information']);setTimeout(function(){location.href=that.href;},200);return false;" href="/file.cfm?f=402&type=resource">Policy template: Access to confidential information</a>
</li>
<li>
<a onclick="var that=this;_gaq.push(['_trackEvent','Resources: Tools','Download','Policy template: Client records']);setTimeout(function(){location.href=that.href;},200);return false;" href="/file.cfm?f=407&type=resource">Policy template: Client records</a>
</li>
<li>
<a onclick="var that=this;_gaq.push(['_trackEvent','Resources: Tools','Download','Policy template: Privacy']);setTimeout(function(){location.href=that.href;},200);return false;" href="/file.cfm?f=391&type=resource">Policy template: Privacy</a>
</li>
</ul>
...注视着我对谷歌Analytics(分析)标准代码如下:
<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12345678-1']);
_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>
不幸的是,无论我在这些链接上使用的点击次数如何,触发器似乎都不会记录在Google Analytics(分析)中......即使在24小时的周转时间或更长时间之后......我是否正在使用在我的链接上填充触发器的错误方法,还是我使用错误的代码来引用触发器?我应该将最初的Google Analytics(分析)urchin代码放在我的页面顶部吗?
我知道事实上,标准的GA代码工作,因为我看到各种其他网页的活动......但对于从这些链接可用的文件下载是问题...我很n00b当涉及到GA,所以我愿意接受任何建议......我错过了什么?
在此先感谢...
这看起来不错,但应用程序是客户端的应用程序,我们有点锁定使用'_gaq'而不是'ga' ...有没有机会,你可以修改上面的代码以反映'_gaq'实例? – 2014-10-08 23:06:36
@ Eliseod'Annunzio,你应该可以将你的代码从'onclick'移动到函数中。另外,您的Google Analytics代码不会将'_gaq'放入全局命名空间中? – sushain97 2014-10-11 21:11:05