Skip to content

Latest commit

 

History

History
45 lines (35 loc) · 958 Bytes

README.md

File metadata and controls

45 lines (35 loc) · 958 Bytes

amplitude

Server side implimentation of Amplitude's http api.

Install

npm install amplitude --save

Initialization

var Amplitude = require('amplitude');
// Initialize with user id
var amplitude = new Amplitude('api-token', { user_id: 'some-user-id' });
// Or initialize with device id
var amplitude = new Amplitude('api-token', { device_id: 'some-device-id' });

Track an event

Pass in any keys listed on the Amplitude http api. The only required key is event_type.

var data = {
  event_type: "some value", // required
  event_properties: { 
    //... 
  },
  user_properties: { 
    //... 
  }
}
amplitude.track(data);

Track an event with an optional callback

amplitude.track(data, function(error) {
  // If post was succesful, error will be null
  //... do something
});