Enable Site Search tracking for my website
Matomo can track what users search for on your website by detecting search keywords in the URL. This is the default and simplest method for Site Search tracking.
When enabled in Matomo, it automatically works if your search results page includes a query parameter like https://example.com/search?q=analytics
. Matomo reads the keyword, analytics
from the q
parameter and logs it as a Site Search action.
Matomo includes a built-in list of default query parameter names that it automatically recognises when Site Search is enabled without custom parameters added at the website level. By default, every new Matomo instance includes the following global query parameters: q, query, s, search, searchword, k, keyword, keywords.
Inspect the website’s search URL
Before configuring Site Search in Matomo, you need to know which query parameter your site uses to pass the keyword. Different websites may use different names like q, search, or term, so Matomo needs to know what to look for.
- Go to your website and perform a search.
- Look at the URL of the results page, which should show something like this:
?q=analytics
?search=analytics
?term=analytics
- Identify the parameter name that holds the search keyword. In these examples, the parameters are
q
,search
andterm
.
Enable Site Search with search parameters
After identifying the correct parameter, follow these steps to configure Site Search tracking for a specific website.
- Log in to Matomo as a superuser (or with admin access to edit the website settings).
- Navigate to Matomo settings
> Measurables > Manage.
- Click the pencil icon to edit your website settings.
- Scroll to the Site Search section and use the drop-down options to set your preference: Site Search tracking enabled or Do not track Site Search to disable the tracking only for site searches.
- To use the global search query parameters, tick the checkbox to enable Use default Site Search parameters.
- If you have search query parameters specific to a website (and not for all your websites), leave the checkbox unticked (disabled).
- In the Query parameter field, enter the name(s) of the keyword parameters, separated by commas, e.g., term, searchkey.
- Enter Category parameter(s) if your site includes search categories.
- Save your changes.
When defining custom query parameters at the website level, they will override the global defaults for that website. Read more about analysing Site Search reports.
If you want to track site searches using a different method, explore alternatives in the guide for Tracking Site Search Keywords.