revolunet / angular-google-analytics

Google Analytics tracking for your AngularJS apps
MIT License
652 stars 172 forks source link

How to use it with ui-router v1.0.x? #153

Open Itrulia opened 8 years ago

Itrulia commented 8 years ago

$stateChangeSuccess doesnt exists anymore, but rather you will use

$transitions.onSuccess({}, function() {

});

now, so should I just send the page event myself?

Toxantron commented 8 years ago

@justinsa this looks like we need to elaborate on the whole core/plugin idea. The idea in #149 won't fully cover this, since we have no access to $transition without using $injector. So we can either add this as another if (uiRouterVersion > 1) conditional or find something future proof.

Itrulia commented 8 years ago

I'll just use it like this:

app.run(['$location', '$transitions', 'Analytics', ($location:any, $transitions:any, Analytics:any) => {
    $transitions.onSuccess({}, () => {
        Analytics.trackPage($location.path());
    });
}]);

in the meantime :)

Toxantron commented 8 years ago

Good call. ;)