1.2.2 • Published 10 years ago

lytic v1.2.2

Weekly downloads
40
License
-
Repository
-
Last release
10 years ago

Generic analytics tracking wrapper

Current builtin services:

  • mixpanel

Usage

var tracking = require('lytic');
require('tracking/services/mixpanel').configure({
    key: "<your mixpanel key>";
});

tracking.identify("user-id", {
    name: "Phil"
});

tracking.track("played a video", {
    //optional data
    startTime: 0,
    endTime: 120
});

Adding services

Services should call tracking._addTracker(name, config) to register themselves. You can either add services here, or application specific ones.

//my-custom-tracker.js

var tracking = require('lytic'); //make relative if actually including in this repo

module.exports.configure = function (config) {
    //Export as a configure method for consistency

    var identify = function (userId, userData) {
        //identify will receive a userId, and a userData object

        //do something with the data
    };

    var track = function (event, data) {
        //track will receive an event name, and data object (may be empty if not provided
    };

    //Register the tracker
    tracking._addTracker('my-tracker', {
        identify: identify,
        track: track
    });
};

Your application will then use it like so:

var tracking = require('lytic');
var custom = require('./my-custom-tracker');
custom.configure({
    configItem: 'stuff'
});

tracking.track('event name', {
    //data
});
1.2.2

10 years ago

1.2.1

10 years ago

1.2.0

10 years ago

1.1.1

10 years ago

1.1.0

11 years ago

1.0.1

11 years ago

1.0.0

11 years ago

0.3.0

11 years ago

0.2.0

11 years ago

0.1.0

11 years ago