Server side implimentation of Amplitude's http api.
npm install amplitude --save
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' });
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);
amplitude.track(data, function(error) {
// If post was succesful, error will be null
//... do something
});