Event reporting
Event reporting is used to track user interactions in the search results page that cannot be automatically registered by LupaSearch server, but are useful for search result relevance and can be used in Statistical Boosting, Personalization and is displayed in Analytics to better understand your users behavior.
User interactions include three action types:
Item click - user clicks on a product in search results and is redirected to the page for that product;
Add to cart click - user clicks on add to cart button in search result page;
Suggestion click - user clicks on autocomplete suggestion string.
Event reporting is completely optional. However, without reported events, some of the LupaSearch features, like Personalization and Statistical Boosting will not be available.
Events API
API Reference: Events API
Item / Add to cart click
All event types have the same request body:
{
"queryKey": "ax2q422v8f7z",
"name": "itemClick",
"searchQuery": "television",
"itemId": "66419592",
"sessionId": "x-session-id-1",
"userId": "x-user-id-1"
}
queryKey
- query key that was used to generate search results that the user is interacting with;name
- name of the event. One ofitemClick
oraddToCart
;searchQuery
- original search query that yielded these search results, i.e. what user has typed in the search box input;itemId
- id of an item that the user is interacting with (id
field value that is configured asid
in your Search Index Mapping);sessionId
- anonymous search session id. Can be any string, and should correspond to a unique search session in your e-shop. For example, can be generated when a new session is started and saved into browser's session storage.userId
- anonymous user id. Can be any string that should correspond to a unique user in your e-shop. LupaSearch only saves hashed values for this property.
Suggestion click
Suggestion click event body slightly differs in a way that instead of product id for itemId
field, you need to pass the string value of a clicked suggestion:
{
"queryKey": "ax2q422v8f7z",
"name": "suggestionClick",
"searchQuery": "tel",
"itemId": "television",
"sessionId": "x-session-id-1",
"userId": "x-user-id-1"
}
User and session reporting for Public Query
LupaSearch automatically tracks generic search events - requests to the public query endpoints.
To enable more detailed tracking (which is required for Personalization), public query request can also include sessionId
and userId
:
{
"searchText": "tv",
"sessionId": "x-session-id-1",
"userId": "x-user-id-1"
}