我在Google Analytics(分析)中显示的事件有问题。有人可以帮忙吗?
我希望跟踪在Google Analytics(分析)中使用的事件。
我在所有页面的部分中都有以下UA代码。
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-16728174-1', 'sjgweb.com');
ga('send', 'pageview');
</script>
并添加了以下代码来跟踪事件:
<p><a href="mailto:sjg@sjg.com" onClick="ga(‘send’, ‘event’, ‘email’, ‘click to email’, ‘sjg@sjg.com’);">Send An Inquiry Today</a></p>
什么都没显示在事件中...我需要怎么做才能解决此问题?
最佳答案
您使用的单引号不能用于GA。您将需要将其更改为直引号,如下所示:
onClick="ga('send', 'event', 'email', 'click to email', 'sjg@sjg.com');"
关于javascript - Universal Analytics-事件跟踪,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27161288/