An internal search is a specific type of action, and when an action is tracked as a Site Search, it does not count as a Pageview. There are three ways you can track a Site Search action:

Track Site Search using URL Parameters (default)

The easiest way to track internal search keywords, is to specify the URL parameter name that will contain the search keyword. By default, Matomo (Piwik) will read the URL and look for a parameter with any of the following names: q, query, s, search, searchword, k, keyword

The Super User can also specify the parameter names to use by default for all websites. Login as Super User, go to Administration > Websites (or Administration > Measurables), and look at the Site Search configuration at the bottom of the page.

Track Site Search using the Javascript trackSiteSearch() function

If tracking search results via the URL is not possible (for example if you use rewritten URL without query parameters, eg. /search/keyword) , or if you wish to also track the count of Search Results, you  may use the Javascript function piwikTracker.trackSiteSearch(keyword, category, searchCount). Calling the function will record the search keyword, search category, and the count of results on the search result page. This can be used on Search Results pages, instead of calling piwikTracker.trackPageView().

Check out more information in the Javascript documentation for trackSiteSearch()

Track Site Search using the Tracking API (advanced users only)

Advanced users can also record Site Search requests using the Matomo Tracking API. See more information in the Tracking API Reference page. Specifically, look for the parameters ‘search’, ‘search_cat’ and ‘search_count’.

Tracking No Result Search Keywords

Would you like to benefit from the report “No Result Keywords”, listing all keywords that didn’t return any search result?

If you are using the “Track Site Search using URL Parameters (default)” setup, the only way to track the number of search results on the page is to edit the Javascript code, in the search result pages, to tell Matomo how many results are displayed. Once you have this number available in a Javascript variable, you can write:

var searchCount = 15; // set this value when rendering the search result page
_paq.push(['setCustomUrl', document.URL + '&search_count=' + searchCount]);

Matomo will then track for the site search query, the number of results, and will report all keywords with “zero” results in the “No Result Keywords” report.