Gravatar for hussaindotnet@gmail.com

Question by Hussain Shaik, Oct 12, 2017 3:18 PM

How to send searchHub name from Coveo JS code

I need to send searchHub name from COVEO JS framework for specific reason. Currently we are using HTML text box and by clicking on it , i am getting the coveo response by using Cove JS.

Future , i want to replace with textbox by using Coveo OOB coveo search box in order to get the query suggestions.

Over all , i doesn't want to loose search event history which are used by HTML text box.

1 Reply
Gravatar for sbelzile@coveo.com

Answer by Sébastien Belzile, Oct 12, 2017 3:45 PM

Switching to the OOTB Coveo Searchbox is not a huge task. You should do this right now instead of wondering how to set Analytics data properly from custom code.

The OOTB searchbox does not set anything. It uses an analytics client available on the component. The search hub is set on the CoveoAnalytics component and will be set properly on every events sent by the Coveo framework.

Or you can try Jeff's answer, but watch out since homemade code is more risky than using the seasoned code we provide OOTB.

Gravatar for flguillemette@coveo.com

Comment by François Lachance-Guillemette, Oct 12, 2017 3:47 PM

You can configure the CoveoAnalytics component like the following:

<div class="CoveoAnalytics" data-search-hub="YOUR_SEARCH_HUB"></div>
Ask a question