When sending click events with a queryID
to the Insights API, you must pass an array of positions as the value for the positions
parameter with one position per objectID
.
For example (in Python):
insights.send_events( [ { "eventType": "click", "eventName": "Clicked Example", "index": "your_index_name", "userToken": "user-123456", "timestamp": 1683288235623, "objectIDs": ["objectID-1", "objectID-2"], "queryID": "queryID", "positions": [17, 19] } ] )
Algolia uses this parameter to calculate the average click position.
If you’re using InstantSearch, you can get the position through the hit.__position
attribute.
If you do not send the same number of positions and objectIDs (or if you don't send any positions, you will get the error 'Event of type click should have the same number of ObjectIDs and Positions'.