node package manager


A minimal wrapper for the StatHat EZ API

Top Hat

Top Hat is a minimal wrapper for the StatHat EZ API.

npm install tophat
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('', 100); // Record 100 active users
  • key: StatHat EZ key, found on the Settings page
  • options: optional options object with the following keys
    • prefix: prefix for stat name
    • ssl: boolean specifying transport, defaults to true
  • name: Stat name
  • count: Optional count, defaults to 1
  • cb: Optional callback function
  • name: Stat name
  • value: Stat value
  • cb: Optional callback function