Ionic Analysis error


#1

i am using ionic analysis in my project .but it will not analysis each state.
how will i get each state($stateparam) module analysis in my project and also need clarify about ionic auto analysis directive.


#2

I do it like this, works fine for me:

var trackEvent = function (name, event) {
  try {
    $ionicAnalytics.track(name, {event: event});
  } catch (e) {
    $log.error("error tracking " + name + ":" + e);
  }
};

angular.module('app').run(function ($ionicPlatform, $state, $rootScope) {

  $rootScope.$on('$stateChangeError',
    function (event, toState, toParams, fromState, fromParams, error) {

      trackEvent('$stateChangeError', error && (error.debug || error.message || error));

    });

  $rootScope.$on('$stateChangeSuccess',
    function (event, toState, toParams, fromState, fromParams) {

      trackEvent('$stateChangeSuccess', toState);
    });
});

Regarding the directive, I think you can read all about it in the documentation.


#3

thanks its work fine


#4

Okay that’s cool …