简体   繁体   English

Google Analytics自定义事件跟踪无效

[英]Google Analytics Custom Event Tracking Not Working

I am trying to add custom event tracking to a link on a site I built. 我正在尝试将自定义事件跟踪添加到我构建的网站上的链接。 For some reason it does not seem to be working. 由于某种原因,它似乎没有起作用。 The code I have is: 我的代码是:

onClick="_gaq.push(['_trackEvent', 'SOU Links', 'Click', 'Top edu banner']);"

The site URL is http://sou.wpengine.com/ . 网站网址为http://sou.wpengine.com/ The link with the event tracking is the "Sign Up Now" link at the top of the page. 与事件跟踪的链接是页面顶部的“立即注册”链接。 Any ideas? 有任何想法吗?

I had an issue with events not tracking (using Universal Analytics). 我遇到了未跟踪事件的问题(使用Universal Analytics)。

I installed the official Google Analytics Debugger from 我安装了官方的Google Analytics调试器

https://chrome.google.com/webstore/detail/google-analytics-debugger/jnkmfdileelhofjcijamephohjechhna https://chrome.google.com/webstore/detail/google-analytics-debugger/jnkmfdileelhofjcijamephohjechhna

And it showed me a warning message that event value was expecting an integer, but receiving an empty string. 它向我展示了一条警告消息,即事件值期望一个整数,但是接收一个空字符串。 Once I cleared that up, the events showed up in the realtime tracker right away. 一旦我清理完了,事件就会立即显示在实时跟踪器中。

It appears you're using the advanced configuration setup described by google here . 您似乎正在使用谷歌此处描述的高级配置设置。 To track events, you'll want to use the event tracking methods described by google here . 要跟踪事件,您需要使用Google 在此处描述的事件跟踪方法。

Hope this helps. 希望这可以帮助。

Adding another helpful link: https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide 添加其他有用的链接: https//developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide

This will work for older tracking version: Tracking Basics (Asynchronous Syntax) 这适用于较旧的跟踪版本:跟踪基础(异步语法)

As bbone said, you are using the event tracking syntax for ga.js (Classic Analytics) and you have analytics.js (Universal Analytics) on your site. 正如bbone所说,您正在使用ga.js(Classic Analytics)的事件跟踪语法,并且您的站点上有analytics.js(Universal Analytics)。

If you want to track the "Sign Up Now" link, use this: 如果要跟踪“立即注册”链接,请使用以下命令:

ga('send', 'event', 'SOU Links', 'Click', 'Top edu banner');

you should send also _gaq.push(['_setAccount', 'UA-XXXXXX-1']); 你应该发送_gaq.push(['_ setAccount','UA-XXXXXX-1']); before the tracking event and install for chrome this extension to debug https://chrome.google.com/webstore/detail/google-analytics-debugger/jnkmfdileelhofjcijamephohjechhna 在跟踪事件之前安装chrome此扩展程序以调试https://chrome.google.com/webstore/detail/google-analytics-debugger/jnkmfdileelhofjcijamephohjechhna

it worked for us 它对我们有用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM