1.4.1 • Published 8 years ago

meanie-angular-analytics v1.4.1

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

meanie-angular-analytics

npm version node dependencies github issues codacy

An Angular wrapper service for Google Analytics

Meanie

Installation

You can install this package using npm:

npm install meanie-angular-analytics --save

Include the script node_modules/meanie-angular-analytics/release/meanie-angular-analytics.js in your build process, or add it via a <script> tag to your index.html:

<script src="node_modules/meanie-angular-analytics/release/meanie-angular-analytics.js"></script>

Add Analytics.Service as a dependency for your app.

Usage

angular.module('App', [
  'Analytics.Service'
])
.config(function($analyticsProvider, Config) {
  $analyticsProvider.setEnabled(Config.ANALYTICS_ENABLED && Config.ANALYTICS_TRACKING_ID);
})
.run(function($rootScope, $analytics, Config) {

  //Check if enabled
  if ($analytics.isEnabled()) {

    //Create site wide tracker
    $analytics.create(Config.ANALYTICS_TRACKING_ID);

    //On state changes, track page views
    $rootScope.$on('$stateChangeSuccess', function() {
      $analytics.track.pageview();
    });
  }
});

Issues & feature requests

Please report any bugs, issues, suggestions and feature requests in the meanie-angular-analytics issue tracker.

Contributing

Pull requests are welcome! If you would like to contribute to Meanie, please check out the Meanie contributing guidelines.

Credits

License

(MIT License)

Copyright 2016-2017, Adam Reis

1.4.1

8 years ago

1.4.0

8 years ago

1.3.1

9 years ago

1.3.0

9 years ago

1.2.0

9 years ago

1.1.4

9 years ago

1.1.3

9 years ago

1.1.2

10 years ago

1.0.2

10 years ago

1.0.0

10 years ago