applicationID
is now calledappId
to be consistent with our other JavaScript libraries.
aa('init', {
applicationID: 'APPLICATION_ID',
apiKey: 'SEARCH_API_KEY',
// ...
});
aa('init', {
appId: 'APPLICATION_ID',
apiKey: 'SEARCH_API_KEY',
// ...
});
This method was previously used to pass the getQueryID
helper. Now, you need to explicitly call this helper
and pass the result to methods that require it (namely clickedObjectIDsAfterSearch
and convertedObjectIDsAfterSearch
)
aa('initSearch', {
getQueryID: () => search.helper.lastResults.queryID,
});
function getQueryID() {
return search.helper.lastResults.queryID;
}
They've been renamed to make it clear that they are intended to be called in the context of a search.
click
is nowclickedObjectIDsAfterSearch
convert
is nowconvertedObjectIDsAfterSearch
Their signatures have changed to reflect the different use cases covered by the Search Insights client.
-
clickedObjectIDsAfterSearch
eventName: string
is now requiredindex: string
is now requiredobjectID: number | string
is nowobjectIDs: Array<number | string>
queryID: string
is now required – use thegetQueryID
helperposition: number
is nowpositions: Array<number>
-
convertedObjectIDsAfterSearch
eventName: string
is now requiredindex: string
is now requiredobjectID: number | string
is nowobjectIDs: Array<number | string>
queryID: string
is now required – use thegetQueryID
helper
aa('click', {
objectID: 'object1',
position: 42,
});
aa('convert', {
objectID: 'object1',
position: 42,
});
aa('clickedObjectIDsAfterSearch', {
index: 'INDEX_NAME',
eventName: 'Click item',
queryID: getQueryID(),
objectIDs: ['object1'],
positions: [42],
});
aa('convertedObjectIDsAfterSearch', {
index: 'INDEX_NAME',
eventName: 'Click item',
queryID: getQueryID(),
objectIDs: ['object1'],
});