> ## Documentation Index
> Fetch the complete documentation index at: https://docs.adrop.io/llms.txt
> Use this file to discover all available pages before exploring further.

# 이벤트 전송

> REST API를 사용하여 사용자 행동 이벤트를 전송하는 방법을 안내합니다.

사용자 행동 이벤트를 전송하여 이벤트 기반 오디언스 타겟팅을 구축할 수 있습니다. 이벤트 데이터는 오디언스 세분화 및 전환 추적에 활용됩니다.

## 요청 파라미터

### 헤더

<ParamField header="Authorization" type="string" required>
  App Key (adrop\_service.json에서 확인)
</ParamField>

<ParamField header="Content-Type" type="string" required>
  `application/json`
</ParamField>

### 바디 파라미터

<ParamField body="uid" type="string" required>
  사용자 고유 식별자
</ParamField>

<ParamField body="eventName" type="string" required>
  이벤트 이름 (1\~64자)
</ParamField>

<ParamField body="platform" type="string">
  플랫폼. 예: `web`, `android`, `ios`
</ParamField>

이벤트별 추가 파라미터는 요청 바디의 최상위 필드로 전달합니다. 다중 아이템 이벤트(`begin_checkout`, `purchase`)의 경우 `items` 배열을 전달합니다.

### 응답

<ResponseField name="message" type="string">
  성공 시 `"ok"`, 유효성 검증 실패 시 `"!invalid"`
</ResponseField>

<ResponseExample>
  ```json 성공 응답 theme={null}
  {
      "message": "ok"
  }
  ```

  ```json 에러 응답 theme={null}
  {
      "message": "!invalid"
  }
  ```
</ResponseExample>

***

## 지원되는 이벤트

### 공통 이벤트

| 이벤트 이름        | 설명       | 파라미터                                            |
| ------------- | -------- | ----------------------------------------------- |
| `app_open`    | 앱 실행     | —                                               |
| `sign_up`     | 회원가입     | `method` (필수)                                   |
| `push_clicks` | 푸시 알림 클릭 | `campaign_id` (필수)                              |
| `page_view`   | 페이지 조회   | `page_id` (필수), `page_category`, `page_url`     |
| `click`       | 요소 클릭    | `element_id` (필수), `element_type`, `target_url` |

### 온라인 판매 이벤트

| 이벤트 이름            | 설명       | 파라미터                                                                                                      |
| ----------------- | -------- | --------------------------------------------------------------------------------------------------------- |
| `view_item`       | 아이템 조회   | `item_id` (필수), `item_name`, `item_category`, `brand`, `price`                                            |
| `add_to_wishlist` | 위시리스트 추가 | `item_id` (필수), `item_name`, `item_category`, `brand`, `price`                                            |
| `add_to_cart`     | 장바구니 추가  | `item_id` (필수), `item_name`, `item_category`, `brand`, `price` (필수), `quantity` (필수), `value`, `currency` |
| `begin_checkout`  | 결제 시작    | `currency`, `items` (배열, 아이템당 `item_id` 필수)                                                               |
| `purchase`        | 구매 완료    | `tx_id` (필수), `currency`, `items` (배열, 아이템당 `item_id` 필수)                                                 |

### 리드 생성 이벤트

| 이벤트 이름            | 설명      | 파라미터                                                                              |
| ----------------- | ------- | --------------------------------------------------------------------------------- |
| `view_content`    | 콘텐츠 조회  | `content_id` (필수), `content_name`, `content_type`                                 |
| `begin_lead_form` | 리드 폼 시작 | `form_id` (필수), `form_name`, `form_type`, `form_destination`                      |
| `generate_lead`   | 리드 생성   | `form_id` (필수), `form_name`, `form_type`, `form_destination`, `value`, `currency` |

***

## 예시

### 단순 이벤트

<CodeGroup>
  ```javascript Node.js theme={null}
  const axios = require('axios');

  axios.post('https://api-v2.adrop.io/event', {
      uid: 'USER_ID',
      eventName: 'app_open'
  }, {
      headers: {
          'Authorization': 'YOUR_APP_KEY',
          'Content-Type': 'application/json'
      }
  });
  ```

  ```python Python theme={null}
  import requests

  url = "https://api-v2.adrop.io/event"
  headers = {
      "Authorization": "YOUR_APP_KEY",
      "Content-Type": "application/json"
  }
  data = {
      "uid": "USER_ID",
      "eventName": "app_open"
  }

  response = requests.post(url, json=data, headers=headers)
  print(response.json())
  ```

  ```curl cURL theme={null}
  curl -X POST "https://api-v2.adrop.io/event" \
    -H "Authorization: YOUR_APP_KEY" \
    -H "Content-Type: application/json" \
    -d '{"uid": "USER_ID", "eventName": "app_open"}'
  ```
</CodeGroup>

### 파라미터가 있는 이벤트

