My current project focuses on AngularJS, catering to both mobile applications and desktop websites. I have downloaded analytics.js locally and integrated it into my GA tracking code within the index.html file:
(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','js/analytics.js','ga');
ga('create', 'UA-57325467-1', 'auto');
ga('set', 'checkStorageTask', null);
ga('set', 'checkProtocolTask', null);
ga('send', 'pageview');
In the controller, I have implemented the following code for page tracking:
ga('send', 'pageview', $location.url());
The real-time Google Analytics data shows only one user online (myself). While events are being tracked on all pages, there seems to be an issue with pageviews. Upon visiting different pages in the application and checking the Google Analytics real-time overview, I consistently see "/" as the page, even though sometimes the page tracking works fine upon returning to previous pages (although not always). In essence, the page tracking functionality is inconsistent.