I am using angulartics google analytics in my project. I have set it up as the docs say. Its tracking the page views and all in real time but the events is not getting tracked. Here is my code:
view:
// Not getting tracked
<a href="#" ng-click="download()" analytics-on="click" analytics-event="Download">Push</a>
index.html
<!-- Put Your GOOGLE ANALYTICS CODE Below -->
<script src="vendor/angular/angulartics.js"></script>
<script src="vendor/angular/angulartics-ga.js"></script>
<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', 'XXXXXXXX', 'auto');
ga('send', 'event', 'button', 'click', 'nav buttons', 4);
</script>
The download event is not getting tracked. But the same button event below that i have added in the script tag is getting tracked
ga('send', 'event', 'button', 'click', 'nav buttons', 4); // This is being tracked
Event tracking from inside the application logic is also not working when i do like below from inside my controller:
$analytics.eventTrack('Downalod');
I also found this closed issue which one guy had same issue.
Browser Used: Chrome Version 37.0.2062.120 (64-bit)
Is there anything i am missing here? Do i need to enable event tracking or something in the code??
I had the same issue. So I was going over the recent commits and found this in the change logs: Google Analytics - do nothing if there is no event category (required)
Link
This should fix it:
<a href="#" ng-click="download()" analytics-on="click" analytics-category="Some-Category" analytics-event="Download">Push</a>