What is a Site Search query parameter in Google Analytics?

A query parameter in Google Analytics is the part of a URL that tells the site (and indirectly Google Analytics) what a user has searched for. By checking what information comes after this parameter, your site and Google Analytics know what the user searched for. 

For example, say a user searches for ‘Dorothy’ on example.org. When they do this, the resulting URL may look something like this:
https://example.org/search?q=Dorothy

In this case, the query parameter is ‘q’. Mind you: symbols like ‘=’ are never a part of the query parameter. The query parameter is the text that comes before that. 

How do I set Google search parameters?

Setting up your query parameters is a part of setting up site search. To learn more about that, you can read the Google documentation on setting up site search.

Finding your site search query parameter

Are you not sure what your query parameter is? Go to your site, look up a random word like “Dorothy”, and check the URL of the resulting page. Your URL should contain the word “Dorothy”, in front of an ‘=’ symbol. In front of that ‘=’ symbol is a word or letter, and in front of that is another punctuation mark. That word or letter is what you need.

For example, if you go to ecosia.org and look up ‘Dorothy’, the resulting URL is:

https://www.ecosia.org/search?q=Dorothy

In this URL, ‘q’ is the query parameter. This means that in Google Analytics, you type in ‘q’ as your query parameter. Take note: The ‘=’ symbol is not a part of the query parameter; it’s only the term before it.

If you’re still having trouble, your webmaster can help you out.

My site doesn’t show the query parameter in the URL

Searched for ‘Dorothy’ on your site and didn’t see it in the URL? Then your site does not show the query parameter in the URL, likely because it uses a POST-based search system. If this is the case, you can still set site search up in two different ways. 

The first option is to customize the tracking code on your results page to send the additional information to Google Analytics dynamically. The tracking code on the results page would look something like this:

analytics.js: ga(‘send’, ‘pageview’, ‘/search_results.php?q=keyword’); 

The second option is to set up your website so that the query keywords are added to the end of the URL. After doing this, you can then set up site search in Google Analytics as described earlier.

How do I set up category parameters?

If you offer site search on your site, you may also offer categories or filters which users can use to specify their search. For example, if they look up shoes, they may add the filter of a specific brand.

Google Analytics is also able to track these. If you offer these features and want to track them, you can set that up in a similar way to the regular search queries. 

If you want to enable this, follow these steps:

  1. Set the switch under ‘Site search categories’ to ON. 
  2. Put the category parameter in the ‘Category parameter’ field. If you’re not sure what your category parameter is, go to your site and apply a category. The category should appear in the URL. The category parameter should be visible before that. For example, if on example.org we search for pumps in the category red, the url could look like:
    example.org/search?q=pumps&sc=red
    In this case, the query parameter is ‘q’ and the category parameter (what we need) is ‘sq’. 
  3. Select whether or not you want the category parameter to be stripped from the reports. Turning this on will hide the category parameter in your reports, leaving this off will show them. This is purely your personal preference.
  4. Click ‘Save’

Turn Google Analytics into conversions

Let smart algorithms audit your Google Analytics data. Find hidden conversion leaks and increase your conversions.

Create account