This repository has been archived by the owner on May 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
[![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": "[email protected]"}); | ||
} | ||
|
||
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"}); | ||
} |