🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

@hackler/javascript-sdk

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hackler/javascript-sdk

JavaScript SDK For Hackle

11.44.0
latest
81

Supply Chain Security

100

Vulnerability

88

Quality

94

Maintenance

100

License

Version published
Weekly downloads
2.2K
21.9%
Maintainers
1
Weekly downloads
 
Created

Hackle JavaScript SDK

Install

npm install @hackler/javascript-sdk --save
yarn add @hackler/javascript-sdk

Usage

Install & Decide the variation

const http = require("http");
const Hackle = require("@hackler/javascript-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);

FAQs

Package last updated on 09 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts