It seems to be quite a popular question with not as many answers to hold the weight.
This has caused quite a change in how Analytics Tools are used and how they are expected to gather statistics.
Luckily there are ways to achieve this and Arnaldo Capo has already written about it over at his blog. We have included his code below for clarity as well as in case the site is down for some reason in the future.
So let’s get into the gory details.
Basically it’s all about setIntervals and dom listeners, or in AngularJS, state changes.
On the script provided by google remove the last line as shown in the following example.
ga(‘create’, ‘UA-XXXXXXXX-X’, ‘yourdomain.com’); //ga(‘send’, ‘pageview’);
Then in your app bootstrap, register a $rootScope event named $stateChangeSuccess. $stateChangeSuccess will fire every time a state changes. See code below.