Code Monkey home page Code Monkey logo

angulartics-google-analytics's Introduction

angulartics-google-analytics

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

Google Analytics plugin for Angulartics.

Install

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

npm install angulartics-google-analytics

Then add angulartics.google.analytics as a dependency for your app:

require('angulartics')

angular.module('myApp', [
  'angulartics',
  require('angulartics-google-analytics')
]);

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

bower

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 angulartics.google.analytics as a dependency for your app:

angular.module('myApp', [
  'angulartics',
  'angulartics.google.analytics'
]);

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!
    </script>

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

Documentation

Documentation is available on the Angulartics site.

Settings

Module settings are done via the $analyticsProvider.settings.ga 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.

Development

npm run build

License

MIT

angulartics-google-analytics's People

Contributors

artberri avatar danwilkerson avatar dciccale avatar emeegeemee avatar harshapat avatar icfantv avatar luisfarzati avatar lunks avatar malixsys avatar mdarveau avatar morvans avatar odedniv avatar plpeeters avatar robert-senexx avatar sweetkat avatar techgaun avatar timelf123 avatar vgavro avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.