<CodeGroup>
  ```javascript Node.js theme={null}
  const axios = require('axios');

  axios.post('https://api-v2.adrop.io/event', {
      uid: 'USER_ID',
      eventName: 'view_item',
      platform: 'web',
      item_id: 'SKU-123',
      item_name: 'Widget',
      item_category: 'Electronics',
      brand: 'BrandX',
      price: 29900
  }, {
      headers: {
          'Authorization': 'YOUR_APP_KEY',
          'Content-Type': 'application/json'
      }
  });
  ```

  ```python Python theme={null}
  import requests

  url = "https://api-v2.adrop.io/event"
  headers = {
      "Authorization": "YOUR_APP_KEY",
      "Content-Type": "application/json"
  }
  data = {
      "uid": "USER_ID",
      "eventName": "view_item",
      "platform": "web",
      "item_id": "SKU-123",
      "item_name": "Widget",
      "item_category": "Electronics",
      "brand": "BrandX",
      "price": 29900
  }

  response = requests.post(url, json=data, headers=headers)
  print(response.json())
  ```

  ```curl cURL theme={null}
  curl -X POST "https://api-v2.adrop.io/event" \
    -H "Authorization: YOUR_APP_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "uid": "USER_ID",
      "eventName": "view_item",
      "platform": "web",
      "item_id": "SKU-123",
      "item_name": "Widget",
      "item_category": "Electronics",
      "brand": "BrandX",
      "price": 29900
    }'
  ```
</CodeGroup>

### 다중 아이템 이벤트 (구매)

<CodeGroup>
  ```javascript Node.js theme={null}
  const axios = require('axios');

  axios.post('https://api-v2.adrop.io/event', {
      uid: 'USER_ID',
      eventName: 'purchase',
      platform: 'web',
      tx_id: 'TXN-20240101-001',
      currency: 'KRW',
      items: [
          {
              item_id: 'SKU-001',
              item_name: 'Product A',
              item_category: 'Electronics',
              brand: 'BrandX',
              price: 29900,
              quantity: 1
          },
          {
              item_id: 'SKU-002',
              item_name: 'Product B',
              price: 15000,
              quantity: 2
          }
      ]
  }, {
      headers: {
          'Authorization': 'YOUR_APP_KEY',
          'Content-Type': 'application/json'
      }
  });
  ```

  ```python Python theme={null}
  import requests

  url = "https://api-v2.adrop.io/event"
  headers = {
      "Authorization": "YOUR_APP_KEY",
      "Content-Type": "application/json"
  }
  data = {
      "uid": "USER_ID",
      "eventName": "purchase",
      "platform": "web",
      "tx_id": "TXN-20240101-001",
      "currency": "KRW",
      "items": [
          {
              "item_id": "SKU-001",
              "item_name": "Product A",
              "item_category": "Electronics",
              "brand": "BrandX",
              "price": 29900,
              "quantity": 1
          },
          {
              "item_id": "SKU-002",
              "item_name": "Product B",
              "price": 15000,
              "quantity": 2
          }
      ]
  }

  response = requests.post(url, json=data, headers=headers)
  print(response.json())
  ```

  ```curl cURL theme={null}
  curl -X POST "https://api-v2.adrop.io/event" \
    -H "Authorization: YOUR_APP_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "uid": "USER_ID",
      "eventName": "purchase",
      "platform": "web",
      "tx_id": "TXN-20240101-001",
      "currency": "KRW",
      "items": [
        {"item_id": "SKU-001", "item_name": "Product A", "price": 29900, "quantity": 1},
        {"item_id": "SKU-002", "item_name": "Product B", "price": 15000, "quantity": 2}
      ]
    }'
  ```
</CodeGroup>

### 리드 생성 이벤트

<CodeGroup>
  ```javascript Node.js theme={null}
  const axios = require('axios');

  axios.post('https://api-v2.adrop.io/event', {
      uid: 'USER_ID',
      eventName: 'generate_lead',
      platform: 'web',
      form_id: 'contact-form-01',
      form_name: 'Contact Us',
      form_type: 'contact',
      form_destination: '/thank-you',
      value: 50000,
      currency: 'KRW'
  }, {
      headers: {
          'Authorization': 'YOUR_APP_KEY',
          'Content-Type': 'application/json'
      }
  });
  ```

  ```python Python theme={null}
  import requests

  url = "https://api-v2.adrop.io/event"
  headers = {
      "Authorization": "YOUR_APP_KEY",
      "Content-Type": "application/json"
  }
  data = {
      "uid": "USER_ID",
      "eventName": "generate_lead",
      "platform": "web",
      "form_id": "contact-form-01",
      "form_name": "Contact Us",
      "form_type": "contact",
      "form_destination": "/thank-you",
      "value": 50000,
      "currency": "KRW"
  }

  response = requests.post(url, json=data, headers=headers)
  print(response.json())
  ```

  ```curl cURL theme={null}
  curl -X POST "https://api-v2.adrop.io/event" \
    -H "Authorization: YOUR_APP_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "uid": "USER_ID",
      "eventName": "generate_lead",
      "platform": "web",
      "form_id": "contact-form-01",
      "form_name": "Contact Us",
      "form_type": "contact",
      "form_destination": "/thank-you",
      "value": 50000,
      "currency": "KRW"
    }'
  ```
</CodeGroup>

***

## 참고 사항

<Note>
  * 알 수 없는 이벤트 이름이나 필수 파라미터가 누락된 이벤트는 무시됩니다 (HTTP 200 반환).
  * 다중 아이템 이벤트는 요청당 최대 100개 아이템을 지원합니다.
  * 문자열 파라미터 값은 최대 1024자까지 가능합니다.
  * `uid`는 저장 전 SHA-256으로 해시 처리됩니다.
</Note>

***

## 관련 문서

<CardGroup cols={2}>
  <Card title="이벤트 타겟팅" icon="chart-line" href="/ko/targeting/event">
    콘솔에서 이벤트 기반 오디언스 타겟팅 설정
  </Card>

  <Card title="전환 추적" icon="bullseye" href="/ko/targeting/conversion-tracking">
    구매 이벤트 기반 전환 추적 설정
  </Card>
</CardGroup>
