Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

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

License

Notifications You must be signed in to change notification settings

FindHotel/analytics-node

 
 

Repository files navigation

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.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%