Google Analytics自定义事件未正确跟踪

Mat*_*man 3 google-analytics

这是GA输出代码:

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA_CODE']);
  _gaq.push(['_setDomainName', 'SUBDOMAIN']);
  _gaq.push(['_trackPageview']);
  _gaq.push(['_trackEvent', 'Priority', 'Created (day)', 'Label info', '']);



  (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>
Run Code Online (Sandbox Code Playgroud)

trackEvent行似乎是正确的......但由于某种原因没有跟踪.是因为我离开了值字段为零吗?

mik*_*ike 6

对于_trackEvent,value参数应为整数.由于它是一个可选参数,您可以将其删除:

_gaq.push(['_trackEvent', 'Priority', 'Created (day)', 'Label info']);
Run Code Online (Sandbox Code Playgroud)

具有非整数值将阻止跟踪事件.