0.11.0 • Public • Published

    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.

    Event Type in GARE
    Category String GAER (Fixed)
    Action String --report value
    Label String object.key
    Value Number object.value

    Reports on Google Analytics

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

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


    With npm do:

    npm install -g gaer


      Usage: gaer [options] <JSON>
        -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:


    npm i gaer

    DownloadsWeekly Downloads






    Last publish


    • t32k