I am trying to track each menu on the website using _trackEvent
of Google analytic. So far Analytic is working fine but Event Tracking is not working.
Below is the code i am using
// Analytics
(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-481xxxxx-1', 'ABC.com');
ga('send', 'pageview');
and in html code i am using is like this.
<li>
<a onclick="_gaq.push(['_trackEvent', 'Top_Menu', 'contact-details']);" href="en/10/contact-details">CONTACT</a>
</li>
For some reason it is not tracking my events.
Am i using wrong version of analytic.
UPDATE: Even this is not working
<li>
<a onclick="ga('send', 'event', { 'eventCategory': 'Navigation', 'eventAction': 'Click', 'eventLabel': 'about-the-group});" href="en/about/about-us">ABOUT US</a>
</li>