Skip to content

method-inc/nodealytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Server-side google analytics collection for node.js

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors