Created
January 19, 2016 07:38
-
-
Save rheajt/2d2d199dff4a72e18be5 to your computer and use it in GitHub Desktop.
google analytics with angularjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Comment out the last line of the analytics code that is given by Google. | |
* This code triggers on page views in angular | |
*/ | |
app.run(['$rootScope', '$location', '$window', function($rootScope, $location, $window) { | |
$rootScope.$on('$routeChangeSuccess', function() { | |
$window.ga('send', 'pageview', {page: $location.url()}); | |
}); | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment