# 예제 실습: 간단한 A/B 테스트

이 문서에서는 핵클에서 제공하는 SDK 중 JavaScript SDK를 이용한 예제를 소개합니다. 소개 목적은 다음과 같습니다.

1. 어떤 코드 작업이 필요한지 알 수 있다.
2. SDK의 기능을 경험할 수 있다.

## 예제: 간단한 A/B 테스트

예제가 수행하는 내용은 다음과 같습니다.

1. 임의의 사용자 식별자를 입력 받습니다.
2. **테스트 그룹 분배** 버튼을 누릅니다.
3. 테스트 그룹 분배를 수행하고 `hackle_test_event_key` 이벤트 키를 전송합니다.

{% hint style="info" %}
예제 코드 확인 및 실습 링크

[Hackle JavaScript SDK 연동 및 기능 적용 예제](https://codepen.io/hackle-example/pen/wvdedja)

Tip. 코드에 있는 주석과 함께 [JavaScript](/development-guide/javascript.md) 문서를 참고하면 빠른 이해에 도움이 됩니다.
{% endhint %}

## 유의사항

1. **예제는 핵클에서 생성한 예제용 A/B 테스트를 기반으로 실행됩니다. 예제용 A/B 테스트는 다음과 같은 특징을 갖고 있습니다.**
   * 분배 사유를 여러 종류 경험할 수 있도록 설정했습니다.
   * 사용자 식별자에 `apple` 입력 시 테스트 그룹 A, `banana` 입력 시 테스트 그룹 B를 반환하도록 설정했습니다.
   * 사용자 식별자에 그 외 값을 입력할 경우에는 테스트 그룹 분배 원리에 따라 테스트 그룹이 결정됩니다.
2. **핵클 대시보드에서 직접 생성한 A/B 테스트로 해당 예제를 수행하기 위해서는 JS 탭에서 SDK 키와 실험 키를 수정해야 합니다.**

![](/files/fzF0077QfoIYwrWMeUjC)


---

# Agent Instructions: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
