revolunet / angular-google-analytics

Google Analytics tracking for your AngularJS apps
MIT License
653 stars 179 forks source link

@uirouter/angularjs #217

Open DarkIsDude opened 6 years ago

DarkIsDude commented 6 years ago

Hi all,

With the new version of angular-ui router, we can't now use your trick. Here what I do:

app.run(['Analytics', '$transitions', '$location', function(Analytics, $transitions, $location) {
    $transitions.onSuccess({}, function(transition) {
        Analytics.trackPage($location.path());
    });
}]);

Is it ok?

How you track params in URL: example => http://localhost:3000/acheter?size=12&page=1&type=false&unused=false&occasion=false&new=false&promotion=false

You send it with Analytics.trackPage($location.url());?

chunkydigits commented 6 years ago

having the same problem as we've just updated the version of ui router. Seems like it would be good to have a new version to accommodate transition hooks in the setPageEvent method.

Sparksx commented 6 years ago

Hi,

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

DarkIsDude commented 6 years ago

@Sparksx thanks, I see it :). I don't want use the legacy solution, it's deprecated but I want to know if my solution is clean :).