mparticle

1.0.8 • Public • Published

mParticle Node SDK

This is the mParticle Node SDK - use it to send your data to the mParticle platform and off to 100+ data services.

Requirements

Node JS 4.2.2 or later.

Installation

npm install mparticle

Usage

var mParticle = require('mparticle');

var api = new mParticle.EventsApi(new mParticle.Configuration(
    'REPLACE WITH API KEY', 
    'REPLACE WITH API SECRET'));

var batch = new mParticle.Batch(mParticle.Batch.Environment.development);

batch.user_identities = new mParticle.UserIdentities();
batch.user_identities.customerid = '123456' // identify the user (required)

batch.user_attributes = {'hair color': 'brown'}

var event = new mParticle.AppEvent(mParticle.AppEvent.CustomEventType.navigation, 
  'Hello World');

batch.addEvent(event);

var body = [batch]; // {[Batch]} Up to 100 Batch objects

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};

api.bulkUploadEvents(body, callback);

// or upload a single batch
//api.uploadEvents(body, batch) 

License

Apache License 2.0

/mparticle/

    Package Sidebar

    Install

    npm i mparticle

    Weekly Downloads

    1,710

    Version

    1.0.8

    License

    Apache-2.0

    Unpacked Size

    304 kB

    Total Files

    124

    Last publish

    Collaborators

    • mparticle-teamcity
    • samdozor
    • rmi22186
    • peterjenkins
    • danhendrix
    • tbreffni
    • alexs-mparticle
    • willpassidomo
    • bstalnaker
    • mparticle-ci