Modify the search function using the 'beforeInstantsearchInit' custom event.
The new function should include a condition that checks to see if there is a query populated, if not, analytics is set to false.
For example:
const search = instantsearch({
appId: 'XXX',
apiKey: 'XXX',
indexName: 'XXX',
searchFunction: function(helper) {
if (helper.state.query === '') {
helper.setQueryParameter('analytics', false).search();
} else {
helper.search();
}
},
});
Comments
0 comments
Article is closed for comments.