> ## 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.

# Event Tracking

> Learn how to send user behavior events using the REST API.

Send user behavior events to build event-based audiences for targeting. The event data is used for audience segmentation and conversion tracking.

## Request Parameters

### Headers

<ParamField header="Authorization" type="string" required>
  App Key (found in adrop\_service.json)
</ParamField>

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

### Body Parameters

<ParamField body="uid" type="string" required>
  User unique identifier
</ParamField>

<ParamField body="eventName" type="string" required>
  Event name (1–64 characters)
</ParamField>

<ParamField body="platform" type="string">
  Platform. e.g., `web`, `android`, `ios`
</ParamField>

Additional event-specific parameters are passed as top-level fields in the request body. For multi-item events (`begin_checkout`, `purchase`), pass an `items` array.

### Response

<ResponseField name="message" type="string">
  `"ok"` on success, `"!invalid"` on validation error.
</ResponseField>

<ResponseExample>
  ```json Success Response theme={null}
  {
      "message": "ok"
  }
  ```

  ```json Error Response theme={null}
  {
      "message": "!invalid"
  }
  ```
</ResponseExample>

***

## Supported Events

### Common Events

| Event Name    | Description               | Parameters                                            |
| ------------- | ------------------------- | ----------------------------------------------------- |
| `app_open`    | App opened                | —                                                     |
| `sign_up`     | User signed up            | `method` (required)                                   |
| `push_clicks` | Push notification clicked | `campaign_id` (required)                              |
| `page_view`   | Page viewed               | `page_id` (required), `page_category`, `page_url`     |
| `click`       | Element clicked           | `element_id` (required), `element_type`, `target_url` |

### Online Sales Events

| Event Name        | Description        | Parameters                                                                                                                  |
| ----------------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------- |
| `view_item`       | Viewed item        | `item_id` (required), `item_name`, `item_category`, `brand`, `price`                                                        |
| `add_to_wishlist` | Added to wishlist  | `item_id` (required), `item_name`, `item_category`, `brand`, `price`                                                        |
| `add_to_cart`     | Added to cart      | `item_id` (required), `item_name`, `item_category`, `brand`, `price` (required), `quantity` (required), `value`, `currency` |
| `begin_checkout`  | Began checkout     | `currency`, `items` (array, `item_id` required per item)                                                                    |
| `purchase`        | Purchase completed | `tx_id` (required), `currency`, `items` (array, `item_id` required per item)                                                |

### Lead Generation Events

| Event Name        | Description     | Parameters                                                                              |
| ----------------- | --------------- | --------------------------------------------------------------------------------------- |
| `view_content`    | Viewed content  | `content_id` (required), `content_name`, `content_type`                                 |
| `begin_lead_form` | Began lead form | `form_id` (required), `form_name`, `form_type`, `form_destination`                      |
| `generate_lead`   | Lead generated  | `form_id` (required), `form_name`, `form_type`, `form_destination`, `value`, `currency` |

***

## Examples

### Simple Event

<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>

### Event with Parameters

<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>

### Multi-Item Event (Purchase)

<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>

### Lead Generation Event

<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>

***

## Notes

<Note>
  * Events with unknown names or missing required parameters are silently ignored (HTTP 200 returned).
  * Multi-item events support up to 100 items per request.
  * String parameter values are limited to 1024 characters.
  * `uid` is hashed with SHA-256 before storage.
</Note>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Event Targeting" icon="chart-line" href="/targeting/event">
    Configure event-based audience targeting in the console
  </Card>

  <Card title="Conversion Tracking" icon="bullseye" href="/targeting/conversion-tracking">
    Track conversions based on purchase events
  </Card>
</CardGroup>
