Skip to content

Instantly share code, notes, and snippets.

@Grom-S
Created October 28, 2014 09:25
Show Gist options
  • Save Grom-S/5f2f9458c3f7e30cbaa0 to your computer and use it in GitHub Desktop.
Save Grom-S/5f2f9458c3f7e30cbaa0 to your computer and use it in GitHub Desktop.
Google analytics in Angular SPA
angular.module('main').run(function ($rootScope, $location, $window) {
$rootScope.$on('$routeChangeSuccess', function () {
var path = $location.path();
$window.ga('send', 'pageview', {page: path});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment