# 이벤트 전송

핵클 SDK는 사용자 이벤트를 핵클로 전송하는 기능을 제공합니다. 사용자 행동의 변화가 일어나는 지점마다 이 기능을 활용하면 사용자 행동에 대한 유의미한 데이터를 얻을 수 있으며, 그렇게 모인 데이터를 통해 사용자 행동 분석을 할 수 있습니다.

## track

`track()` 메소드에 **이벤트 키**를 전달하여 사용자 이벤트를 전송할 수 있습니다.

<table><thead><tr><th width="150">파라미터</th><th width="120">타입</th><th width="110">필수</th><th>제약사항</th></tr></thead><tbody><tr><td>이벤트 명(key)</td><td><code>string</code></td><td>필수</td><td>글자수 제한은 128자입니다. (128 characters)</td></tr></tbody></table>

#### 예시

사용자가 구매하기 버튼을 눌렀을 때 이벤트를 수집하기 위해 `purchase` 라는 이벤트 키를 정의했다고 가정합니다.

```javascript
/* 예시 1: 이벤트 키만 전송 */
hackleClient.track({key: "purchase"});
```

### 속성(Property)

핵클 SDK는 이벤트(Event) 객체에 속성을 추가할 수 있도록 지원합니다.

* 속성은 속성명(key)과 속성값(value)을 한 쌍으로 보내야 합니다.
* 이벤트 객체에 추가 가능한 속성 개수는 최대 64개입니다.

<table><thead><tr><th width="133.04296875">구분</th><th width="127.60546875">타입</th><th>제약사항</th></tr></thead><tbody><tr><td>속성 명(key)</td><td><code>string</code></td><td><ul><li>글자수 제한은 128자입니다. (128 characters)</li><li>대소문자를 구분하지 않습니다.</li><li>예를 들어 AGE와 age는 동일한 속성명으로 인식합니다.</li></ul></td></tr><tr><td>속성 값(value)</td><td><code>boolean</code>, <code>string</code>, <code>number</code>, <code>array</code></td><td><ul><li>string 타입인 경우 글자수 제한은 1024자입니다.<br>(1024 characters)</li><li>string 타입은 대소문자를 구분합니다.</li><li>예를 들어 APPLE과 apple은 서로 다른 속성값으로 인식합니다.</li><li>number 타입인 경우 정수 최대 15자리, 소수점 최대 6자리를<br>지원합니다.</li></ul></td></tr></tbody></table>

#### 예시

아래 예시에서는 세 가지 속성(`pay_method`, `discount_amount`, `is_discount`)을 추가한 것을 확인할 수 있습니다.

```javascript
const event = {
  key: "purchase",
  properties: {
    pay_method: "CARD",
    discount_amount: 800,
    is_discount: true
  }
}
hackleClient.track(event);
```


---

# 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/javascript/event-tracking.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.
