This app demonstrates how to track and record pageview events in an Angular (SPA) application.
- View the Medium article at Using Google Analytics with Angular
- Angular
- Google Analytics
-
Setup up a Google Analytics account.
-
Clone this repo:
git clone https://github.com/philipszdavido/google-analytics-with-angular.git -
Move into the
google-analytics-with-angulardirectory from the terminal:cd google-analytics-with-angular -
Install the dependencies:
npm install -
Open
index.htmlin your editor, and change theUA-109919601-1code to yours. -
Run the app:
ng serve -
Navigate to
localhost:4200in your browser. -
Click on the links
routeOnerouteTwoand the buttonClick Meto see Google Analytics record the events.
Why not star the github repo? The attention would be appreciated! How about sharing the link for this repo on Twitter?
Dont forget to follow me on Twitter!
Thanks! Chidume Nnamdi