Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Server-side google analytics collection for node.js
JavaScript
branch: master
Failed to load latest commit information.
lib Trailing whitespace
tests
.gitignore Starting up the googalytics module!
AUTHORS Update license holder and add authors file
CHANGELOG Update changelog. Version bump
LICENSE Update license holder and add authors file
Readme.md
package.json Update license holder and add authors file

Readme.md

Nodealytics

(Formerly Googalytics)

Simple node module to send custom server-side events to Google Analytics

Heavily influenced by the Gabba project from the guys at the Hybrid Group (http://github.com/hybridgroup/gabba)

Usage

npm install nodealytics

// initialize
var NA = require("nodealytics");
NA.initialize('UA-12345678-1', 'someplace.com', function () {
  //MORE GOOGLE ANALYTICS CODE HERE
});

Examples

Track Page

NA.trackPage('Page Title', '/page/path', function (err, resp) {
  if (!err && resp.statusCode === 200) {
    console.log('Page has been tracked with Google Analytics');
  }
});

Track Page with Referal

NA.trackPage('Page Title', '/page/path', {utmr:"http://www.google.com"}, function (err, resp) {
  if (!err && resp.statusCode === 200) {
    console.log('Page has been tracked with Google Analytics');
  }
});

Track Event

NA.trackEvent('test event', 'boom', function (err, resp) {
  if (!err && resp.statusCode === 200) {
    console.log('Event has been tracked with Google Analytics');
  }
});

Set Proxy

NA.setProxy('http://your.proxy.com', 'title', function (err, resp) {
  NA.trackEvent(...);
});

What do those variables mean?!

The answers, as per usual, can be learned from the Google: https://developers.google.com/analytics/resources/articles/gaTrackingTroubleshooting#gifParameters

Something went wrong with that request. Please try again.