I have an angularjs1.5 app and it is using ui-router for state change.Recently, I got the requirement to implement google analytics in our app. I never worked on google analytics before.So, I started doing some research.so far, I bottom down to two points.
Analytics.js -> use analytics.js and use $stateChangeSuccess on $rootScope to track the ui state change. This is simple and straight forward. it tracks any state change in the app and sends tracking data.
angulartics -> This directive can be used to track state changes/ event changes or any dom changes. Looks like, the implementation is not that simple.I am not sure if this works with ui-router.
my thought here is if only state changes need to be tracked then I should go with option 1 and if state/events level changes need to be tracked then should go for option 2.
Could you pls let me know if I am on track or am i missing something here? it would be great if you could point me to any sample implementation on both approaches.
Thanks a lot in advance !!!