Focus on events after search or browse requests
The most important events to consider are those that occur after a search or browse request. For example:- Searches and suggestions: requests with a search query.
- Category, navigation, and brand pages: requests with an empty search query but with applied filters.
queryID parameter.
Without queryID, Algolia canât link the event to the originating search or browse request.
For some conversion events, Algolia can infer the queryID from an earlier click event.
For implementation details, see
Keep track of query IDs.
Events that include a queryID help Algolia determine if results were useful to users.
Basic events flow
Your frontend sends a request to the Search API
The request includes these parameters:
userToken: to identify users (pseudonymously)clickAnalytics: true: to returnqueryID
Search API returns results
The response includes
queryID, object IDs of the matching records, and positions.Your frontend sends an event to the Insights API
Include at least these properties in search-related events:
userTokenqueryIDobjectIDs
queryID automatically.
For details, see Keep track of query IDs.Some event types need more
properties.
For more details, see also the
Insights API reference.Use one stable user identity
TheuserToken identifies a visitor or signed-in user.
Keep it stable during a session.
If your privacy model allows it, keep it stable across sessions too.
A consistent user identity is essential for analytics and Personalization.
You must send the same userToken with your search requests and events.
For identity strategies and persistence options, see
User token.
Before you send userToken, decide how Algolia should treat identity across
sessions, devices, and login states:
-
Pre- and post-login behavior:
use the same
userTokenbefore and after login if those events belong to one user. -
Cross-device identity:
use the same
userTokenacross devices if the same user signs in on each one. This often uses a persistent ID from your customer data platform (CDP). -
Per-session identity:
generate a new anonymous
userTokenfor each session if each session should count as a new user.
Before you send events
- Understand how to maintain a consistent
userToken. - Understand how the
queryIDflows from a search request to events. - Identify every interface where users interact with Algolia results or recommendations.