Skip to content

Commit 2105208

Browse files
add guide on analytics event configuration, remove previous guides
1 parent f4c073f commit 2105208

File tree

5 files changed

+48
-114
lines changed

5 files changed

+48
-114
lines changed

.code-samples.meilisearch.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1285,21 +1285,24 @@ analytics_event_click_1: |-
12851285
"eventType": "click",
12861286
"eventName": "Search Result Clicked",
12871287
"indexUid": "products",
1288+
"userId": "SEARCH_USER_ID",
12881289
"queryUid": "019a01b7-a1c2-7782-a410-bb1274c81393",
12891290
"objectId": "0",
12901291
"objectName": "DOCUMENT_DESCRIPTION",
12911292
"position": 0
12921293
}'
12931294
analytics_event_conversion_1: |-
12941295
curl \
1295-
-X POST 'https://edge.meilisearch.com/events' \
1296+
-X POST 'https://PROJECT_URL/events' \
12961297
-H 'Content-Type: application/json' \
12971298
-H 'Authorization: Bearer DEFAULT_SEARCH_API_KEY'
12981299
--data-binary '{
12991300
"eventType": "conversion",
13001301
"eventName": "Product Added To Cart",
13011302
"indexUid": "products",
1303+
"userId": "SEARCH_USER_ID",
13021304
"objectId": "0",
1305+
"objectName": "DOCUMENT_DESCRIPTION",
13031306
"position": 0
13041307
}'
13051308
analytics_event_bind_search_1: |-

docs.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,7 @@
206206
{
207207
"group": "Analytics",
208208
"pages": [
209-
"learn/analytics/configure_analytics",
210-
"learn/analytics/configure_monitoring",
209+
"learn/analytics/configure_analytics_events",
211210
"learn/analytics/bind_events_user",
212211
"learn/analytics/migrate_analytics_monitoring",
213212
"learn/analytics/events_endpoint"

learn/analytics/configure_analytics.mdx

Lines changed: 0 additions & 71 deletions
This file was deleted.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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).

learn/analytics/configure_monitoring.mdx

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)