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

# Server-side tracking V2

> Send event tracking data to Dema from the server-side using the V2 tracking API. Supports extensible event types including page views, product views, and purchases.

<CardGroup cols={3}>
  <Card title="Supported event types" icon="list-check" href="#supported-event-types">
    Required and optional event types
  </Card>

  <Card title="Prerequisites" icon="circle-check" href="#prerequisites">
    What you need before getting started
  </Card>

  <Card title="Request details" icon="code" href="#request-details">
    Endpoint, methods, and parameters
  </Card>

  <Card title="Event examples" icon="file-code" href="#event-examples">
    Sample payloads for each event type
  </Card>

  <Card title="Schema reference" icon="book" href="#event-data-schema-reference">
    Full TrackedEventData schema
  </Card>
</CardGroup>

## Supported event types

The V2 API expects at minimum the following event types:

<CardGroup cols={3}>
  <Card title="page_view" icon="eye" href="#page_view">
    Page visits across your site
  </Card>

  <Card title="view_item" icon="tag" href="#view_item">
    Product details page
  </Card>

  <Card title="purchase" icon="file-invoice-dollar" href="#purchase">
    Purchase transactions
  </Card>
</CardGroup>

The API also supports the following optional event types:

<CardGroup cols={3}>
  <Card title="view_item_list" icon="list" href="#view_item_list">
    Product list viewed
  </Card>

  <Card title="select_item" icon="hand-pointer" href="#select_item">
    Item selected from a list
  </Card>

  <Card title="add_to_cart" icon="cart-arrow-down" href="#add_to_cart">
    Item added to cart
  </Card>

  <Card title="remove_from_cart" icon="cart-xmark" href="#remove_from_cart">
    Item removed from cart
  </Card>

  <Card title="view_cart" icon="cart-shopping" href="#view_cart">
    Cart page viewed
  </Card>

  <Card title="add_to_wishlist" icon="heart" href="#add_to_wishlist">
    Item added to wishlist
  </Card>

  <Card title="remove_from_wishlist" icon="heart-crack" href="#remove_from_wishlist">
    Item removed from wishlist
  </Card>

  <Card title="begin_checkout" icon="credit-card" href="#begin_checkout">
    Checkout started
  </Card>
</CardGroup>

