@hackler/js-client-sdk
v3.5.0
Published
JavaScript Client(Web Browser) SDK
Downloads
406
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);
});