Learn how to set up site search (internal search) with and without query parameters and see how users search your site. Find what your customers are researching for on your website and improve your website content.

The site search reports provide data on the type of content people are looking for on your site. Having site search data is like reading the minds of a subset of your audience. You can easily see what they’re looking for, the words and terminology they are using and how quickly they found what they were looking for (or if they did at all).

Site search must be set up for each reporting view in which you want to see user search activity. To set up site search for a view:
sign into your analytics account, navigate to a view in which you want to set up site search then click view settings and under site search settings, set site search tracking ON.

identifying your category parameter

In the query parameter field, enter the word or words that designate an internal query parameter, such as “term,search,query”. Sometimes the word is just a letter, such as “s” or “q”. Enter up to five parameters, separated by commas. The simplest way to know what your query parameter is is to go to your site and perform a search for something, anything! On the following page, take a look at the URL – do you see your keyword? If your keyword appears at the end of a URL following a question mark, like this: http://www.yourwebsite.com/?s=your+keyword, this means that your website is using query parameters. If your keyword appears in the middle of the URL, with no query parameters, like this: http://www.yourwebsite.com/search/your-keyword/ then this means you need to use the Page Paths.

How to identify search query parameters for Site Search with Queries

If you’ve identified that your search keywords show up in the query parameter portion of the site, you’re in luck! This is the easiest way to set up Site Search.

When you’re searching on your website, you might see the URL like this: http://www.yourwebsite.com/?s=your+keyword, or in this example blog.littledata.io?s=internal+search. The query parameter is the bit between ? and =, which is ‘s’ in this example. So you must use the query parameter ‘s’ when setting up the internal search in Google Analytics settings.

setting-up-internal-search-in-google-analytics

Now to set this up in Google Analytics, follow these steps:

  • Select whether or not you want analytics to strip the query parameter from your URL. This only strips the parameters you’ve provided, not any other parameters in the same URL.
  • Select whether or not you use categories, such as drop-down menus to refine a site search.
  • If you select ‘no’, you are finished. Click save changes.
  • If you select ‘yes’: In the category parameter field, enter the letters that designate an internal query category such as ‘cat, qc,’.
  • Select whether or not you want analytics to strip the category parameters from your URL. Note that this only strips the parameters you provided, not any other parameters in the same URL. This has the same functionality as excluding the URL query parameters in your main view: if you strip the category parameters from your site search view, you don’t have to exclude them again from your main view.
  • Click apply
identifying your category parameter

How to set search terms for Page Path Search Terms (No Queries)

Another common behaviour of site search is to have the terms appear within the page path instead of a query. Like this: http://www.yourwebsite.com/search/your-keyword/

To track this type of site search, an advanced filter should be used for views that will be using these reports. First, navigate to filters > new filter under your view. (Note: when adding a filter, you must have EDIT rights on the property level!)

After choosing the filter name, select ‘custom’ and ‘advanced’ in the filter’s settings.

Choose ‘request URI’ for field A since we are getting the information from the URI, or page path. Your site’s page path goes in the text box, so for this example, it would look like this: search/(.*). When we do this, we are telling Google Analytics to look at this page path and extract the characters from within the parentheses. The dot and asterisk are regular expressions representing any character and any number of characters – so we are storing anything after the slash.

Field B will be blank since we are only concerned with extracting from the page path and nowhere else. The next field, ‘output yo’, is the one we are interested in. Now that we have stored the keyword from the URI, we need to output it to the correct dimension.

In the drop-down menu, select ‘search term’ and type ‘$A1’ into the input box. This tells Google Analytics to grab the user-defined value from field A and output it as a search term. For the checkbox options below, only ‘field A required’ and ‘override output field’ need to be selected.

Extract search terms from page path
See site search data

To see the site search reports: sign into your analytics account, navigate to your desired account, property, and view, then select the reporting tab and under behaviour go to site search. Your report must look like this:
Take into consideration that the report will be populated with data from the moment you activate the internal search or add the filter. It is not retroactive and may need 24h to you see the queries in your report.

Search terms report in Google Analytics

If you’d like to know more about how to set up internal searches in Google Analytics, get in touch with one of our experts!

Further reading:

Image credit: Image courtesy of hub.3dissue.net