A server interface for Google's analytics.js
A backend interface for the new version of Google Analytics, analytics.js, allowing you to proxy your events from your server rather than load the analytics code directly into the browser.
npm install ga-collect
var GA = require'ga-collect';var ga = urchin: 'UA-XXXXX-X';#pageviewlocation: ''hostname: 'foobar.baz'page: '/a'title: 'Baz the Foo in the Bar!'iferrconsole.logerr;;
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:
Note: Social events MUST contain all three social interaction parameters. If they are not provided, an error will be thrown.
git clonecd ga-collectnpm install
Copyright (c) 2013 Todd Kennedy, licensed under the MIT License