SDK For Data Streaming

React

3min
install the sdk with npm npm install save @deerden/qualeticssdk; when the sdk has been installed it needs to be initialized with following code const qualetics = require("@deerden/qualeticssdk"); const qualetics = new qualetics service("your application id", "your application secret", "client id"); qualetics init(); the initialized sdk can be then used to track events sending events after the tracker has been initialized you can start sending events data format in the event should be {{ "actor" { "type" "user", // required "id" "js1234", // optional, id of the user "attributes" { //optional, key value pairs that can provide more data about the actor "name" "john doe", "age" "31", "address" { "street" "test street 1", "zip" "50100" } } }, "action" { "type" "new user", // required "attributes" { // optional, key value pairs that can provide more data about the action "referrer" "facebook", "coupon" "kihsk123fs" } }, "context" { "type" "course", // require "id" "12321123", // optional, identifier for the context "attributes" { // optional, key value pairs that can provide more data about the context "speaker" "jane doe" } }, "object" { // optional "type" "object", "name" "12321123", "attributes" { "speaker" "jane doe" } } } events can be sent either by sending the complete json object qualetics send({ "actor" { "type" "user", "id" "js1234" }, "action" { "type" "buttonclick" }, "context" { "type" "button", "name" "button1" }, "object" { "type" "object", "name" "object1" } }); or using the builder message builder let message = qualetics createmessage(); message setaction({ type "buttonclick" }) setactor({ type "user", id "js1234" }) setcontext({ type "button", name "button2" }) setobject({ name "object", type "objecttype", attributes { something "else" } }) send();