|
| 1 | +--- |
| 2 | +title: Configure Meilisearch Cloud analytics events |
| 3 | +description: By default, Meilisearch Cloud analytics tracks metrics such as number of users and latency. Follow this guide to track advanced events such as user conversion and click-through rates. |
| 4 | +--- |
| 5 | + |
| 6 | +import CodeSamplesAnalyticsEventConversion1 from '/snippets/samples/code_samples_analytics_event_conversion_1.mdx'; |
| 7 | +import CodeSamplesAnalyticsEventClick1 from '/snippets/samples/code_samples_analytics_event_click_1.mdx'; |
| 8 | + |
| 9 | +## Requirements |
| 10 | + |
| 11 | +You must have a [Meilisearch Cloud](https://meilisearch.com/cloud) account to access search analytics. |
| 12 | + |
| 13 | +## Configure click-through rate and average click position |
| 14 | + |
| 15 | +To track click-through rate and average click position, Meilisearch Cloud needs to know when users click on search results. |
| 16 | + |
| 17 | +Every time a user clicks on a search result, your application must send a `click` event to the `POST` endpoint of Meilisearch Cloud analytics route: |
| 18 | + |
| 19 | +<CodeSamplesAnalyticsEventClick1 /> |
| 20 | + |
| 21 | +You must explicitly submit a `userId` associated with the event. This can be any arbitrary string you can use to identify the user, such as their profile ID in your application or their hashed IP address. You may submit user IDs directly on the event payload, or setting a `X-MS-USER-ID` request header. |
| 22 | + |
| 23 | +Specifying a `queryUid` is optional but recommended as it ensures Meilisearch correctly associates the search query with the event. You can find the query UID in the `metadata` field present in Meilisearch Cloud's search query response. |
| 24 | + |
| 25 | +For more information, consult the [analytics events endpoint reference](/learn/analytics/events_endpoint). |
| 26 | + |
| 27 | +## Configure conversion rate |
| 28 | + |
| 29 | +To track conversion rate, first identify what should count as a conversion for your application. For example, in a web shop, a conversion might be a user finalizing the checkout process. |
| 30 | + |
| 31 | +Once you have established what counts as a conversion in your application, configure it to send a `conversion` event to the `POST` endpoint of Meilisearch Cloud analytics route: |
| 32 | + |
| 33 | +<CodeSamplesAnalyticsEventConversion1 /> |
| 34 | + |
| 35 | +You must explicitly submit a `userId` associated with the event. This can be any arbitrary string you can use to identify the user, such as their profile ID in your application or their hashed IP address. You may submit user IDs directly on the event payload, or setting a `X-MS-USER-ID` request header. |
| 36 | + |
| 37 | +Specifying a `queryUid` is optional but recommended as it ensures Meilisearch correctly associates the search query with the event. You can find the query UID in the `metadata` field present in Meilisearch Cloud's search query response. |
| 38 | + |
| 39 | +<Note> |
| 40 | +It is not possible to associate multiple `conversion` events with the same query. |
| 41 | +</Note> |
| 42 | + |
| 43 | +For more information, consult the [analytics events endpoint reference](/learn/analytics/events_endpoint). |
0 commit comments