> ## 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="/ja/targeting/event">
    コンソールでイベントベースのオーディエンスターゲティングを設定
  </Card>

  <Card title="コンバージョントラッキング" icon="bullseye" href="/ja/targeting/conversion-tracking">
    購入イベントベースのコンバージョントラッキングを設定
  </Card>
</CardGroup>
