angular-google-analytics icon indicating copy to clipboard operation
angular-google-analytics copied to clipboard

Not tracking all the state changes evenif integrated the same way mentioned in the document.

Open codalprashant opened this issue 6 years ago • 7 comments

It is just tracking the first page. But when the state is changed, it stops tracking the pages and the active user.

codalprashant avatar Jan 12 '18 11:01 codalprashant

Hi,

This is due to ui-router update, check this: https://ui-router.github.io/ng1/docs/latest/modules/ng1_state_events.html

Sparksx avatar Jan 16 '18 13:01 Sparksx

I managed it using AnalyticsProvider.setPageEvent('$stateChangeStart') in config and

$rootScope.$on('$stateChangeStart',  
      function(event, toState) { 
        Analytics.trackPage($location.absUrl());
}); 

in run section.

codalprashant avatar Jan 17 '18 06:01 codalprashant

Can we close this issue ?

revolunet avatar Jan 19 '18 23:01 revolunet

@revolunet No! You need to fix it in your code

AnalyticsProvider.setPageEvent('$stateChangeSuccess'); is now deprecated in angular-ui-router and need to be replaced in your code

Sparksx avatar Jan 20 '18 13:01 Sparksx

@revolunet @Sparksx I agree that this should be fixed in the library, and not with a workaround.

BriceN avatar May 12 '18 16:05 BriceN

so someone should issue a pull request please, i dont use angular anymore sorry

@justinsa is now the main contributor

revolunet avatar May 12 '18 17:05 revolunet

My opinion is that the library should stop having an opinion on the route provider used and let the implementer handle that decision. We could then provide a Cookbook as part of the Wiki or the README to explain how to configure different route providers for auto-page tracking or this setPageEvent issue. This library should do Google Analytics the best it can and not need updating due to ng-router or ui-router changes.

If someone wants to issue a PR to fix this issue, great, if not, I will likely make a major version change to alleviate this possibility from being able to happen.

justinsa avatar May 14 '18 03:05 justinsa