# Hackle JavaScript Client(Web Browser) SDK

## Install

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

## Usage
### Install & Decide the variation
```javascript
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
```javascript
hackleClient.onReady(() => {
  hackleClient.track(EVENT_KEY);
});
```
