I’m setting up a new app using AngularJS as the frontend. Everything on the client side is done with HTML5 pushstate and I’d like to be able to track my page views in Google Analytics.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you’re using
ng-viewin your Angular app you can listen for the$viewContentLoadedevent and push a tracking event to Google Analytics.Assuming you’ve set up your tracking code in your main index.html file with a name of
var _gaqand MyCtrl is what you’ve defined in theng-controllerdirective.UPDATE:
for new version of google-analytics use this one