FindHotel / analytics-node

The hassle-free way to integrate analytics into any node application.

Home Page:https://segment.com/libraries/node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

analytics-node CircleCI

A Node.js client for Segment — The hassle-free way to integrate analytics into any application.

Installation

$ npm install analytics-node

Usage

const Analytics = require('analytics-node');

const client = new Analytics('write key');

client.track({
  event: 'event name',
  userId: 'user id'
});

Sending events via Kinesis (KPL)

For sending events via kinesis you need to set the flushMethod option as kinesis and the host option with the name of your stream.

And if you need to authenticate on code level, you can send an object with your aws credentials on the first parameter (you can send an empty object if don't need it).

Example:

const Analytics = require('analytics-node');

const awsCredentials = {
  accessKeyId: 'xxx',
  secretAccessKey: 'xxxx'
};

const client = new Analytics(awsCredentials, {
  host: 'MyStramName',
  flushMethod: 'kinesis'
});

Documentation

Documentation is available at https://segment.com/libraries/node.

License

Copyright © 2017 Segment Inc. <friends@segment.com>

About

The hassle-free way to integrate analytics into any node application.

https://segment.com/libraries/node

License:MIT License


Languages

Language:JavaScript 100.0%