0

我的事件跟踪不适用于我的 Google 分析。下面是它让我插入网页的代码,下面是它告诉我放置的代码片段。我想跟踪网站上“mailto”链接的点击次数,我相信这是最好的方法吗?

谁能告诉我哪里出错了?

  (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-37080107-2', 'promat-durasteel.com');
  ga('send', 'pageview');

这是片段:(出于某种原因,它不会让我将开始标签放在这个论坛上,但它在编码中!

href="mailto:info@sharpfiber.com" onclick="_gaq.push(['_trackPageview, '/Direct-Email-Enquiry-Link-Clicked']);">info@sharpfiber.com

请帮忙!

谢谢

4

1 回答 1

0

As far as I can tell you are mixing two brands of Google Analytics - the new "Universal Analytics" and the , ehm, traditional asynchronous tracking code. Pushing values to the _gaq-Array will not help you since Universal Analytics does not use _gaq (and even if it would you are tracking a (virtual) pageview, not an event).

You'll have to use ga('send') on the click event. Documentation for event tracking with the new GA code is here: https://developers.google.com/analytics/devguides/collection/analyticsjs/events

于 2013-05-24T09:14:35.063 回答