Application tracking for the client and the server
Last updated 4 years ago by makesites .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install apptrack 
SYNC missed versions from official npm registry.


Application tracking that simplifies the process of gathering analytics and avoids convoluted conventions.

The logic is minimal, lightweight, yet can work both on the server and the client, with asynchronous syncing of the client data.


  • Client-side integration
  • Asynchronous data gathering
  • Multiple DB stores supported
  • Optional Connect middleware


To run the examples go to the dir and execute the server script

$ cd [repo]/examples/[folder]/
$ node server.js


  • Connect
  • Underscore


Using npm

node install apptrack


When Apptrack is initiated you can pass the selected store, among other options:

Apptrack = require("apptrack");

var apptrack = new Apptrack({ store : "redis", db: db });

The library can operate independently but optionally can be connected to the server using a middleware

// middleware
app.use( apptrack.connect() );

Apptrack automatically serves the client-side javascript from the client route (mentioned in the options below) which, when included in a web page, will create an object named at in the global namespace.



  • host (default: ""), the Apptrack host, if serving the tracking from a separate domain
  • domains (default: []), list of accepted domains, that can submit tracking data (host is automatically added)
  • store (default: "memory"), options: memory, redis, mongodb, simpledb
  • db (default: false), db where tokens are stored


  • checkin boolean (default: false), automatically register events for unique visitors and views


A top level option that may contain the following sub-options:

  • client (default:"/apptrack.js"), the location where the client-side js is output
  • input (default: "/log"), the path that is receiving the client-side data...
  • output (default: false), an endpoint to output the latest data (by default disabled)


Below are the public methods that are provided for interfacing with the library:


  • at( options ) Initiator for the client, this method is required before any other method can be used.
  • at.log( action, params ) Record an event with an action label and parameters
  • at.sync() Sending data to the server; usually triggered in intervals automatically, we may want to force syncing on occassion (ex. when exiting the website)
  • at.session( data ) Optionally defining a user session of relevant data (ex. email, id etc.)


  • apptrack.log( action, params ) Record an event with an action label and data parameters
  • apptrack.output() Return all the (recent) data saved
  • apptrack.valid( url ) Validate a URL (referer) agains the domains list and host


To track any event, load Apptrack on the server and optionally include the client-side JavaScipt (default: /apptrack.js) in the HTML page. You can call the method log available from both ends of the application stack, with a keyword for the action and any parameters attached to it.

.log(action, params);


An action can be any arbitrary string, but you should treat is as an identifier label. To be able to group events you should use the same action keyword.


The library does not try to define the structure of the parameters - it is left schema-less for simplicity, allowing the developer to send arbitrary data along with any action.

In addition to the above, Apptrack also stores if provided:


An object defining user data (ex. email, id etc.) to identify the source of the log


Request headers passed during the log event. This is mostly to record authenticity data and other metadata (ex. browser, location etc.)


Initiated by Makis Tracend ( @tracend )

Distributed through


Inspired by the analytics app by @srivastavarobin


Released under the Apache license, version 2.0

Current Tags

  • 0.6.5                                ...           latest (4 years ago)

12 Versions

  • 0.6.5                                ...           4 years ago
  • 0.6.0                                ...           4 years ago
  • 0.5.3                                ...           5 years ago
  • 0.5.2                                ...           5 years ago
  • 0.5.1                                ...           5 years ago
  • 0.5.0                                ...           5 years ago
  • 0.4.0                                ...           5 years ago
  • 0.3.5                                ...           5 years ago
  • 0.3.0                                ...           5 years ago
  • 0.2.0                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
  • 0.0.1                                ...           7 years ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (4)
Dev Dependencies (0)
Dependents (0)

Copyright 2014 - 2016 © |