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

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

Open Itrulia opened this issue 8 years ago • 3 comments

$stateChangeSuccess doesnt exists anymore, but rather you will use

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

});

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

Itrulia avatar Apr 16 '16 10:04 Itrulia

@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.

Toxantron avatar Apr 16 '16 10:04 Toxantron

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 :)

Itrulia avatar Apr 16 '16 11:04 Itrulia

Good call. ;)

Toxantron avatar Apr 16 '16 11:04 Toxantron