Google Analytics Event Tracking onClick Code -
i'm trying set event tracking on web site can't working correctly.
my tracking code:
<script> (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-420xxxxxxx', 'mywebsite.org'); ga('send', 'pageview'); </script>
my event tracking code:
<a href="#purchasepanellink" class="uk-button uk-button-primary" onclick="$('#purchasepanel').show(); _gaq.push(['_trackevent', 'button', 'click', 'purchase details',, false]);">purchase details</a>
you mixing classic code universal code. not work. need replace this:
_gaq.push(['_trackevent', 'button', 'click', 'purchase details',, false]);
with this:
ga('send', 'event', 'button', 'click', 'purchase details');
gajs reference events: https://developers.google.com/analytics/devguides/collection/upgrade/reference/gajs-analyticsjs#events
Comments
Post a Comment