Created
November 28, 2014 15:12
-
-
Save kanakiyajay/7865540b72f9eda31517 to your computer and use it in GitHub Desktop.
Tracking Google Analytics in Angular js Apps
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
MyApp.run(function($rootScope, $location, $routeParams, $window){ | |
$rootScope.$on('$routeChangeSuccess', function() { | |
var output=$location.path()+"?"; | |
angular.forEach($routeParams,function(value,key){ | |
output+=key+"="+value+"&"; | |
}) | |
output=output.substr(0,output.length-1); | |
$window._gaq.push(['_trackPageView', output]); | |
}); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment