Search code examples
javascriptangularjsgoogle-analyticsangulartics

Google Analytics in AngularJS


I have a AngularJS v1.0.7 web application. I have just integrate Google Analytics by adding the javascript tracking code. However, I don´t see anything interesting in Google Analytics reports and so on. I know, right now there is people visiting my site and I don´t see anything in GA.

I have just copied and pasted the js script tracking code provided by Google at the end of my head section in the main page. As, it is a template, I assume is inserted in all pages, so I don´t need to copy the script to every page, right? Am I doing something wrong? Is there any way to check GA is correctly installed and gathering data?

Moreover, I have inserted the js tracking code provided by Google, but I have seen there is Angulartics library. Should I use this directive instead of the Google script? Is there any additional benefits?


Solution

  • The pages in an angular app don't actually reload like traditional web apps and because of that the GA code most likely isn't firing. I recommend using Angulartics instead of the normal GA code.

    I can't help ya on the directive question because I don't really know Angular but I work in analytics and have had that problem with Angular apps.