Jun 23, 2025
Retrieve top search results
Retrieves the object IDs of the 1,000 most frequent search results.
If you set the clickAnalytics query parameter to true, the response also includes:
- Tracked searches count. Tracked searches are Search API requests with the
clickAnalyticsparameter set totrue. This differs from the response’scount, which shows the overall number of searches, including those whereclickAnalyticsisfalse. - Click count
- Click-through rate (CTR)
- Conversion count
- Conversion rate (CR)
- Average click position
If you set the revenueAnalytics parameter to true, the response also includes:
- Add-to-cart count
- Add-to-cart rate (ATCR)
- Purchase count
- Purchase rate
- Revenue details for each currency
There’s a difference between 0% rates and null rates:
- Null means there were no queries: since Algolia didn’t receive any events, the rates (CTR, CR, ATCR, purchase rate) are null.
- 0% rates mean there were queries but no click or conversion events were received.
Usage
Required ACL:
analytics
Copy
1
2
3
4
5
require "algolia"
client = Algolia::AnalyticsClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")
response = client.get_top_hits("index")
Did you find this page helpful?