HTML5 Search -- Null results detection and custom page

This forum is for all Flare issues related to the HTML5, WebHelp, WebHelp Plus, and Adobe Air Targets

HTML5 Search -- Null results detection and custom page

Postby JRtechw on Sun Aug 11, 2019 7:10 pm

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.
JRtechw
Propeller Head
 
Posts: 42
Joined: Thu Oct 05, 2017 8:08 pm

Re: HTML5 Search -- Null results detection and custom page

Postby JRtechw on Sun Aug 11, 2019 7:48 pm

Turns out this question *has* been asked before, more or less:

viewtopic.php?f=13&t=27867

I'll use Dave Lee's null result detection code and see how that goes. I can probably just expose a div with said advice on an empty search detection.
JRtechw
Propeller Head
 
Posts: 42
Joined: Thu Oct 05, 2017 8:08 pm

Re: HTML5 Search -- Null results detection and custom page

Postby JRtechw on Mon Aug 12, 2019 8:34 pm

Success!

If you use gtag.js and not analytics.js, the event to send would be something like:

Code: Select all
gtag('event', 'No results', {
'event_category': 'search',
'event_label': searchTerm,
});


where <searchTerm> is the search term that produced no results, captured by your null result capture javascript. Then, in Google Analytics, go to Behaviour > Events > Top Events and set your primary dimension to 'Event Action' and your secondary dimension to Event Label and there's your Nil Result Search Report.
JRtechw
Propeller Head
 
Posts: 42
Joined: Thu Oct 05, 2017 8:08 pm

Re: HTML5 Search -- Null results detection and custom page

Postby Dave Lee on Tue Aug 13, 2019 12:20 am

Yep, I posted that solution in July 2017, using the original analytics ga() code. But Google replaced that in Aug 2017 by the new gtag() code.
Dave Lee
Master Propellus Maximus
 
Posts: 5639
Joined: Mon Mar 05, 2007 8:33 am
Location: UK

Re: HTML5 Search -- Null results detection and custom page

Postby JRtechw on Sun Aug 18, 2019 9:53 pm

Much appreciated on that null result detection code btw Dave. I was scratching my head wondering how I'd grab the number of search results.
JRtechw
Propeller Head
 
Posts: 42
Joined: Thu Oct 05, 2017 8:08 pm


Return to Web-based Outputs

Who is online

Users browsing this forum: No registered users and 3 guests

cron