Skip to content

A minimal, offline-friendly Google Analytics Measurement Protocol client for tracking usage statistics in shell and javascript applications.

License

Notifications You must be signed in to change notification settings

75lb/usage-stats-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

view on npm npm module downloads Build Status Coverage Status Dependency Status js-standard-style

usage-stats-cli

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.

Synopsis

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

Protocol Parameters

See here for the full list of Google Analytics Measurement Protocol parameters.

Sent by default

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)

CLI Reference

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.

About

A minimal, offline-friendly Google Analytics Measurement Protocol client for tracking usage statistics in shell and javascript applications.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published