From 2d52c580626a1a06b4214c8718963e9865ffd279 Mon Sep 17 00:00:00 2001 From: Andrew Waite Date: Tue, 1 Sep 2015 17:28:04 +0100 Subject: [PATCH] Updated readme. --- README.md | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index aa233d8..7d8c5f4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,44 @@ -# Simple node kissmetrics library +# Simple node KISSmetrics library + +Simple wrapper for KISSmetrics client library written in ES6. [![Build Status](https://travis-ci.org/silktide/simple-node-kissmetrics.svg?branch=master)](https://travis-ci.org/silktide/simple-node-kissmetrics) -[![Code Climate](https://codeclimate.com/repos/55df319a69568066780016d6/badges/d2a8873373061fa5face/gpa.svg)](https://codeclimate.com/repos/55df319a69568066780016d6/feed) \ No newline at end of file +[![Code Climate](https://codeclimate.com/repos/55df319a69568066780016d6/badges/d2a8873373061fa5face/gpa.svg)](https://codeclimate.com/repos/55df319a69568066780016d6/feed) +[![Test Coverage](https://codeclimate.com/repos/55df319a69568066780016d6/badges/d2a8873373061fa5face/coverage.svg)](https://codeclimate.com/repos/55df319a69568066780016d6/coverage) + +## 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"}); + } \ No newline at end of file