@hackler/hackle-sdk
TypeScript icon, indicating that this package has built-in type declarations

3.5.0 • Public • Published

#Hackle JavaScript SDK(Node.js)

Install

npm install @hackler/hackle-sdk --save

Usage

Install & Decide the variation

const http = require("http");
const Hackle = require("@hackler/hackle-sdk");

const hackleClient = Hackle.createInstance("YOUR_SDK_KEY");

http.createServer((req, res) => {
    const user = {
      id: USER_ID
    }   
    const variation = hackleClient.variation(AB_TEST_KEY, user);
    
    if (variation === "A") {
      // AS-IS Code
    } else if (variation === "B") {
      // TO-BE Code
    }

    res.end(`Hello ${variation}!`)
}).listen(8080)

Records the event

hackleClient.track(EVENT_KEY, user);

or

const event = {
  key: EVENT_KEY,
  value: 5000,
  properties: {
    app_version: "1.0.0",
    first_paying: false,
    item_count: 5
  }
}
hackleClient.track(event, user);

Readme

Keywords

Package Sidebar

Install

npm i @hackler/hackle-sdk

Homepage

hackle.io/

Weekly Downloads

44

Version

3.5.0

License

ISC

Unpacked Size

734 kB

Total Files

18

Last publish

Collaborators

  • hackler