• Published 10 years ago

google-analytics v

Weekly downloads
-
License
-
Repository
-
Last release
10 years ago

#analytics.js

##Installation npm install google-analytics

##Usage

var GA = require('google-analytics');
var ga = new GA({urchin: 'UA-XXXXX-X'});
#pageview(
  {
    location: 'http://foobar.baz/a?b#c',
    hostname: 'foobar.baz',
    page: '/a',
    title: 'Baz the Foo in the Bar!'
  }, function(err){
    if(err){
      console.log(err);
    }
  });

##Methods The keys for the event object passed into each function are the Field Name parameters from the Analytics.js Field Reference.

The following methods are supported, the callback is entirely optional. No success or failure message will be passed to it unless the server responds with a non 2XX status code:

#pageview(event, cb)

#appview(event, cb)

#event(event, cb)

#transaction(event, cb)

#item(event, cb)

#social(event, cb)

Note: Social events MUST contain all three social interaction parameters. If they are not provided, an error will be thrown.

#exception(event, cb)

#timing(event, cb)

##Development

git clone https://github.com/toddself/google-analytics
cd google-analytics
npm install

##License & Copyright Copyright (c) 2013 Todd Kennedy, licensed under the MIT License