【问题标题】:Google Analytics Form Tracking Events not working谷歌分析表单跟踪事件不起作用
【发布时间】:2015-11-09 18:40:26
【问题描述】:

我们尝试在 Google Analytics(分析)中跟踪一个表单。我们在表单提交后执行了以下代码:

<script language=\"javascript\">_gaq.push(['_trackEvent', 'ProductForm', 'submit', window.location.href])</script>

这是我们在网站上全球使用的通用分析代码:

<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-12345678-1', 'auto');
ga('send', 'pageview');
</script>

但是,Google Analytics(分析)中不会跟踪表单事件。知道我们使用的特定跟踪方法出了什么问题,还是我们只需要升级我们的 Analytics 版本?

谢谢!

【问题讨论】:

    标签: javascript google-analytics analytics universal-analytics


    【解决方案1】:

    _gaq.push 已过时,需要更新。

    试试那个代码:

    ga('send', 'event', {'page': window.location.href,'title': 'ProductForm'});
    

    您可以查看更多示例here

    【讨论】:

      猜你喜欢
      • 2011-06-26
      • 1970-01-01
      • 1970-01-01
      • 2014-04-28
      • 1970-01-01
      • 2011-07-24
      • 1970-01-01
      • 2016-07-02
      相关资源
      最近更新 更多