Hi Flare users,
I did search for anything related to null or empty searches in here and couldn't find anything.
So I want to detect a search that returns no results, and:
a) redirect to a custom 'no results' page with info on search refinement and alternate options for better searching
b) send the null search event to Google Analytics so search terms with no results can be tracked and actioned.
Sending the event to GA is pretty easy: detect that no search results have been returned, retrieve the search term used from the query URL component, and fire off the event to GA with a gtag command.
However, there's no way in Flare's default search that I know of that detects that no search results have been returned (short of hacking Flare's search js, and I'd really rather not). The number of search results is inserted at page load time:
>
<h1 id="results-heading"><span class="query"></span> returned <span class="total-results"></span> results.</h1>
<
So I'm not even sure I can detect no results by searching for a text snippet with a bit jQuery.
Has anyone else wanted to do this with Flare's default search, or do most users seeking that level of complexity rely on Pulse or Elasticsearch's dashboards? Given how important catering for null search results is from a design point of view, I'm surprised you can't redirect to a custom master page on a null search.
Thanks.