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 clickAnalytics parameter set to true. This differs from the response’s count, which shows the overall number of searches, including those where clickAnalytics is false.
  • 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
1
2
3
4
5
6
7
use Algolia\AlgoliaSearch\Api\AnalyticsClient;

$client = AnalyticsClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY', 'ALGOLIA_APPLICATION_REGION');

$response = $client->getTopHits(
    'index',
);
Did you find this page helpful?