analytica

1.1.3 • Public • Published

node.analytics

A library to integrate analytics to nodejs applications

Build Status npm License PRs Welcome Semver

Install

Via npm:

npm install --save analytica

API

The module exports methods to:

  • require the core analytics lib
  • require the provided integrations
  • add the desired integration
  • initialize the library
  • track event

Example usage:

Require the core analytics library and the mixpanel integration:

var analytics = require('analytica').core;
var mp = require('analytica').mixpanelIntegration;
analytics.addIntegration(mp);
var options = {token: "<YOUR_TOKEN>"};
analytics.initialize({'Mixpanel': options});

Identify user and track event:

analytics.identify(123, { name: 'testuser', email: 'testemail@test.com', '$distinct_id': 123 },
  function () {
    console.log('done identifying user');
  });

analytics.track('my event', { distinct_id: 123, descr: 'test event' },
  function () {
    console.log('done tracking event');
  });

Support

If you're having any problem, please raise an issue on GitHub

Tests

Run the test suite by doing:

npm test

License

The project is licensed under the Apache 2.0 license.

Readme

Keywords

Package Sidebar

Install

npm i analytica

Weekly Downloads

10

Version

1.1.3

License

Apache-2.0

Unpacked Size

72.3 kB

Total Files

24

Last publish

Collaborators

  • izavits