A minimal, offline-friendly Google Analytics Measurement Protocol client for tracking usage statistics in shell and javascript applications.
This is a low-level API client, it doesn't hold any opinion of how usage tracking should be done. If you're looking for a convention which leverages the power and flexibility of Custom Metrics and Dimensions, take a look at app-usage-stats.
Tracking statistics in shell scripts:
# Track an event: category 'Backup', action 'start'
usage-stats event --tid UA-98765432-1 --ec Backup --ea start
# Perform the backup
cp files/** backup/
# Track an event: category 'Backup', action 'complete'
usage-stats event --tid UA-98765432-1 --ec Backup --ea complete
See here for the full list of Google Analytics Measurement Protocol parameters.
All parameters are send on demand, beside this list.
- Operating System version (sent in the UserAgent)
- Client ID (a random UUID, generated once per OS user and stored)
- Language (
process.env.LANG
, if set) - Screen resolution (terminal rows by columns, by default)
To install the command line client:
$ npm install -g usage-stats-cli
Running the tool with no arguments will print the usage guide:
usage-stats
A minimal, offline-friendly Google Analytics Measurement Protocol client for
tracking usage statistics in shell and javascript applications.
Synopsis
$ usage-stats <command> <command-options>
$ usage-stats <command> --help
Commands
screenview Track a screenview
event Track an event
exception Track an exception
© 2016-17 Lloyd Brookes <75pound@gmail.com>. Documented by jsdoc-to-markdown.