Package detail

@hackler/js-client-sdk

hackle-io225ISC3.5.0

JavaScript Client(Web Browser) SDK

hackle, sdk, abtest

readme

Hackle JavaScript Client(Web Browser) SDK

Install

npm install @hackler/js-client-sdk --save

Usage

Install & Decide the variation

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

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

hackleClient.onReady(() => {
    const variation = hackleClient.variation(AB_TEST_KEY);

    if (variation === "A") {
      // AS-IS Code
    } else if (variation === "B") {
      // TO-BE Code
    }
})

Records the event

hackleClient.onReady(() => {
  hackleClient.track(EVENT_KEY);
});