simple-node-kissmetrics

1.1.0 • Public • Published

Simple node KISSmetrics library

Build Status Code Climate Test Coverage

A simple wrapper for KISSmetrics client library written in ES6.

  • Loads KISSmetrics tracking JavaScript library.
  • Exposes a convenient interface for:
    • Setting your KISSmetrics API key.
    • Setting user properties.
    • Tracking events.

Usage example

First, install the library.

npm install simple-node-kissmetrics --save

Using is as simple as importing the library and calling a couple of functions.

import kissmetrics from 'simple-node-kissmetrics';

function setupMyApp() {
    // Must be called first to set the key for the library.  This only needs to be called once to initialise the library.
    kissmetrics.setKey(YOUR_API_KEY);
}

function trackSomething() {        
    // Track an event.
    kissmetrics.trackEvent("An event", {"property": "value"});
}

function setUserProperty() {
    // Track some user properties.
    kissmetrics.setUserProperties({"email": "user@xyz.com"});
}

You can also import specific functions if you prefer.

import { setup as setupAnalytics, trackEvent } from 'simple-node-kissmetrics';

function setupMyApp() {
    setupAnalytics();
}

function trackSomething() {
    trackEvent("An event", {"property": "value"});
}

Readme

Keywords

Package Sidebar

Install

npm i simple-node-kissmetrics

Weekly Downloads

375

Version

1.1.0

License

MIT

Last publish

Collaborators

  • theandywaite