Google Analytics plugin for Angulartics
Switch branches/tags
Nothing to show
Clone or download
Latest commit 8593282 Feb 26, 2018


NPM version NPM downloads Bower version Dependencies status MIT license Join the Slack chat Build Status

Google Analytics plugin for Angulartics.


First make sure you've read installation and setup instructions for Angulartics.

Then you can install this package either with npm or with bower.


npm install angulartics-google-analytics

Then add as a dependency for your app:


angular.module('myApp', [

Please note that core Angulartics doesn't export the name yet, but it will once we move it into the new organization.


bower install angulartics-google-analytics

Add the <script> to your index.html:

<script src="/bower_components/angulartics-google-analytics/dist/angulartics-ga.min.js"></script>

Then add as a dependency for your app:

angular.module('myApp', [

Changes in the Google Analytics snippet

The snippet code provided by Google Analytics does an automatic pageview hit, but this is already done by Angulartics (unless you disable it) so make sure to delete the tracking line:

      ga('create', 'UA-XXXXXXXX-X', 'none'); // 'none' while you are working on localhost
      ga('send', 'pageview');  // DELETE THIS LINE!

Done. Open your app, browse across the different routes and check the realtime GA dashboard to see the hits.


Documentation is available on the Angulartics site.


Module settings are done via the $ property. The following are GA-specific properties:

  • transport (Default: undefined) - sets the transport property for the ga function call. See the GA Transport Documentation for more information how to properly set this value. This should be a string.


npm run build