{"name":"active-user","version":"0.0.1","description":"Easily track daily, weekly, and monthly active users with Redis.","main":"lib/active-user.js","scripts":{"test":"node_modules/.bin/mocha test/*.test.js"},"repository":{"type":"git","url":"https://github.com/iancmyers/active-user.git"},"author":{"name":"Ian Christian Myers","email":"ian@iancmyers.com"},"license":"MIT","devDependencies":{"mocha":"~1.14.0","expect.js":"~0.2.0"},"dependencies":{"bigint":"~0.4.2","moment":"~2.4.0","redis":"~0.9.0","hiredis":"~0.1.15","underscore":"~1.5.2","async":"~0.2.9"},"readme":"# Active User\n\nThe `active-user` modules allows you to quickly track daily, weekly, and monthly active users in Redis.\n\n## Installing and Getting Started\n\nYou can install the `active-user` module via npm. You will also need to have a [Redis server](http://redis.io) instance running.\n\n```bash\nnpm install active-user\n```\n\nOnce `active-user` is installed we need a client:\n\n```js\nvar activeUser = require('active-user');\n\nvar activity = activeUser.createClient(REDIS_PORT, REDIS_HOST, REDIS_OPTIONS);\n```\n\n## Tracking\n\n###activity.track(id, [action]);\n\nTracking is a very simple operation:\n\n```js\nactivity.track(10, 'commented');\nactivity.track(1);\n```\n\nWhere the **id** is the id of the user you want to track and the action is the action they performed.\n\n###activity.untrack(id, [action]);\n\nYou may also undo a tracked action for a user with `untrack`:\n\n```js\nactivity.untrack(10, 'commented');\nactivity.untrack(1);\n```\n\n## Reporting\n\nYou can fetch the daily, weekly, and monthly active users easily:\n\n###activity.daily([action], [date], callback);\n\n```js\n// Fetching the number of users who commented on Nov 21, 2013\nactivity.daily('commented', '2013-11-21', function (err, num) {\n  console.log(num);\n});\n\n// Fetching the number of daily active users for the current day\nactivity.daily(function (err, num) {\n  console.log(num);\n});\n```\n\n###activity.weekly([action], [date], callback);\n\n```js\n// Fetching the number of users who commented the week containing Nov 21, 2013\nactivity.weekly('commented', '2013-11-21', function (err, num) {\n  console.log(num);\n});\n\n// Fetching the number of daily active users for the current week\nactivity.weekly(function (err, num) {\n  console.log(num);\n});\n```\n\n###activity.monthly([action], [date], callback);\n\n```js\n// Fetching the number of users who commented the month of Nov 2013\nactivity.monthly('commented', '2013-11', function (err, num) {\n  console.log(num);\n});\n\n// Fetching the number of daily active users for the current month\nactivity.monthly(function (err, num) {\n  console.log(num);\n});\n```\n","readmeFilename":"README.md","_id":"active-user@0.0.1","dist":{"shasum":"d8b7908459d92f0c03a1de7d06f44f808db682ad","tarball":"https://registry.npmjs.org/active-user/-/active-user-0.0.1.tgz","integrity":"sha512-ESQE9//o0tbJ71SJy80ddLnj3N9MxWAWttlAFN5kmx5gOQoPAPT/M+BIDyLMIR3ctDpMKHGLfbot6x14u/Hs3g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCMxvnGImU8pUERJ5swIogReLsUrczD00MgPztICVsbaAIhAPUVHz8SZSDZMeRb0z0iA5/2M2BPx+FIzXwxXmYWaC83"}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"iancmyers","email":"ian@iancmyers.com"},"maintainers":[{"name":"iancmyers","email":"ian@iancmyers.com"}]}