clickAnalytics
'clickAnalytics' => true|false
Can be used in these methods:
search,
browseObjects,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
search,
browse_objects,
search_for_facet_values,
generate_secured_api_key,
add_api_key,
update_api_key
search,
browseObjects,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
search,
browse_objects,
search_for_facet_values,
generate_secured_api_key,
add_api_key,
update_api_key
search,
browse,
searchForFacetValues,
generateSecuredApiKey,
addAPIKey,
updateAPIKey
search,
browseObjects,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
Search,
Browse,
SearchForFacetValues,
GenerateSecuredApiKeys,
AddApiKey,
UpdateApiKey
Search,
browse,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
Search,
BrowseObjects,
SearchForFacetValues,
GenerateSecuredAPIKey,
AddAPIKey,
UpdateAPIKey
search,
browse index,
search into facet values,
generateSecuredApiKey,
add key,
update key
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.
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 and conversion rate, for analytics and A/B testing requires this setting.
For more information about sending events, see Getting started with events.
Send events from the frontend
If you’re using Algolia’s UI libraries, you can use them to send events:
Examples
Turn off click analytics for the current search
1
2
3
$res = $index->search('query', [
'clickAnalytics' => false
]);
Turn on click analytics for the current search
1
2
3
$res = $index->search('query', [
'clickAnalytics' => true
]);