I am trying to track a link being clicked using event tracking and hitcallback. My analytics code looks like this...
The problem is you are attempting to use Universal Analytics syntax (analytics.js) for your click tracking, but the GA library you are using is the older _gaq
(ga.js) syntax.
_gaq
style does let you specify a callback function, though it's undocumented. Basically you have to _set
the callback function before you make the _trackEvent
call.
Your link should look like this:
<a href='http://cool.com' onclick="var _this=this;_gaq.push(['_set','hitCallback',function(){document.location=_this.href;}]);_gaq.push(['_trackEvent','outbound','click',_this.href]);return false;">cool</a>