🎉 Try the public beta of the new docs site at algolia.com/doc-beta! 🎉
API Reference / API Parameters / clickAnalytics
Type: boolean
Engine default: false
Parameter syntax
'clickAnalytics' => true|false

Can be used in these methods:

About this parameter

Add a query ID parameter to the response for tracking click and conversion events.

If true, the search response contains a queryID parameter, which uniquely identifies a search query. This queryID is required for all events related to a search.

Usage notes

Setting clickAnalytics to true doesn’t add any new analytics data. It only ensures that the queryID is generated and added to the search response. You have to pass this queryID when sending search-related events to the Insights API with the clickedObjectIdsAfterSearch or convertedObjectIdsAfterSearch methods. Calculating metrics, such as Click Rate and Conversion Rate, for Analytics and A/B Testing requires this setting.

For more information about sending events, see Getting Started with events.

Examples

1
2
3
$res = $index->search('query', [
  'clickAnalytics' => false
]);
1
2
3
$res = $index->search('query', [
  'clickAnalytics' => true
]);
Did you find this page helpful?