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

标签 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>

trackEvent 行似乎是正确的...但由于某种原因没有跟踪。是因为我把 value 字段留成了 nil 吗?

最佳答案

对于_trackEventvalue参数应该是一个整数。由于它是可选参数,因此您可以将其省略:

_gaq.push(['_trackEvent', 'Priority', 'Created (day)', 'Label info']);

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

关于google-analytics - Google Analytics 自定义事件未正确跟踪,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9299293/

相关文章:

google-analytics - GA-实验无效

javascript - 用于 React 项目、Javascript 或 Node-js 的 Google API 客户端库?

iOS - 如何将 Firebase Analytics 与现有的 Google Analytics 集成,GoogleService-Info.plist

sql - 如何在 BigQuery 中查看整个 session 路径?

ios - 谷歌分析时间未显示

javascript - 为什么没有记录我的 Google Analytics 自定义变量?

javascript - Google Analytics 中的 iOS 电话超链接 javascript 跟踪

google-analytics - 为什么我收到 gtag is not Defined with GTM script

javascript - 数据未出现在购物分析中

google-analytics - Google AdWords 转化与数据库条目不匹配