Page 1 of 1
Capturing search phrase and number of results
Posted: Wed Oct 09, 2013 8:40 pm
by jpond
Hi,
Regarding the search function in the webhelp plugin: Does anyone know of a way to programmatically capture the string(s) the user typed in the search box and the number of results returned?
Thanks,
Julia
Re: Capturing search phrase and number of results
Posted: Thu Oct 10, 2013 3:55 pm
by sorin_ristache
Hi Julia,
The search string typed by the user is processed by JavaScript code that is included in the Webhelp page displayed in the browser and that takes this user input and works out the list of results. I suppose you could enhance this JavaScript code and further process this data besides displaying the search results on the Search tab in the Webhelp page.
In what language do you need to capture the user string and the (number of) search results? How would you like to process the captured data?
Regards,
Sorin
Re: Capturing search phrase and number of results
Posted: Thu Oct 10, 2013 9:13 pm
by jpond
We'd like to know the best function to use to make a tracking call after the results are displayed.
Re: Capturing search phrase and number of results
Posted: Fri Oct 11, 2013 12:04 pm
by sorin_ristache
Hi,
The search results are computed and added to the Webhelp page in the function called realSearch() in the file [Oxygen-install-dir]\frameworks\dita\DITA-OT\plugins\com.oxygenxml.webhelp\oxygen-webhelp\search\nwSearchFnt.js. You can insert a new JavaScript function in this file that is a proxy for the realSearch() function and handles the search results in the variable called results inside the realSearch() function.
Regards,
Sorin
Re: Capturing search phrase and number of results
Posted: Fri Oct 11, 2013 7:16 pm
by jpond
Thanks very much, this is helpful!
Best regards,
Julia