Sep 20, 2024
Retrieve top searches
Returns the most popular searches. For each search, it also includes the average number of hits.
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 totrue
. This differs from the response’scount
, which shows the overall number of searches, including those whereclickAnalytics
isfalse
. - Click count
- Click-through rate (CTR)
- Conversion count
- Conversion rate (CR)
- Average click position
If you set the revenueAnalytics
query 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
6
7
use Algolia\AlgoliaSearch\Api\AnalyticsClient;
$client = AnalyticsClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY', 'ALGOLIA_APPLICATION_REGION');
$response = $client->getTopSearches(
'index',
);
Did you find this page helpful?