0.11.0 • Published 9 years ago

gaer v0.11.0

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

npm.io

A CLI for Google Analytics Event Tracking Report.

Build Status

Did you know Google Analytics has a report feature developers can use freely? It's a Event Tracking Report. GAER allows you to store your data object and monitor the data history using Measurement Protocol. In other words, you can send your data to Google Analytics server from CLI tool.

$ gaer -t UA-xxxxx-xx -r reportName path/to/data.json
  Sending [||||||||||||||||||||||||] 100%
  Success: The data is sent to UA-xxxxx-xx

Getting Started

If you don't have Google Analytics account, please create new account. And then, please create new property for using GAER Report in advance.

The JSON data you want to store must be simple object and all value must be numeric, because GARE use key of the object as Event Label and value of the object as Event Value.

// Good :)
{ "foo": 3, "bar": 9, "baz": 3.14 }

// Bad :(
{ "foo": "aaa", "bar": 1, "baz": "bbb" }

// Bad :(
{ "foo": 3, "bar": { "qux": 1 }, "baz": 3.14 }

// Bad :(
{ "foo": 3, "bar": 9, "baz": [0,1,3] }

Event Tracking Parameter

Please see the details below.

EventTypein GARE  
CategoryStringGAER (Fixed)
ActionString--report value
LabelStringobject.key
ValueNumberobject.value

Reports on Google Analytics

You can see the data report you sent from CLI on Behavior > Events menu.

npm.io

As shown below, you can also use the Custom Report for GARE.

npm.io

Install

With npm do:

npm install -g gaer

Usage

  Usage: gaer [options] <JSON>

  Options:

    -h, --help           output usage information
    -V, --version        output the version number
    -t, --tid <ID>       set your Google Analytics Tracking ID
    -r, --report <Name>  set your GA Action report name

CLI Example

Standard way:

gaer --tid UA-xxxxxxx-x --report ReportName path/to/json/file.json

Shortcut way:

gaer -t UA-xxxxxxx-x -r ReportName path/to/json/file.json

Debug mode:

DEBUG=1 gaer -t UA-xxxxxxx-x -r ReportName path/to/json/file.json

Using environment variables:

GA_TID=UA-xxxxxxx-x GA_REPORT=ReportName gaer path/to/json/file.json

Using pipe:

stylestats -f json -n path/to/css/file.css | gaer -t UA-xxxxxxx-x -r ReportName

See also: t32k/stylestats

API Example

You can use the API directly too:

var Gaer = require('gaer');
var gaer = new Gaer('UA-xxxxx-x');
gaer.record('Report Name', 'path/to/data.json');

Limits and Quotas

Please refer to as follows:

0.11.0

9 years ago

0.10.2

9 years ago

0.10.1

9 years ago

0.10.0

9 years ago

0.9.3

9 years ago

0.9.2

9 years ago

0.9.0

9 years ago

0.7.0

9 years ago

0.6.0

9 years ago

0.5.0

9 years ago

0.4.0

9 years ago

0.1.0

9 years ago

0.0.1

9 years ago