Reputation: 407
Trying to correct my bounce rate in Google Analytics and I found this snippet very handy. It does the job but at the same time it triggers an error like "_gaq is not defined" in Dev Console...
// <![CDATA[(function (tos) {window.setInterval(function () {tos = (function (t) {return t[0] == 50 ? (parseInt(t[1]) + 1) + ':00' : (t[1] || '0') + ':' + (parseInt(t[0]) + 10);})(tos.split(':').reverse());window.pageTracker ? pageTracker._trackEvent('Time', 'Log', tos) : _gaq.push(['_trackEvent', 'Time', 'Log', tos]);}, 10000);})('00');// ]]>
Upvotes: 0
Views: 3355
Reputation: 8907
The message indicates that the _gaq
object does not exist, and this could be true if you are not using Classic GA for your tracking, but are instead using Universal Analytics. If you are using Universal Analytics, you would need to update your _gaq.push
code to:
ga('send', 'event', 'Time', 'Log', tos);
Upvotes: 2