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

# Analytics events endpoint

> Use `/events` to submit analytics events such as `click` and `conversion` to Meilisearch.

## Send an event

<RouteHighlighter method="POST" path="/events" />

Send an analytics event to Meilisearch.

### Body

| Name         | Type    | Required    | Description                                                                                                  |
| :----------- | :------ | :---------- | :----------------------------------------------------------------------------------------------------------- |
| `eventType`  | String  | Yes         | The event type: `"click"` or `"conversion"`                                                                  |
| `eventName`  | String  | Yes         | A descriptive label for the event                                                                            |
| `indexUid`   | String  | Yes         | The index containing the document the user interacted with                                                   |
| `userId`     | String  | Yes         | An arbitrary string identifying the user who performed the action                                            |
| `queryUid`   | String  | Recommended | The [search query's UID](/reference/api/headers#search-metadata). Links the event to a specific search query |
| `objectId`   | String  | Recommended | The document's primary key value                                                                             |
| `position`   | Integer | Recommended | The document's position in the search result list (0-based). Only relevant for `click` events                |
| `objectName` | String  | No          | A human-readable description of the document                                                                 |

<CodeGroup>
  ```json theme={null}
  {
    "eventType": "click",
    "eventName": "Search Result Clicked",
    "indexUid": "products",
    "objectId": "0",
    "position": 0
  }
  ```
</CodeGroup>

<Note>
  You must provide a string identifying your user if you want Meilisearch to track conversion and click events.

  You may do that in two ways:

  * Specify the user ID in the payload, using the `userId` field
  * Specify the user ID with the `X-MS-USER-ID` header with your `/events` and search requests
</Note>

#### Example

<CodeGroup>
  ```bash cURL theme={null}
  curl \
    -X POST 'https://PROJECT_URL/events' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer DEFAULT_SEARCH_API_KEY' \
    --data-binary '{
      "eventType": "click",
      "eventName": "Search Result Clicked",
      "indexUid": "products",
      "userId": "SEARCH_USER_ID",
      "queryUid": "019a01b7-a1c2-7782-a410-bb1274c81393",
      "objectId": "0",
      "objectName": "DOCUMENT_DESCRIPTION",
      "position": 0
    }'
  ```
</CodeGroup>

##### Response: `201 Created`

## Next steps

<CardGroup cols={2}>
  <Card title="Get started with analytics" href="/capabilities/analytics/getting_started">
    Set up analytics and start collecting search data.
  </Card>

  <Card title="Bind events to a user" href="/capabilities/analytics/how_to/bind_events_to_user">
    Associate analytics events with specific users for accurate tracking.
  </Card>

  <Card title="Track click events" href="/capabilities/analytics/how_to/track_click_events">
    Configure your application to send click events to Meilisearch.
  </Card>
</CardGroup>
