Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Dynamic "real-time" site search - tagging best practice

clairea39507456
Level 2
Level 2

We are implementing a new real-time site search box on our pages.

 

Previously we've had a search box where you type a word, press enter (or the icon) and then the search results appear on a new page. We have used a prop to collect the search terms and all was well.

 

The new set up will see users start to type their word, and results will start to appear based on each key stroke they make, with no need to click enter. We can change the minimum key strokes to what we want, currently set to 3 I think before results start to appear. I have no idea how to tag this. Dev team has tried using a prop like before, but of course this will fire with every key stroke (so if someone wanted to search for "dental", I would start getting results at "den", then again at "dent", then again at "denta"...depending on how much a user types. You get the picture. Not sure how beneficial this would be in terms of insight?! 

 

Is there a better way to tag this?! I am stumped. Thanks in advance 🙂

1 Accepted Solution
Andrey_Osadchuk
Correct answer by
Community Advisor
Community Advisor

As an option, consider capturing the value at click rather than at every new character entry.

View solution in original post

5 Replies
Andrey_Osadchuk
Correct answer by
Community Advisor
Community Advisor

As an option, consider capturing the value at click rather than at every new character entry.

View solution in original post

clairea39507456
Level 2
Level 2
I did think of that initially, but becuase the results appear in a dynamic box attached to the search box as a user types, there isn't really a need for them to click within the search box. Or do you mean at point of clicking their chosen search result? I suppose then we'd miss the opportunity to capture search terms that we don't currently have content for, but something is better than nothing, right?! Thanks for the reply.
Andrey_Osadchuk
Community Advisor
Community Advisor

Yes, exactly at at point of first click on the search results.

You may want to add an extra trigger to the event when the searchbox gets unfocused or when the value gets cleaned (value length gets reset to 0 or 1 character) . This should help with the latter challenge you mentioned.

ChristyW
Level 1
Level 1

Can you fire the tag on the onchange event of the input tag that is your search text box?  Then the tag would fire once the user leaves the the text box.