Site Search and Java API


I have a site search results page that is shown if a search finds more than one match. If the search finds JUST one match then the results page is skipped and the users is sent directly to a detail page.

This seems to be unsuitable for using the javascript “trackSiteSearch” mechanism.

My code is Java/JSP. Would I be correct in thinking that the Piwik Java client might be the best way forward as the search is processed in just one piece of java code ? If so what do I need to be aware of in terms of duplicate Piwik data as the jsp footer for all my pages includes the standard “trackPageView” javascript ? For example if my search returns 10 results, the java client api would record a site search with Piwik then the results would be rendered on the jsp page which includes a “trackPageView” in the footer.

Any advice welcome.

Thank you.

What is your question exactly? The JAVA client could be used (if it does not have the trackSiteSearch function yet please send Pull request). I would use Java client if you can’t put the Javascript code on the page (otherwise Javascript code always recommended since it can use cookies, is slightly more accurate)

OK - Apologies for any incoherence.

  1. I cant seem to find any documentation for the Java client - is it a case of just reading the source code ?

  2. Does the site search call record a page view or does it only record a search keyword ? Do I need to register a page view too ?

  3. Following on from 2 - If a site search call does register a page view do I need to disable the page view javascript in the page that displays the search results to avoid double recording ?

  4. Is the Java client verified, approved and officially supported by Piwik ?

  5. Does Piwik regression test the Java client against new versions of the main Piwik platform or do I need to test every time Piwik is upgraded ?

Thank you.

  1. most likely
  2. site search does not record page view, so you can record manually if you wish to track one page view for search requests
  3. not “officially” but we definitely aim to (Fabian from the team is owner of Java client AFAIK). Please consider pull requests if you find improvements/bug fixes… this is truly a team effort
  4. No tests for java client (the PHP client is full tested, so the API is fully tested, and we don’t break the API , so technically the Java client, if it works “now”, should work “for a long time”)