Summary :
I implemented Angulartics and the angulartics-google-analytics Vendor Plugin in my angular application as per the angulartics
official documentation.
Real time page views
tracked properly but Declarative event tracking
is not getting tracked.
Declarative Event Tracking :
<a href="file.pdf" analytics-on="click" analytics-event="Download" analytics-category="PDF" analytics-label="fileName">Download</a>
Scripts & Tracking Code in index.html :
<!-- GA scripts -->
<script type="text/javascript" src="node_modules/angulartics/dist/angulartics.min.js"></script>
<script type="text/javascript" src="bower_components/angulartics-google-analytics/dist/angulartics-ga.min.js"></script>
<!-- end -->
<!-- Google Analytics 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','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'XX-XXXXXXXX-X', 'auto');
// ga('send', 'pageview');
</script>
<!-- end -->
Agreed :
Data in Google Analytic Reports can take up to 48 hours to process but I was waiting for the events data from past 2 days, still nothing happen.
There are lot of posts on SO with same issue, but didn't get any solution.
Angulartics GA events not getting tracked
Event tracking not working (yet)?
Update :
I get notification in my account related to Missing Tracking Code
.
As I am working on http://localhost
right now.So, this notification is valid. But issue is that real time page views
recorded successfully and declarative events
not getting tracked.