tophat
v1.0.3
Published
A minimal wrapper for the StatHat EZ API
Downloads
6
Readme
Top Hat
Top Hat is a minimal wrapper for the StatHat EZ API.
Installation
npm install tophat
Example
var tophat = require('tophat'),
stats = new tophat('EZ_KEY');
stats.count('login.success'); // Count 1 successful login
stats.count('login.failed', 2); // Count 2 failed logins
stats.value('users.active', 100); // Record 100 active users
Constructor options
key
: StatHat EZ key, found on the Settings pageoptions
: optional options object with the following keysprefix
: prefix for stat namessl
: boolean specifying transport, defaults totrue
Methods
.count(name, count, cb)
name
: Stat namecount
: Optional count, defaults to1
cb
: Optional callback function
.value(name, value, cb)
name
: Stat namevalue
: Stat valuecb
: Optional callback function