Remove <empty search> from popular/no result searches WITHOUT decrementing total searches

Hello everyone ! :slight_smile:
I’m currently researching a way to avoid listing empty search queries with the other ones.
Let me explain :

First of all, let’s take a look at these screens :


As you can see, for 16 searches, I did 14 empty queries and 2 other ‘not empty’ queries.
14 empty + 2 regular = 16 displayed

Now, I’m supposed to hide/remove/ignore the in the popular/no result searches, (because in production they’re pretty much everywhere, and we got the feeling that it’s tainting the analytics) so that they will not be displayed/ will not trigger the analytics.

But I want to do it while keeping the EXACT number of searches emitted by the application.
What does that mean ?
It means that, if you look again at the screens above, I’m supposed to see 16 total searches, but only the “test” and “query1” in the results. (14 empty + 2 ‘regular’ = 2 displayed )

Is there any way to achieve this ? Because I’m capable of filtering the empty queries so that they will not trigger the analytics, but this won’t increment the total search count.

I’m not really familiar with Algolia for the moment, that’s why I finally came here to ask my question before my head explodes :smiley:

Thanks a lot for your time & answers !
Ask me anything if you need more details, I’ll do my best to answer :slight_smile:

Hi @coorjet,

Thanks for contacting Algolia and your explanation is clear: you want to keep count of all queries, but only track non-empty queries.

As you mentioned you can pass analytics=false on empty queries, however this will not increment your search count. This is the current state of the Algolia internal analytics options.

However, if you are using InstantSearch you can always push data as you wish to your external analytics provider (Google Analytics, Kissmetrics, Segment…):

  • Use the analytics widget in your InstantSearch implementation
  • In the pushFunction, you would send any data such as query in the format needed by your analytics provider

We hope this helps get you the data you need, even if it is collected outside of Algolia!

Hello @ajay.david !
Thanks for your quick & precise answer :smiley:

Ok, I’ll take this to the team and we’ll discuss our course of action !
Best regards & thanks again !

1 Like