Configure click-through rate and average click position
To track click-through rate and average click position, Meilisearch needs to know when users click on search results. Every time a user clicks on a search result, your application must send aclick event to the POST /events endpoint:
userId associated with the event. This can be any arbitrary string you 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.
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 search query responses.
For more information, consult the analytics events endpoint reference.
Configure conversion rate
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. Once you have established what is a conversion in your application, configure it to send aconversion event to the POST /events endpoint:
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.
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 search query responses.
It is not possible to associate multiple
conversion events with the same query.Retrieve search identifiers with metadata
To associate analytics events with specific search queries, you need the query’s unique identifier. Include theMeili-Include-Metadata header in your search requests to receive this information:
metadata field:
queryUid value when sending click or conversion events. This ensures Meilisearch correctly links user interactions to the search query that produced them.
In a multi-search request, all sub-queries share the same requestUid but each has its own queryUid. Use the queryUid matching the specific sub-query result the user interacted with.
Attach custom fields to search requests
You can include additional metadata with your search requests using theanalyticsCustomFields parameter. Custom fields are stored alongside the search event and available for analysis in the dashboard:
analyticsCustomFields parameter is stripped from the request before it reaches the search engine, so it does not affect search results.