This is interesting to see, Robert. I didn't try this myself, but it seems
we can set custom dimensions with GA. [1] So, we can capture the query and
the page both at the same time. Having the search query in its own
dimension helps with better analytics as I understand.

[1]
https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets

On Thu, Feb 16, 2017 at 9:04 PM, Fekete, Róbert <[email protected]>
wrote:

> Hi,
>
> We are using the webhelp output, and recently we modified it a bit to
> collect statistics about how often our readers use the search, what
> keywords they look for in our documents, and so on.
>
> Since we already use Google Analytics to get visitor statistics, the
> quickest and easiest was to post the search keyword to Google Analytics as
> well.
>
> I was wondering if anyone else did something similar and would share any
> experiences?
>
> Kind Regards,
>
> Robert
>
> P.S:
> We didn't do anything fancy, and currently don't even check on which page
> of the document did the user use the search box. The actual change is only:
>
> docbook-xsl-ns-1.78.1/webhelp/template/search/nwSearchFnt.js
> @@ -49,6 +49,12 @@ function Verifie(searchForm) {
>     searchTextField = trim(document.searchForm.textToSearch.value);
>     searchTextField = searchTextField.replace(/['"]/g,'');
>    var expressionInput = searchTextField;
>
> +  if (typeof ga != "undefined") {
> +  ga('send', 'pageview', 'documentsearch?query=' + expressionInput);
> +  }
>
>
>


-- 
~~~*******'''''''''''''*******~~~
*Kasun Gajasinghe*
Senior Software Engineer; WSO2 Inc.; http://wso2.com,
*Linked-in: *http://lk.linkedin.com/in/gajasinghe
*Blog: **http://blog.kasunbg.org* <http://blog.kasunbg.org/>


*GitHub: **http://github.com/kasunbg* <http://github.com/kasunbg>

Reply via email to