Giter VIP home page Giter VIP logo

meteor-ganalytics's Introduction

GAnalytics: Google Analytics for Meteor

Log page views and events to Google Analytics.

NOTE: This package uses the newer analytics.js file for "Universal Analytics". This package will not work if you are not on the newer collection system.

Installing

mrt add GAnalytics

If you don't have a settings.json file, you need to add one and load it according to the Meteor documentation. http://docs.meteor.com/#meteor_settings

In settings.json add

{
  "public" : {
    "ga": {
      "account":"UA-XXXXXXX-Y"
    }
  }
}

Usage

Example router code to log pageviews for routes:

Meteor.Router.add({
  '/': function() {
    GAnalytics.pageview();
    return 'home';}
})

In your controller code:

GAnalytics.pageview();
GAnalytics.pageview("/hello");


GAnalytics.event("account","signin");
GAnalytics.event("account","signin","DataRiot");
GAnalytics.event("account","signin","DataRiot", 2);

Cookie Options & advanced features

You can also provide options for the Google Analytics cookie:

{
  "public" : {
    "ga": {
      "account":"UA-XXXXXXX-Y",
      "cookieName": "new_cookie_name",
      "cookieDomain": "mynew.domain.com",
      "cookieExpires": 60 * 60 * 24 * 28,  // Time in seconds.
      "trackInterests": true,  // Enable also GA website and
      "trackInPage": true      // force/ignore the Google check.
    }
  }
}

meteor-ganalytics's People

Contributors

sachag avatar datariot avatar grigio avatar

Watchers

George Diab 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.