Setting Up Analytics for Single Page Applications
Aamna Khan
1214

Thanks for the article Aamna Khan. I tried but didn’t get the GTM trigger to fire. I would’ve liked to have kept all analytics event directives in GTM, but wrote the following in the app controller to get those page views.
$rootScope.$on(‘$stateChangeSuccess’, function() {
 $window.ga(‘set’, ‘page’, $location.path());
 $window.ga(‘send’, ‘pageview’);
});

Thanks again!

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.