node package manager


Easily track daily, weekly, and monthly active users with Redis.

Active User

The active-user modules allows you to quickly track daily, weekly, and monthly active users in Redis.

You can install the active-user module via npm. You will also need to have a Redis server instance running.

npm install active-user

Once active-user is installed we need a client:

var activeUser = require('active-user');
var activity = activeUser.createClient(REDIS_PORT, REDIS_HOST, REDIS_OPTIONS);

Tracking is a very simple operation:

activity.track(10, 'commented');

Where the id is the id of the user you want to track and the action is the action they performed.

You may also undo a tracked action for a user with untrack:

activity.untrack(10, 'commented');

You can fetch the daily, weekly, and monthly active users easily:

// Fetching the number of users who commented on Nov 21, 2013 
activity.daily('commented', '2013-11-21', function (errnum) {
// Fetching the number of daily active users for the current day 
activity.daily(function (errnum) {
// Fetching the number of users who commented the week containing Nov 21, 2013 
activity.weekly('commented', '2013-11-21', function (errnum) {
// Fetching the number of daily active users for the current week 
activity.weekly(function (errnum) {
// Fetching the number of users who commented the month of Nov 2013 
activity.monthly('commented', '2013-11', function (errnum) {
// Fetching the number of daily active users for the current month 
activity.monthly(function (errnum) {