Angularjs and Google Analytics Integration

I am using AnguleJS UI Router and revolunet / angular -google-analytics https://github.com/revolunet/angular-google-analytics

Here is my configuration:

.config(function(AnalyticsProvider) { // initial configuration AnalyticsProvider.setAccount('UA-XXXXXXX-X'); // track all routes/states (or not) AnalyticsProvider.trackPages(true); // Use analytics.js instead of ga.js AnalyticsProvider.useAnalytics(true); // change page event name AnalyticsProvider.setPageEvent('$stateChangeSuccess'); })) 

Are there any other steps now? I have NOT modified any states / controllers to include any analytics code, is there anything else? And what does the following comment mean? I think the inclusion of "trackPages" is enough, am I right?

 .run(function(Analytics) { // In case you are relying on automatic page tracking, you need to inject Analytics // at least once in your application (for example in the main run() block) }) 
+7
angularjs google-analytics
source share
1 answer

Official answer from @revolunet https://github.com/revolunet/angular-google-analytics/issues/35

You can check if this works in the Chrome console. check calls google. (through the image I think)

In Google Analytics, you need to enter it manually at least once somewhere in your application. (the work block is a good place), so it can be created by angular.

+3
source share

All Articles