> For the complete documentation index, see [llms.txt](https://docs.hackle.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hackle.io/en/development-guide/sdk/sdk-example.md).

# Tutorial / Example: Simple A/B Test

This document introduces an example using the JavaScript SDK from Hackle's supported SDKs. The purpose of the example is to:

1. Understand what code work is needed.
2. Experience the features of the SDK.

## Example: Simple A/B Test

The example performs the following:

1. Accepts an arbitrary User Identifier as input.
2. Clicks the **Variation Distribution** button.
3. Performs variation distribution and tracks the `hackle_test_event_key` event.

{% hint style="info" %}
View example code and practice link

[Hackle JavaScript SDK Integration and Feature Example](https://codepen.io/hackle-example/pen/wvdedja)

Tip. Reading the [JavaScript](/en/development-guide/javascript.md) documentation alongside the comments in the code will help you understand it quickly.
{% endhint %}

## Notes

1. **The example runs based on an A/B test created by Hackle for demonstration purposes. This example A/B test has the following characteristics:**
   * It is configured to let you experience multiple types of distribution reasons.
   * Entering `apple` as the User Identifier returns variation A, and `banana` returns variation B.
   * For other input values, the variation is determined according to the Variation Distribution Principle.
2. **To run this example with an A/B test you created in the Hackle Dashboard, you need to modify the SDK Key and Experiment Key in the JS tab.**

![](/files/VwsKWpHF64PfZpJjAnRL)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.hackle.io/en/development-guide/sdk/sdk-example.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
