To prevent test queries from your own team from being tracking in Algolia's search analytics, you can modify the search function using the
beforeInstantSearchInit
custom event. The modified function should include a condition that checks to see if the client IP matches the IP used by you or your colleagues / staff.
If the IPs match, the
analytics
parameter should be set to false.For example:
const search = instantsearch({
appId: 'XXX',
apiKey: 'XXX',
indexName: 'XXX',
searchFunction: function(helper) {
if (clientMachineIp == customerIp) {
helper.setQueryParameter('analytics', false).search();
} else {
helper.search();
}
},
});