The API is extensible — you can send any `event_name` value beyond the ones listed above, and Dema can build custom metrics on top of it. The available fields per event are defined by the [event data schema](#event-data-schema-reference).

***

## Prerequisites

* Your unique Dema ID, formatted as `DV-XXXXXXXXXXXXXXXXXXXXXXXX`

***

## Response

The API returns an HTTP `200` status code with an empty response body on success.

***

## Request details

### Endpoint

* **URL**: `https://tracker.dema.ai/api/track`

### HTTP methods

Both **GET** and **POST** methods are supported.

<Warning>
  GET requests have a practical limit of approximately **8 KB** of data due to URL length restrictions. For larger payloads, use the POST method.
</Warning>

### Required request parameters

| Parameter | Description                                                                                                                                        |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `i`       | Your unique Dema ID.                                                                                                                               |
| `uid`     | Unique user ID for the event, a UUID managed server-side. Must be a valid UUIDv4 string. Should remain consistent across events for the same user. |
| `_nc`     | No-cache parameter. Current timestamp in milliseconds since epoch.                                                                                 |
| `v`       | Version of your tracking integration (e.g., `"2.0.0"`). Use your own versioning scheme.                                                            |

### Event details

For **GET** requests, event details are passed as a URL-encoded JSON string in the `m` query parameter.

For **POST** requests, event details are sent as a JSON body with the `Content-Type: application/json` header.

Event details must conform to the TrackedEventData schema. See the [Event data schema reference](#event-data-schema-reference) section for the full schema and field descriptions.

***

## Event examples

### page\_view

A basic page view event:

```json theme={null}
{
  "event_name": "page_view",
  "page_location": "https://example.com/summer-collection",
  "page_referrer": "https://google.com/search?q=summer+collection",
  "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
  "ip": "10.0.0.1"
}
```

<Accordion title="curl examples for page_view" icon="code">
  <CodeGroup>
    ```bash POST theme={null}
    DEMA_ID="YOUR-DEMA-ID"
    USER_ID=$(uuidgen)
    NC=$(date +%s%3N)

    curl -X POST "https://tracker.dema.ai/api/track?i=${DEMA_ID}&uid=${USER_ID}&_nc=${NC}&v=2.0.0" \
      -H 'Content-Type: application/json' \
      -d '{
        "event_name": "page_view",
        "page_location": "https://example.com/summer-collection",
        "page_referrer": "https://google.com/search?q=summer+collection",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
        "ip": "10.0.0.1"
      }'
    ```

    ```bash GET theme={null}
    DEMA_ID="YOUR-DEMA-ID"
    USER_ID=$(uuidgen)
    NC=$(date +%s%3N)

    curl "https://tracker.dema.ai/api/track?i=${DEMA_ID}&uid=${USER_ID}&_nc=${NC}&v=2.0.0&m=%7B%22event_name%22%3A%22page_view%22%2C%22page_location%22%3A%22https%3A%2F%2Fexample.com%2Fsummer-collection%22%2C%22page_referrer%22%3A%22https%3A%2F%2Fgoogle.com%2Fsearch%3Fq%3Dsummer%2Bcollection%22%2C%22user_agent%22%3A%22Mozilla%2F5.0+%28Windows+NT+10.0%3B+Win64%3B+x64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F91.0.4472.124+Safari%2F537.36%22%2C%22ip%22%3A%2210.0.0.1%22%7D"
    ```
  </CodeGroup>
</Accordion>

[↑ Back to supported event types](#supported-event-types)

***

### view\_item

Sent when a user views a product detail page:

```json theme={null}
{
  "event_name": "view_item",
  "page_location": "https://example.com/summer-collection/product1234",
  "page_referrer": "https://example.com/summer-collection",
  "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
  "ip": "10.0.0.1",
  "items": [
    {
      "index": 0,
      "product_id": "1234",
      "price": 199.99
    }
  ],
  "currency": "EUR"
}
```

<Note>
  On a product display page, you should send **both** a `page_view` event and a `view_item` event. This is different from the deprecated V1 API, where a single pageview event covered both.
</Note>

<Accordion title="curl examples for view_item" icon="code">
  <CodeGroup>
    ```bash POST theme={null}
    DEMA_ID="YOUR-DEMA-ID"
    USER_ID=$(uuidgen)
    NC=$(date +%s%3N)

    curl -X POST "https://tracker.dema.ai/api/track?i=${DEMA_ID}&uid=${USER_ID}&_nc=${NC}&v=2.0.0" \
      -H 'Content-Type: application/json' \
      -d '{
        "event_name": "view_item",
        "page_location": "https://example.com/summer-collection/product1234",
        "page_referrer": "https://example.com/summer-collection",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
        "ip": "10.0.0.1",
        "items": [
          {
            "index": 0,
            "product_id": "1234",
            "price": 199.99
          }
        ],
        "currency": "EUR"
      }'
    ```

    ```bash GET theme={null}
    DEMA_ID="YOUR-DEMA-ID"
    USER_ID=$(uuidgen)
    NC=$(date +%s%3N)

    curl "https://tracker.dema.ai/api/track?i=${DEMA_ID}&uid=${USER_ID}&_nc=${NC}&v=2.0.0&m=%7B%22event_name%22%3A%22view_item%22%2C%22page_location%22%3A%22https%3A%2F%2Fexample.com%2Fsummer-collection%2Fproduct1234%22%2C%22page_referrer%22%3A%22https%3A%2F%2Fexample.com%2Fsummer-collection%22%2C%22user_agent%22%3A%22Mozilla%2F5.0+%28Windows+NT+10.0%3B+Win64%3B+x64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F91.0.4472.124+Safari%2F537.36%22%2C%22ip%22%3A%2210.0.0.1%22%2C%22items%22%3A%5B%7B%22index%22%3A0%2C%22product_id%22%3A%221234%22%2C%22price%22%3A199.99%7D%5D%2C%22currency%22%3A%22EUR%22%7D"
    ```
  </CodeGroup>
</Accordion>

[↑ Back to supported event types](#supported-event-types)

***

### purchase

A purchase event, sent when a user completes a transaction:

```json theme={null}
{
  "event_name": "purchase",
  "page_location": "https://example.com/checkout",
  "page_referrer": "https://example.com/cart",
  "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
  "ip": "10.0.0.1",
  "items": [
    {
      "index": 0,
      "product_id": "1234",
      "variant_no": "sku1234",
      "price": 199.99,
      "quantity": 1
    }
  ],
  "currency": "EUR",
  "total": 210.98,
  "tax": 42.20,
  "shipping": 19.99,
  "customer_id": "customer@example.com",
  "order_id": "45678"
}
```

<Accordion title="curl examples for purchase" icon="code">
  <CodeGroup>
    ```bash POST theme={null}
    DEMA_ID="YOUR-DEMA-ID"
    USER_ID=$(uuidgen)
    NC=$(date +%s%3N)

    curl -X POST "https://tracker.dema.ai/api/track?i=${DEMA_ID}&uid=${USER_ID}&_nc=${NC}&v=2.0.0" \
      -H 'Content-Type: application/json' \
      -d '{
        "event_name": "purchase",
        "page_location": "https://example.com/checkout",
        "page_referrer": "https://example.com/cart",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
        "ip": "10.0.0.1",
        "items": [
          {
            "index": 0,
            "product_id": "1234",
            "variant_no": "sku1234",
            "price": 199.99,
            "quantity": 1
          }
        ],
        "currency": "EUR",
        "total": 210.98,
        "tax": 42.20,
        "shipping": 19.99,
        "customer_id": "customer@example.com",
        "order_id": "45678"
      }'
    ```

    ```bash GET theme={null}
    DEMA_ID="YOUR-DEMA-ID"
    USER_ID=$(uuidgen)
    NC=$(date +%s%3N)

    curl "https://tracker.dema.ai/api/track?i=${DEMA_ID}&uid=${USER_ID}&_nc=${NC}&v=2.0.0&m=%7B%22event_name%22%3A%22purchase%22%2C%22page_location%22%3A%22https%3A%2F%2Fexample.com%2Fcheckout%22%2C%22page_referrer%22%3A%22https%3A%2F%2Fexample.com%2Fcart%22%2C%22user_agent%22%3A%22Mozilla%2F5.0+%28Windows+NT+10.0%3B+Win64%3B+x64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F91.0.4472.124+Safari%2F537.36%22%2C%22ip%22%3A%2210.0.0.1%22%2C%22items%22%3A%5B%7B%22index%22%3A0%2C%22product_id%22%3A%221234%22%2C%22variant_no%22%3A%22sku1234%22%2C%22price%22%3A199.99%2C%22quantity%22%3A1%7D%5D%2C%22currency%22%3A%22EUR%22%2C%22total%22%3A210.98%2C%22tax%22%3A42.20%2C%22shipping%22%3A19.99%2C%22customer_id%22%3A%22customer%40example.com%22%2C%22order_id%22%3A%2245678%22%7D"
    ```
  </CodeGroup>
</Accordion>

[↑ Back to supported event types](#supported-event-types)

***

### view\_item\_list

Sent when a user views a list of products (e.g., a category page or search results):

```json theme={null}
{
  "event_name": "view_item_list",
  "page_location": "https://example.com/summer-collection",
  "page_referrer": "https://google.com/search?q=summer+collection",
  "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
  "ip": "10.0.0.1",
  "items": [
    {
      "index": 0,
      "product_id": "1234",
      "price": 199.99
    },
    {
      "index": 1,
      "product_id": "5678",
      "price": 49.99
    },
    {
      "index": 2,
      "product_id": "9012",
      "price": 89.99
    }
  ],
  "currency": "EUR"
}
```

<Accordion title="curl examples for view_item_list" icon="code">
  <CodeGroup>
    ```bash POST theme={null}
    DEMA_ID="YOUR-DEMA-ID"
    USER_ID=$(uuidgen)
    NC=$(date +%s%3N)

    curl -X POST "https://tracker.dema.ai/api/track?i=${DEMA_ID}&uid=${USER_ID}&_nc=${NC}&v=2.0.0" \
      -H 'Content-Type: application/json' \
      -d '{
        "event_name": "view_item_list",
        "page_location": "https://example.com/summer-collection",
        "page_referrer": "https://google.com/search?q=summer+collection",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
        "ip": "10.0.0.1",
        "items": [
          {
            "index": 0,
            "product_id": "1234",
            "price": 199.99
          },
          {
            "index": 1,
            "product_id": "5678",
            "price": 49.99
          },
          {
            "index": 2,
            "product_id": "9012",
            "price": 89.99
          }
        ],
        "currency": "EUR"
      }'
    ```

    ```bash GET theme={null}
    DEMA_ID="YOUR-DEMA-ID"
    USER_ID=$(uuidgen)
    NC=$(date +%s%3N)

    curl "https://tracker.dema.ai/api/track?i=${DEMA_ID}&uid=${USER_ID}&_nc=${NC}&v=2.0.0&m=%7B%22event_name%22%3A%22view_item_list%22%2C%22page_location%22%3A%22https%3A%2F%2Fexample.com%2Fsummer-collection%22%2C%22page_referrer%22%3A%22https%3A%2F%2Fgoogle.com%2Fsearch%3Fq%3Dsummer%2Bcollection%22%2C%22user_agent%22%3A%22Mozilla%2F5.0+%28Windows+NT+10.0%3B+Win64%3B+x64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F91.0.4472.124+Safari%2F537.36%22%2C%22ip%22%3A%2210.0.0.1%22%2C%22items%22%3A%5B%7B%22index%22%3A0%2C%22product_id%22%3A%221234%22%2C%22price%22%3A199.99%7D%2C%7B%22index%22%3A1%2C%22product_id%22%3A%225678%22%2C%22price%22%3A49.99%7D%2C%7B%22index%22%3A2%2C%22product_id%22%3A%229012%22%2C%22price%22%3A89.99%7D%5D%2C%22currency%22%3A%22EUR%22%7D"
    ```
  </CodeGroup>
</Accordion>

[↑ Back to supported event types](#supported-event-types)

***

### select\_item

Sent when a user selects a product from a list (e.g., a category page or search results). The `index` reflects the position where the item was presented to the user:

```json theme={null}
{
  "event_name": "select_item",
  "page_location": "https://example.com/summer-collection",
  "page_referrer": "https://google.com/search?q=summer+collection",
  "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
  "ip": "10.0.0.1",
  "items": [
    {
      "index": 3,
      "product_id": "1234",
      "price": 199.99
    }
  ],
  "currency": "EUR"
}
```

<Accordion title="curl examples for select_item" icon="code">
  <CodeGroup>
    ```bash POST theme={null}
    DEMA_ID="YOUR-DEMA-ID"
    USER_ID=$(uuidgen)
    NC=$(date +%s%3N)

    curl -X POST "https://tracker.dema.ai/api/track?i=${DEMA_ID}&uid=${USER_ID}&_nc=${NC}&v=2.0.0" \
      -H 'Content-Type: application/json' \
      -d '{
        "event_name": "select_item",
        "page_location": "https://example.com/summer-collection",
        "page_referrer": "https://google.com/search?q=summer+collection",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
        "ip": "10.0.0.1",
        "items": [
          {
            "index": 3,
            "product_id": "1234",
            "price": 199.99
          }
        ],
        "currency": "EUR"
      }'
    ```

    ```bash GET theme={null}
    DEMA_ID="YOUR-DEMA-ID"
    USER_ID=$(uuidgen)
    NC=$(date +%s%3N)

    curl "https://tracker.dema.ai/api/track?i=${DEMA_ID}&uid=${USER_ID}&_nc=${NC}&v=2.0.0&m=%7B%22event_name%22%3A%22select_item%22%2C%22page_location%22%3A%22https%3A%2F%2Fexample.com%2Fsummer-collection%22%2C%22page_referrer%22%3A%22https%3A%2F%2Fgoogle.com%2Fsearch%3Fq%3Dsummer%2Bcollection%22%2C%22user_agent%22%3A%22Mozilla%2F5.0+%28Windows+NT+10.0%3B+Win64%3B+x64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F91.0.4472.124+Safari%2F537.36%22%2C%22ip%22%3A%2210.0.0.1%22%2C%22items%22%3A%5B%7B%22index%22%3A3%2C%22product_id%22%3A%221234%22%2C%22price%22%3A199.99%7D%5D%2C%22currency%22%3A%22EUR%22%7D"
    ```
  </CodeGroup>
</Accordion>

[↑ Back to supported event types](#supported-event-types)

***

### add\_to\_cart

Sent when a user adds a product to their cart:

```json theme={null}
{
  "event_name": "add_to_cart",
  "page_location": "https://example.com/summer-collection/product1234",
  "page_referrer": "https://example.com/summer-collection",
  "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
  "ip": "10.0.0.1",
  "items": [
    {
      "product_id": "1234",
      "variant_no": "sku1234",
      "price": 199.99,
      "quantity": 1
    }
  ],
  "currency": "EUR"
}
```

<Accordion title="curl examples for add_to_cart" icon="code">
  <CodeGroup>
    ```bash POST theme={null}
    DEMA_ID="YOUR-DEMA-ID"
    USER_ID=$(uuidgen)
    NC=$(date +%s%3N)

    curl -X POST "https://tracker.dema.ai/api/track?i=${DEMA_ID}&uid=${USER_ID}&_nc=${NC}&v=2.0.0" \
      -H 'Content-Type: application/json' \
      -d '{
        "event_name": "add_to_cart",
        "page_location": "https://example.com/summer-collection/product1234",
        "page_referrer": "https://example.com/summer-collection",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
        "ip": "10.0.0.1",
        "items": [
          {
            "product_id": "1234",
            "variant_no": "sku1234",
            "price": 199.99,
            "quantity": 1
          }
        ],
        "currency": "EUR"
      }'
    ```

    ```bash GET theme={null}
    DEMA_ID="YOUR-DEMA-ID"
    USER_ID=$(uuidgen)
    NC=$(date +%s%3N)

    curl "https://tracker.dema.ai/api/track?i=${DEMA_ID}&uid=${USER_ID}&_nc=${NC}&v=2.0.0&m=%7B%22event_name%22%3A%22add_to_cart%22%2C%22page_location%22%3A%22https%3A%2F%2Fexample.com%2Fsummer-collection%2Fproduct1234%22%2C%22page_referrer%22%3A%22https%3A%2F%2Fexample.com%2Fsummer-collection%22%2C%22user_agent%22%3A%22Mozilla%2F5.0+%28Windows+NT+10.0%3B+Win64%3B+x64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F91.0.4472.124+Safari%2F537.36%22%2C%22ip%22%3A%2210.0.0.1%22%2C%22items%22%3A%5B%7B%22product_id%22%3A%221234%22%2C%22variant_no%22%3A%22sku1234%22%2C%22price%22%3A199.99%2C%22quantity%22%3A1%7D%5D%2C%22currency%22%3A%22EUR%22%7D"
    ```
  </CodeGroup>
</Accordion>

[↑ Back to supported event types](#supported-event-types)

***

### remove\_from\_cart

Sent when a user removes a product from their cart:

```json theme={null}
{
  "event_name": "remove_from_cart",
  "page_location": "https://example.com/cart",
  "page_referrer": "https://example.com/summer-collection/product1234",
  "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
  "ip": "10.0.0.1",
  "items": [
    {
      "product_id": "1234",
      "variant_no": "sku1234",
      "price": 199.99,
      "quantity": 1
    }
  ],
  "currency": "EUR"
}
```

<Accordion title="curl examples for remove_from_cart" icon="code">
  <CodeGroup>
    ```bash POST theme={null}
    DEMA_ID="YOUR-DEMA-ID"
    USER_ID=$(uuidgen)
    NC=$(date +%s%3N)

    curl -X POST "https://tracker.dema.ai/api/track?i=${DEMA_ID}&uid=${USER_ID}&_nc=${NC}&v=2.0.0" \
      -H 'Content-Type: application/json' \
      -d '{
        "event_name": "remove_from_cart",
        "page_location": "https://example.com/cart",
        "page_referrer": "https://example.com/summer-collection/product1234",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
        "ip": "10.0.0.1",
        "items": [
          {
            "product_id": "1234",
            "variant_no": "sku1234",
            "price": 199.99,
            "quantity": 1
          }
        ],
        "currency": "EUR"
      }'
    ```

    ```bash GET theme={null}
    DEMA_ID="YOUR-DEMA-ID"
    USER_ID=$(uuidgen)
    NC=$(date +%s%3N)

    curl "https://tracker.dema.ai/api/track?i=${DEMA_ID}&uid=${USER_ID}&_nc=${NC}&v=2.0.0&m=%7B%22event_name%22%3A%22remove_from_cart%22%2C%22page_location%22%3A%22https%3A%2F%2Fexample.com%2Fcart%22%2C%22page_referrer%22%3A%22https%3A%2F%2Fexample.com%2Fsummer-collection%2Fproduct1234%22%2C%22user_agent%22%3A%22Mozilla%2F5.0+%28Windows+NT+10.0%3B+Win64%3B+x64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F91.0.4472.124+Safari%2F537.36%22%2C%22ip%22%3A%2210.0.0.1%22%2C%22items%22%3A%5B%7B%22product_id%22%3A%221234%22%2C%22variant_no%22%3A%22sku1234%22%2C%22price%22%3A199.99%2C%22quantity%22%3A1%7D%5D%2C%22currency%22%3A%22EUR%22%7D"
    ```
  </CodeGroup>
</Accordion>

[↑ Back to supported event types](#supported-event-types)

***

### view\_cart

Sent when a user views their shopping cart:

```json theme={null}
{
  "event_name": "view_cart",
  "page_location": "https://example.com/cart",
  "page_referrer": "https://example.com/summer-collection/product1234",
  "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
  "ip": "10.0.0.1",
  "items": [
    {
      "product_id": "1234",
      "variant_no": "sku1234",
      "price": 199.99,
      "quantity": 1
    },
    {
      "product_id": "5678",
      "variant_no": "sku5678",
      "price": 49.99,
      "quantity": 2
    }
  ],
  "currency": "EUR"
}
```

<Accordion title="curl examples for view_cart" icon="code">
  <CodeGroup>
    ```bash POST theme={null}
    DEMA_ID="YOUR-DEMA-ID"
    USER_ID=$(uuidgen)
    NC=$(date +%s%3N)

    curl -X POST "https://tracker.dema.ai/api/track?i=${DEMA_ID}&uid=${USER_ID}&_nc=${NC}&v=2.0.0" \
      -H 'Content-Type: application/json' \
      -d '{
        "event_name": "view_cart",
        "page_location": "https://example.com/cart",
        "page_referrer": "https://example.com/summer-collection/product1234",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
        "ip": "10.0.0.1",
        "items": [
          {
            "product_id": "1234",
            "variant_no": "sku1234",
            "price": 199.99,
            "quantity": 1
          },
          {
            "product_id": "5678",
            "variant_no": "sku5678",
            "price": 49.99,
            "quantity": 2
          }
        ],
        "currency": "EUR"
      }'
    ```

    ```bash GET theme={null}
    DEMA_ID="YOUR-DEMA-ID"
    USER_ID=$(uuidgen)
    NC=$(date +%s%3N)

    curl "https://tracker.dema.ai/api/track?i=${DEMA_ID}&uid=${USER_ID}&_nc=${NC}&v=2.0.0&m=%7B%22event_name%22%3A%22view_cart%22%2C%22page_location%22%3A%22https%3A%2F%2Fexample.com%2Fcart%22%2C%22page_referrer%22%3A%22https%3A%2F%2Fexample.com%2Fsummer-collection%2Fproduct1234%22%2C%22user_agent%22%3A%22Mozilla%2F5.0+%28Windows+NT+10.0%3B+Win64%3B+x64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F91.0.4472.124+Safari%2F537.36%22%2C%22ip%22%3A%2210.0.0.1%22%2C%22items%22%3A%5B%7B%22product_id%22%3A%221234%22%2C%22variant_no%22%3A%22sku1234%22%2C%22price%22%3A199.99%2C%22quantity%22%3A1%7D%2C%7B%22product_id%22%3A%225678%22%2C%22variant_no%22%3A%22sku5678%22%2C%22price%22%3A49.99%2C%22quantity%22%3A2%7D%5D%2C%22currency%22%3A%22EUR%22%7D"
    ```
  </CodeGroup>
</Accordion>

[↑ Back to supported event types](#supported-event-types)

***

### add\_to\_wishlist

Sent when a user adds a product to their wishlist:

```json theme={null}
{
  "event_name": "add_to_wishlist",
  "page_location": "https://example.com/summer-collection/product1234",
  "page_referrer": "https://example.com/summer-collection",
  "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
  "ip": "10.0.0.1",
  "wishlist_id": "wish-001",
  "items": [
    {
      "product_id": "1234",
      "price": 199.99
    }
  ],
  "currency": "EUR"
}
```

<Accordion title="curl examples for add_to_wishlist" icon="code">
  <CodeGroup>
    ```bash POST theme={null}
    DEMA_ID="YOUR-DEMA-ID"
    USER_ID=$(uuidgen)
    NC=$(date +%s%3N)

    curl -X POST "https://tracker.dema.ai/api/track?i=${DEMA_ID}&uid=${USER_ID}&_nc=${NC}&v=2.0.0" \
      -H 'Content-Type: application/json' \
      -d '{
        "event_name": "add_to_wishlist",
        "page_location": "https://example.com/summer-collection/product1234",
        "page_referrer": "https://example.com/summer-collection",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
        "ip": "10.0.0.1",
        "wishlist_id": "wish-001",
        "items": [
          {
            "product_id": "1234",
            "price": 199.99
          }
        ],
        "currency": "EUR"
      }'
    ```

    ```bash GET theme={null}
    DEMA_ID="YOUR-DEMA-ID"
    USER_ID=$(uuidgen)
    NC=$(date +%s%3N)

    curl "https://tracker.dema.ai/api/track?i=${DEMA_ID}&uid=${USER_ID}&_nc=${NC}&v=2.0.0&m=%7B%22event_name%22%3A%22add_to_wishlist%22%2C%22page_location%22%3A%22https%3A%2F%2Fexample.com%2Fsummer-collection%2Fproduct1234%22%2C%22page_referrer%22%3A%22https%3A%2F%2Fexample.com%2Fsummer-collection%22%2C%22user_agent%22%3A%22Mozilla%2F5.0+%28Windows+NT+10.0%3B+Win64%3B+x64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F91.0.4472.124+Safari%2F537.36%22%2C%22ip%22%3A%2210.0.0.1%22%2C%22wishlist_id%22%3A%22wish-001%22%2C%22items%22%3A%5B%7B%22product_id%22%3A%221234%22%2C%22price%22%3A199.99%7D%5D%2C%22currency%22%3A%22EUR%22%7D"
    ```
  </CodeGroup>
</Accordion>

[↑ Back to supported event types](#supported-event-types)

***

### remove\_from\_wishlist

Sent when a user removes a product from their wishlist:

```json theme={null}
{
  "event_name": "remove_from_wishlist",
  "page_location": "https://example.com/wishlist",
  "page_referrer": "https://example.com/summer-collection/product1234",
  "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
  "ip": "10.0.0.1",
  "wishlist_id": "wish-001",
  "items": [
    {
      "product_id": "1234",
      "price": 199.99
    }
  ],
  "currency": "EUR"
}
```

<Accordion title="curl examples for remove_from_wishlist" icon="code">
  <CodeGroup>
    ```bash POST theme={null}
    DEMA_ID="YOUR-DEMA-ID"
    USER_ID=$(uuidgen)
    NC=$(date +%s%3N)

    curl -X POST "https://tracker.dema.ai/api/track?i=${DEMA_ID}&uid=${USER_ID}&_nc=${NC}&v=2.0.0" \
      -H 'Content-Type: application/json' \
      -d '{
        "event_name": "remove_from_wishlist",
        "page_location": "https://example.com/wishlist",
        "page_referrer": "https://example.com/summer-collection/product1234",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
        "ip": "10.0.0.1",
        "wishlist_id": "wish-001",
        "items": [
          {
            "product_id": "1234",
            "price": 199.99
          }
        ],
        "currency": "EUR"
      }'
    ```

    ```bash GET theme={null}
    DEMA_ID="YOUR-DEMA-ID"
    USER_ID=$(uuidgen)
    NC=$(date +%s%3N)

    curl "https://tracker.dema.ai/api/track?i=${DEMA_ID}&uid=${USER_ID}&_nc=${NC}&v=2.0.0&m=%7B%22event_name%22%3A%22remove_from_wishlist%22%2C%22page_location%22%3A%22https%3A%2F%2Fexample.com%2Fwishlist%22%2C%22page_referrer%22%3A%22https%3A%2F%2Fexample.com%2Fsummer-collection%2Fproduct1234%22%2C%22user_agent%22%3A%22Mozilla%2F5.0+%28Windows+NT+10.0%3B+Win64%3B+x64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F91.0.4472.124+Safari%2F537.36%22%2C%22ip%22%3A%2210.0.0.1%22%2C%22wishlist_id%22%3A%22wish-001%22%2C%22items%22%3A%5B%7B%22product_id%22%3A%221234%22%2C%22price%22%3A199.99%7D%5D%2C%22currency%22%3A%22EUR%22%7D"
    ```
  </CodeGroup>
</Accordion>

[↑ Back to supported event types](#supported-event-types)

***

### begin\_checkout

Sent when a user starts the checkout process:

```json theme={null}
{
  "event_name": "begin_checkout",
  "page_location": "https://example.com/checkout",
  "page_referrer": "https://example.com/cart",
  "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
  "ip": "10.0.0.1",
  "items": [
    {
      "product_id": "1234",
      "variant_no": "sku1234",
      "price": 199.99,
      "quantity": 1
    },
    {
      "product_id": "5678",
      "variant_no": "sku5678",
      "price": 49.99,
      "quantity": 2
    }
  ],
  "currency": "EUR"
}
```

<Accordion title="curl examples for begin_checkout" icon="code">
  <CodeGroup>
    ```bash POST theme={null}
    DEMA_ID="YOUR-DEMA-ID"
    USER_ID=$(uuidgen)
    NC=$(date +%s%3N)

    curl -X POST "https://tracker.dema.ai/api/track?i=${DEMA_ID}&uid=${USER_ID}&_nc=${NC}&v=2.0.0" \
      -H 'Content-Type: application/json' \
      -d '{
        "event_name": "begin_checkout",
        "page_location": "https://example.com/checkout",
        "page_referrer": "https://example.com/cart",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
        "ip": "10.0.0.1",
        "items": [
          {
            "product_id": "1234",
            "variant_no": "sku1234",
            "price": 199.99,
            "quantity": 1
          },
          {
            "product_id": "5678",
            "variant_no": "sku5678",
            "price": 49.99,
            "quantity": 2
          }
        ],
        "currency": "EUR"
      }'
    ```

    ```bash GET theme={null}
    DEMA_ID="YOUR-DEMA-ID"
    USER_ID=$(uuidgen)
    NC=$(date +%s%3N)

    curl "https://tracker.dema.ai/api/track?i=${DEMA_ID}&uid=${USER_ID}&_nc=${NC}&v=2.0.0&m=%7B%22event_name%22%3A%22begin_checkout%22%2C%22page_location%22%3A%22https%3A%2F%2Fexample.com%2Fcheckout%22%2C%22page_referrer%22%3A%22https%3A%2F%2Fexample.com%2Fcart%22%2C%22user_agent%22%3A%22Mozilla%2F5.0+%28Windows+NT+10.0%3B+Win64%3B+x64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F91.0.4472.124+Safari%2F537.36%22%2C%22ip%22%3A%2210.0.0.1%22%2C%22items%22%3A%5B%7B%22product_id%22%3A%221234%22%2C%22variant_no%22%3A%22sku1234%22%2C%22price%22%3A199.99%2C%22quantity%22%3A1%7D%2C%7B%22product_id%22%3A%225678%22%2C%22variant_no%22%3A%22sku5678%22%2C%22price%22%3A49.99%2C%22quantity%22%3A2%7D%5D%2C%22currency%22%3A%22EUR%22%7D"
    ```
  </CodeGroup>
</Accordion>

[↑ Back to supported event types](#supported-event-types)

***

## Event data schema reference

The event detail payload must conform to the **TrackedEventData** schema. Below is a summary of the available fields.

<Accordion title="View full TrackedEventData JSON schema">
  ```json theme={null}
  {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "title": "TrackedEventData",
    "description": "Payload containing event data sent with a server-side tracking request.",
    "type": "object",
    "required": ["event_name"],
    "properties": {
      "event_name": {
        "type": "string",
        "description": "Name of the tracked event."
      },
      "type": {
        "type": "string",
        "description": "Event-specific type. For example, for order events the type can be set to `EXCLUDED` to prevent the order from appearing in the platform."
      },
      "user_agent": {
        "type": "string",
        "description": "User agent string of the client sending the tracked event."
      },
      "ip": {
        "type": "string",
        "description": "IP address sent in tracking event or resolved by the tracking system."
      },
      "country": {
        "type": "string",
        "description": "Two-letter ISO 3166-1 alpha-2 country code. When provided, overrides the country resolved from the IP address."
      },
      "region": {
        "type": "string",
        "description": "Region (state/province). When provided, overrides the region resolved from the IP address."
      },
      "zip_code": {
        "type": "string",
        "description": "ZIP/postal code. When provided, overrides the ZIP/postal code resolved from the IP address."
      },
      "city": {
        "type": "string",
        "description": "City. When provided, overrides the city resolved from the IP address."
      },
      "latitude": {
        "type": "number",
        "description": "Latitude coordinate. When provided, overrides the latitude resolved from the IP address."
      },
      "longitude": {
        "type": "number",
        "description": "Longitude coordinate. When provided, overrides the longitude resolved from the IP address."
      },
      "page_id": {
        "type": "string",
        "description": "Language-agnostic identifier of the page on which the event occurred."
      },
      "page_location": {
        "type": "string",
        "description": "Full URL of the page on which the event occurred."
      },
      "page_title": {
        "type": "string",
        "description": "Title of the page on which the event occurred."
      },
      "page_referrer": {
        "type": "string",
        "description": "Referrer URL from which the user navigated to the current page."
      },
      "cart_id": {
        "type": "string",
        "description": "Identifier of the shopping cart."
      },
      "wishlist_id": {
        "type": "string",
        "description": "Identifier of the wishlist."
      },
      "items": {
        "type": "array",
        "description": "List of items associated with the tracked event.",
        "items": {
          "$ref": "#/definitions/TrackedEventDataItem"
        }
      },
      "order_id": {
        "type": "string",
        "description": "Identifier of the order associated with the tracked event."
      },
      "currency": {
        "type": "string",
        "description": "Three letter ISO 4217 Currency code for the transaction."
      },
      "total": {
        "type": "number",
        "description": "Total value of the transaction, including items, tax and shipping."
      },
      "tax": {
        "type": "number",
        "description": "Total tax amount for the transaction including shipping tax."
      },
      "shipping": {
        "type": "number",
        "description": "Shipping cost for the transaction including tax."
      },
      "payment_provider": {
        "type": "string",
        "description": "Payment provider used for the transaction."
      },
      "shipping_provider": {
        "type": "string",
        "description": "Shipping provider used for the transaction."
      },
      "customer_id": {
        "type": "string",
        "description": "Identifier of the customer."
      },
      "vouchers": {
        "type": "array",
        "description": "List of vouchers applied in the transaction.",
        "items": {
          "$ref": "#/definitions/TrackedEventDataVoucher"
        }
      },
      "custom_attribute_1": { "type": "string", "description": "Custom attribute on tracked event level." },
      "custom_attribute_2": { "type": "string", "description": "Custom attribute on tracked event level." },
      "custom_attribute_3": { "type": "string", "description": "Custom attribute on tracked event level." },
      "custom_attribute_4": { "type": "string", "description": "Custom attribute on tracked event level." },
      "custom_attribute_5": { "type": "string", "description": "Custom attribute on tracked event level." },
      "custom_attribute_6": { "type": "string", "description": "Custom attribute on tracked event level." },
      "custom_attribute_7": { "type": "string", "description": "Custom attribute on tracked event level." },
      "custom_attribute_8": { "type": "string", "description": "Custom attribute on tracked event level." },
      "custom_attribute_9": { "type": "string", "description": "Custom attribute on tracked event level." },
      "custom_attribute_10": { "type": "string", "description": "Custom attribute on tracked event level." },
      "custom_attribute_11": { "type": "string", "description": "Custom attribute on tracked event level." },
      "custom_attribute_12": { "type": "string", "description": "Custom attribute on tracked event level." },
      "custom_attribute_13": { "type": "string", "description": "Custom attribute on tracked event level." },
      "custom_attribute_14": { "type": "string", "description": "Custom attribute on tracked event level." },
      "custom_attribute_15": { "type": "string", "description": "Custom attribute on tracked event level." },
      "custom_attribute_16": { "type": "string", "description": "Custom attribute on tracked event level." },
      "custom_attribute_17": { "type": "string", "description": "Custom attribute on tracked event level." },
      "custom_attribute_18": { "type": "string", "description": "Custom attribute on tracked event level." },
      "custom_attribute_19": { "type": "string", "description": "Custom attribute on tracked event level." },
      "custom_attribute_20": { "type": "string", "description": "Custom attribute on tracked event level." },
      "custom_attribute_1_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
      "custom_attribute_2_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
      "custom_attribute_3_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
      "custom_attribute_4_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
      "custom_attribute_5_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
      "custom_attribute_6_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
      "custom_attribute_7_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
      "custom_attribute_8_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
      "custom_attribute_9_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
      "custom_attribute_10_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
      "custom_attribute_11_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
      "custom_attribute_12_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
      "custom_attribute_13_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
      "custom_attribute_14_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
      "custom_attribute_15_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
      "custom_attribute_16_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
      "custom_attribute_17_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
      "custom_attribute_18_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
      "custom_attribute_19_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
      "custom_attribute_20_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
      "custom_attribute_1_float": { "type": "number", "description": "Custom attribute float value on tracked event level." },
      "custom_attribute_2_float": { "type": "number", "description": "Custom attribute float value on tracked event level." },
      "custom_attribute_3_float": { "type": "number", "description": "Custom attribute float value on tracked event level." },
      "custom_attribute_4_float": { "type": "number", "description": "Custom attribute float value on tracked event level." },
      "custom_attribute_5_float": { "type": "number", "description": "Custom attribute float value on tracked event level." },
      "custom_attribute_6_float": { "type": "number", "description": "Custom attribute float value on tracked event level." },
      "custom_attribute_7_float": { "type": "number", "description": "Custom attribute float value on tracked event level." },
      "custom_attribute_8_float": { "type": "number", "description": "Custom attribute float value on tracked event level." },
      "custom_attribute_9_float": { "type": "number", "description": "Custom attribute float value on tracked event level." },
      "custom_attribute_10_float": { "type": "number", "description": "Custom attribute float value on tracked event level." },
      "custom_attribute_11_float": { "type": "number", "description": "Custom attribute float value on tracked event level." },
      "custom_attribute_12_float": { "type": "number", "description": "Custom attribute float value on tracked event level." },
      "custom_attribute_13_float": { "type": "number", "description": "Custom attribute float value on tracked event level." },
      "custom_attribute_14_float": { "type": "number", "description": "Custom attribute float value on tracked event level." },
      "custom_attribute_15_float": { "type": "number", "description": "Custom attribute float value on tracked event level." },
      "custom_attribute_16_float": { "type": "number", "description": "Custom attribute float value on tracked event level." },
      "custom_attribute_17_float": { "type": "number", "description": "Custom attribute float value on tracked event level." },
      "custom_attribute_18_float": { "type": "number", "description": "Custom attribute float value on tracked event level." },
      "custom_attribute_19_float": { "type": "number", "description": "Custom attribute float value on tracked event level." },
      "custom_attribute_20_float": { "type": "number", "description": "Custom attribute float value on tracked event level." }
    },
    "additionalProperties": false,
    "definitions": {
      "TrackedEventDataItem": {
        "type": "object",
        "required": ["product_id"],
        "description": "Item line associated with a tracked event.",
        "properties": {
          "index": {
            "type": "integer",
            "description": "Index of the item line in the tracked event. This value is event context specific e.g. in select_item event it represents the index of the item in the list that was selected, in add_to_cart event it represents the index of the item in the cart etc."
          },
          "product_id": { "type": "string", "description": "Product identifier used for identifying the product in the external system." },
          "variant_no": { "type": "string", "description": "Identifier of the specific product variant." },
          "quantity": { "type": "number", "description": "Quantity of the item line." },
          "price": { "type": "number", "description": "Price of a single item unit." },
          "warehouse": { "type": "string", "description": "Warehouse associated with the item. Use the same warehouse names consistently across orders, inventory, and indeliveries — we recommend using human-readable names rather than internal IDs." },
          "custom_attribute_1": { "type": "string", "description": "Custom attribute on tracked event item level." },
          "custom_attribute_2": { "type": "string", "description": "Custom attribute on tracked event item level." },
          "custom_attribute_3": { "type": "string", "description": "Custom attribute on tracked event item level." },
          "custom_attribute_4": { "type": "string", "description": "Custom attribute on tracked event item level." },
          "custom_attribute_5": { "type": "string", "description": "Custom attribute on tracked event item level." },
          "custom_attribute_6": { "type": "string", "description": "Custom attribute on tracked event item level." },
          "custom_attribute_7": { "type": "string", "description": "Custom attribute on tracked event item level." },
          "custom_attribute_8": { "type": "string", "description": "Custom attribute on tracked event item level." },
          "custom_attribute_9": { "type": "string", "description": "Custom attribute on tracked event item level." },
          "custom_attribute_10": { "type": "string", "description": "Custom attribute on tracked event item level." },
          "custom_attribute_11": { "type": "string", "description": "Custom attribute on tracked event item level." },
          "custom_attribute_12": { "type": "string", "description": "Custom attribute on tracked event item level." },
          "custom_attribute_13": { "type": "string", "description": "Custom attribute on tracked event item level." },
          "custom_attribute_14": { "type": "string", "description": "Custom attribute on tracked event item level." },
          "custom_attribute_15": { "type": "string", "description": "Custom attribute on tracked event item level." },
          "custom_attribute_16": { "type": "string", "description": "Custom attribute on tracked event item level." },
          "custom_attribute_17": { "type": "string", "description": "Custom attribute on tracked event item level." },
          "custom_attribute_18": { "type": "string", "description": "Custom attribute on tracked event item level." },
          "custom_attribute_19": { "type": "string", "description": "Custom attribute on tracked event item level." },
          "custom_attribute_20": { "type": "string", "description": "Custom attribute on tracked event item level." },
          "custom_attribute_1_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
          "custom_attribute_2_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
          "custom_attribute_3_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
          "custom_attribute_4_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
          "custom_attribute_5_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
          "custom_attribute_6_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
          "custom_attribute_7_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
          "custom_attribute_8_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
          "custom_attribute_9_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
          "custom_attribute_10_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
          "custom_attribute_11_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
          "custom_attribute_12_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
          "custom_attribute_13_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
          "custom_attribute_14_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
          "custom_attribute_15_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
          "custom_attribute_16_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
          "custom_attribute_17_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
          "custom_attribute_18_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
          "custom_attribute_19_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
          "custom_attribute_20_meta": { "$ref": "#/definitions/CustomAttributeMeta" },
          "custom_attribute_1_float": { "type": "number", "description": "Custom attribute float value on tracked event item level." },
          "custom_attribute_2_float": { "type": "number", "description": "Custom attribute float value on tracked event item level." },
          "custom_attribute_3_float": { "type": "number", "description": "Custom attribute float value on tracked event item level." },
          "custom_attribute_4_float": { "type": "number", "description": "Custom attribute float value on tracked event item level." },
          "custom_attribute_5_float": { "type": "number", "description": "Custom attribute float value on tracked event item level." },
          "custom_attribute_6_float": { "type": "number", "description": "Custom attribute float value on tracked event item level." },
          "custom_attribute_7_float": { "type": "number", "description": "Custom attribute float value on tracked event item level." },
          "custom_attribute_8_float": { "type": "number", "description": "Custom attribute float value on tracked event item level." },
          "custom_attribute_9_float": { "type": "number", "description": "Custom attribute float value on tracked event item level." },
          "custom_attribute_10_float": { "type": "number", "description": "Custom attribute float value on tracked event item level." },
          "custom_attribute_11_float": { "type": "number", "description": "Custom attribute float value on tracked event item level." },
          "custom_attribute_12_float": { "type": "number", "description": "Custom attribute float value on tracked event item level." },
          "custom_attribute_13_float": { "type": "number", "description": "Custom attribute float value on tracked event item level." },
          "custom_attribute_14_float": { "type": "number", "description": "Custom attribute float value on tracked event item level." },
          "custom_attribute_15_float": { "type": "number", "description": "Custom attribute float value on tracked event item level." },
          "custom_attribute_16_float": { "type": "number", "description": "Custom attribute float value on tracked event item level." },
          "custom_attribute_17_float": { "type": "number", "description": "Custom attribute float value on tracked event item level." },
          "custom_attribute_18_float": { "type": "number", "description": "Custom attribute float value on tracked event item level." },
          "custom_attribute_19_float": { "type": "number", "description": "Custom attribute float value on tracked event item level." },
          "custom_attribute_20_float": { "type": "number", "description": "Custom attribute float value on tracked event item level." }
        },
        "additionalProperties": false
      },
      "TrackedEventDataVoucher": {
        "type": "object",
        "description": "A voucher (discount) applied to the transaction.",
        "required": ["code"],
        "properties": {
          "code": { "type": "string", "description": "The voucher's redemption code." },
          "name": { "type": "string", "description": "Voucher name." },
          "discount": { "type": "number", "description": "Value of the voucher discount." },
          "type": { "type": "string", "description": "Type of the discount." }
        },
        "additionalProperties": false
      },
      "CustomAttributeMeta": {
        "type": "object",
        "description": "Per-slot semantics for a custom attribute value. Omitting the companion meta field means plain text.",
        "properties": {
          "dataType": {
            "type": "string",
            "description": "Value type: TEXT (dimension), NUMERIC (unit-less metric), MONETARY (metric requiring currency conversion)."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 source currency for MONETARY values. Ignored for TEXT/NUMERIC."
          },
          "features": {
            "type": "array",
            "items": { "type": "string" },
            "description": "Opt-in behaviour flags. Supported value: SPLIT_ACROSS_ORDER_LINES."
          }
        },
        "additionalProperties": false
      }
    }
  }
  ```
</Accordion>

### Event fields

<AccordionGroup>
  <Accordion title="Required fields" icon="asterisk">
    <ResponseField name="event_name" type="string" required>
      Name of the tracked event (e.g., `page_view`, `view_item`, `purchase`).
    </ResponseField>
  </Accordion>

  <Accordion title="Page & navigation fields" icon="globe">
    <ResponseField name="page_location" type="string">
      Full URL of the page where the event occurred.
    </ResponseField>

    <ResponseField name="page_referrer" type="string">
      Referrer URL from which the user navigated to the current page.
    </ResponseField>

    <ResponseField name="page_title" type="string">
      Title of the page where the event occurred.
    </ResponseField>

    <ResponseField name="page_id" type="string">
      Language-agnostic identifier of the page on which the event occurred.
    </ResponseField>
  </Accordion>

  <Accordion title="Client & location fields" icon="location-dot">
    <ResponseField name="user_agent" type="string">
      User agent string of the client sending the tracked event.
    </ResponseField>

    <ResponseField name="ip" type="string">
      IP address of the client. Used to resolve location fields if not provided explicitly.
    </ResponseField>

    <ResponseField name="country" type="string">
      Two-letter ISO 3166-1 alpha-2 country code. When provided, overrides the country resolved from the IP address.
    </ResponseField>

    <ResponseField name="region" type="string">
      Region (state/province). When provided, overrides the region resolved from the IP address.
    </ResponseField>

    <ResponseField name="city" type="string">
      City. When provided, overrides the city resolved from the IP address.
    </ResponseField>

    <ResponseField name="zip_code" type="string">
      ZIP/postal code. When provided, overrides the ZIP/postal code resolved from the IP address.
    </ResponseField>

    <ResponseField name="latitude" type="number">
      Latitude coordinate. When provided, overrides the latitude resolved from the IP address.
    </ResponseField>

    <ResponseField name="longitude" type="number">
      Longitude coordinate. When provided, overrides the longitude resolved from the IP address.
    </ResponseField>
  </Accordion>

  <Accordion title="Event detail fields" icon="list-check">
    <ResponseField name="type" type="string">
      Event-specific type. For example, for order events the type can be set to `EXCLUDED` to prevent the order from appearing in the platform.
    </ResponseField>

    <ResponseField name="order_id" type="string">
      Identifier of the order associated with the tracked event.
    </ResponseField>

    <ResponseField name="customer_id" type="string">
      Identifier of the customer. Typically an email address, but can be any consistent identifier.
    </ResponseField>

    <ResponseField name="currency" type="string">
      Three-letter ISO 4217 currency code (e.g., `EUR`, `USD`).
    </ResponseField>

    <ResponseField name="total" type="number">
      Total value of the transaction, including items, tax, and shipping.
    </ResponseField>

    <ResponseField name="tax" type="number">
      Total tax amount for the transaction including shipping tax.
    </ResponseField>

    <ResponseField name="shipping" type="number">
      Shipping cost for the transaction including tax.
    </ResponseField>

    <ResponseField name="payment_provider" type="string">
      Payment provider used for the transaction.
    </ResponseField>

    <ResponseField name="shipping_provider" type="string">
      Shipping provider used for the transaction.
    </ResponseField>

    <ResponseField name="cart_id" type="string">
      Identifier of the shopping cart.
    </ResponseField>

    <ResponseField name="wishlist_id" type="string">
      Identifier of the wishlist.
    </ResponseField>

    <ResponseField name="items" type="array">
      List of items associated with the event. See [item fields](#item-fields-items) below.
    </ResponseField>

    <ResponseField name="vouchers" type="array">
      List of vouchers applied to the transaction. See [voucher fields](#voucher-fields-vouchers) below.
    </ResponseField>
  </Accordion>

  <Accordion title="Custom attributes" icon="tags">
    <ResponseField name="custom_attribute_1 – custom_attribute_20" type="string">
      Text value for the custom event-level attribute slot (slots 1–20). Use this field when the attribute is a text dimension.
    </ResponseField>

    <ResponseField name="custom_attribute_1_float – custom_attribute_20_float" type="number">
      Numeric value for the custom event-level attribute slot. Use this field when the attribute is a numeric or monetary metric.
    </ResponseField>

    <ResponseField name="custom_attribute_1_meta – custom_attribute_20_meta" type="object">
      Controls which slot Dema reads for this attribute and how the value is processed. Without meta, the string slot is treated as a plain text dimension. Set `dataType` to `NUMERIC` or `MONETARY` to have Dema read the float slot as a metric — monetary values are then converted to the merchant currency using `currency` as the source currency, and `SPLIT_ACROSS_ORDER_LINES` can be added to `features` to distribute an order-level value across order lines. See [CustomAttributeMeta](#customattributemeta) below.
    </ResponseField>
  </Accordion>
</AccordionGroup>

### Item fields (`items[]`)

<AccordionGroup>
  <Accordion title="Required fields" icon="asterisk">
    <ResponseField name="product_id" type="string" required>
      Product identifier used for identifying the product in the external system.
    </ResponseField>
  </Accordion>

  <Accordion title="Optional fields" icon="list">
    <ResponseField name="index" type="integer">
      Index of the item line in the tracked event. Event context specific — e.g., in `select_item` it represents the item's position in the list; in `add_to_cart` it represents the item's position in the cart.
    </ResponseField>

    <ResponseField name="variant_no" type="string">
      Identifier of the specific product variant.
    </ResponseField>

    <ResponseField name="quantity" type="number">
      Quantity of the item line.
    </ResponseField>

    <ResponseField name="price" type="number">
      Price of a single item unit.
    </ResponseField>

    <ResponseField name="warehouse" type="string">
      Warehouse associated with the item. Use the same warehouse names consistently across orders, inventory, and indeliveries — we recommend using human-readable names rather than internal IDs.
    </ResponseField>

    <ResponseField name="custom_attribute_1 – custom_attribute_20" type="string">
      Text value for the custom item-level attribute slot (slots 1–20). Use this field when the attribute is a text dimension.
    </ResponseField>

    <ResponseField name="custom_attribute_1_float – custom_attribute_20_float" type="number">
      Numeric value for the custom item-level attribute slot. Use this field when the attribute is a numeric or monetary metric.
    </ResponseField>

    <ResponseField name="custom_attribute_1_meta – custom_attribute_20_meta" type="object">
      Controls which slot Dema reads for this attribute and how the value is processed. Without meta, the string slot is treated as a plain text dimension. Set `dataType` to `NUMERIC` or `MONETARY` to have Dema read the float slot as a metric — monetary values are then converted to the merchant currency using `currency` as the source currency. See [CustomAttributeMeta](#customattributemeta) below.
    </ResponseField>
  </Accordion>
</AccordionGroup>

### Voucher fields (`vouchers[]`)

<AccordionGroup>
  <Accordion title="Required fields" icon="asterisk">
    <ResponseField name="code" type="string" required>
      The voucher's redemption code.
    </ResponseField>
  </Accordion>

  <Accordion title="Optional fields" icon="list">
    <ResponseField name="name" type="string">
      Voucher name.
    </ResponseField>

    <ResponseField name="discount" type="number">
      Value of the voucher discount.
    </ResponseField>

    <ResponseField name="type" type="string">
      Type of the discount.
    </ResponseField>
  </Accordion>
</AccordionGroup>

### CustomAttributeMeta

The `custom_attribute_N_meta` companion controls which slot Dema reads for the attribute and how it is processed. Without it, the string slot is used as a plain text dimension and the float slot is ignored.

| Field      | Type      | Description                                                                                                                                                                                                                                                      |
| ---------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `dataType` | string    | `TEXT` — read the string slot as a text dimension (default when meta is omitted). `NUMERIC` — read the float slot as a unit-less metric. `MONETARY` — read the float slot as a monetary metric and convert to the merchant currency using `currency`.            |
| `currency` | string    | ISO 4217 source currency of the float value (e.g. `EUR`). Required when `dataType` is `MONETARY`; ignored otherwise.                                                                                                                                             |
| `features` | string\[] | Opt-in processing flags. `SPLIT_ACROSS_ORDER_LINES` — event-level attributes only. Distributes an order-level value across order lines by contributing weight (the same mechanism used for shipping and logistic costs). Has no effect on item-level attributes. |

***

## Additional notes

* Ensure all URL parameters are properly URL-encoded when using GET requests.
* The `uid` (unique user ID) must be managed server-side. This ID should be a valid UUIDv4 and remain consistent across events to accurately track user behavior.
