dplus nodejs sdk
dplus nodejs sdk is a simple server side package for track data from nodejs environment; it doesn't depend any other npm package ;All functions is based on the nodejs initial apis;
First, install dpuls
as a development dependency:
npm install --save-dev dplus
Then, require it to your code,and init it with token
var Dplus = require("dplus");
var dplus = Dplus.init("YOUR TOKEN");
Then, you can use dplus
object to track any events as you want;
dplus.track("user_login",{
distinct_id:"some unique client id",
name : "example name"
});
dplus.track("video_start");
dplus.track("get_access",function(err, result){
if(err){
throw err
}else{
do(result)
}
});
- the first parameter is the name of event (NOT NULL)
- the second parameter is the properties you want to sent with this event (NULL)
- the third parameter is a callback, it's called when the track is done;