向站点添加事件跟踪以进行 PDF/Microsoft Word 下载
我在设置事件跟踪时遇到一些困难。我有一个网站,人们可以下载各种内容的 PDF 和 Word 文档。我像这样插入了事件跟踪:
<a href=files/8399039122.pdf onClick='_gaq.push(['_trackEvent', 'downloads',
'all', 'nofilter']);' >File #1</a>
<a href=files/8329384939.doc onClick='_gaq.push(['_trackEvent', 'downloads',
'all', 'nofilter']);' >File #2</a>
但是,四天后数据仍然没有显示在我的分析配置文件中。难道是我安装错了?另外,我是否需要将 _gaq.push(['_trackEvent', 'downloads', 'all', nofilter]);'
添加到页面标题中的分析脚本中?
I am having some difficulty setting up event tracking. I have a website where people can download PDFs and Word docs of various content. I inserted the event tracking like so:
<a href=files/8399039122.pdf onClick='_gaq.push(['_trackEvent', 'downloads',
'all', 'nofilter']);' >File #1</a>
<a href=files/8329384939.doc onClick='_gaq.push(['_trackEvent', 'downloads',
'all', 'nofilter']);' >File #2</a>
However, after four days data is still not showing up on my analytics profile. Did I install this wrong? Also, do I need to add the _gaq.push(['_trackEvent', 'downloads', 'all', nofilter]);'
to the analytics script in the header of my page?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来这是您使用单引号(未正确嵌套)。试试这个:
将整个
onClick
用双引号括起来。并且,链接的路径 (href
) 也应该被引用。延迟 onclick 而不使用 target="blank"
Looks like it's your use of single quotes (not nested properly). Try this:
Wrap the entire
onClick
in double quotes. And, the path to your links (href
) should be quoted as well.To delay the onclick without using target="blank"
解决此问题的另一种方法是将
target="_blank"
添加到标记:
Another way to resolve this issue is to add
target="_blank"
to the<a>
tag: