Use Internal Site Search to your advantage! Learn 3 ways to implement it in Google Analytics

By Sasibhushan M | 30.01.2017 | analytics

Site Search analysis
Ever felt lost while browsing through the colossal list of products on online stores? You’re not alone! Due to increase in products on such websites day by day, users nowadays jump on to the search option to look for their requirements.
nternal Site Search analytics
Providing a search box on your website not only helps your prospective customers, you too can benefit from it. By tracking how people use it, you can get important insights into user intent.
Site Search allows you to track how users use your website’s internal search engine. You can observe what keywords users typed on your website to search and whether they could get the desired pages after their search.

Why is it a must for your site?

  1. You get to know your customers’ actual requirements based on the keywords, phrases or the content they look for.
  2. You can discover what you’re not able to offer when users search for a keyword or a phrase several times.
  3. You get to know the trends of certain keywords.
  4. You can identify your SEO opportunities with the help of this.

Site Search Reports in Google Analytics:

Google Analytics has a Site Search report feature, located under “Behavior” in the left-hand navigation. Here is a sample site search “overview” report where you can see under “Search term”, what users are looking on your website.
Internal Site Search Google Analytics
The below available metrics in reports can give helpful insights.
Internal Site Search analytics
Now let’s learn how to implement Site Search!

Method 1: Site Search with Query parameters:

This is the simplest way of site search tracking. This works when there are query parameters available in url; the url would look like this: you’ll gather from the below steps, implementation is very simple!

  1. Go to Admin > View> View Setting tab. Here is a screenshot for reference.
    Google Analytics Query parameters
  2. Under the site search settings, set the site search tracking to ON
  3. In the query parameter field, enter the word that denotes an internal query parameter like search, query, q, s.
  4. Select whether you want Google Analytics to strip the query parameter from your URL & show you the clean report without Query Parameters in Google Analytics Reporting section.
  5. Similarly, if you have passed on the category details as well within url, then in the Category Parameter field, enter the letters that designate an internal query category (Example: For shoes, men/women/kids are the internal category) such as ‘cat, qc,’.

Method 2: Site search without Query parameters – Using Filter

When there is no query parameter available in url, Method 1 will not work; the url would look like this: For such scenarios, follow the below steps.

  1. Select the “Advanced” filter for the view you are using to track the site search report as shown in below image.
    Site Search Google analytics
  2. Choose ‘Request URI’ for Field A, as you’ll be getting the information from the URI.
    Site Seach without query parameters
    What happens here is, you ask Google Analytics to look at the 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 you can store anything after the slash.
  3. Leave Field B blank. The ‘Output To’ field will store the keyword from the URI. You need to output it to the correct dimension. In the dropdown 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, select ‘Field A Required’.
    Internal Site Search Google Analytics
  4. Now you need to strip keywords from the URL. By stripping the entire URL in the search term, you’ll get the exact search term stored in the report. For this, you’ll have to use one more custom filter – Search and Replace.
    Google Analytics Query parameters
    Here, the search string “/search/site.*” will be replaced by “/search/site”, as you are stripping the keyword after the slash.
  5. Now you’ve successfully configured this in Google Analytics and data will start flowing into site search reports. Kindly note, your pages will no longer have keywords as you’ve replaced them into Search Term dimension of Google Analytics.

Method 3: Site search tracking in Google Tag Manager using Virtual pageviews:

Where URL does not contain search query parameters, Method 2 is the simplest solution. However, in cases wherein regex is too complex or not possible, there is another way out. It is tracking through Virtual Pageview. Under this method, we capture search term and search category from dataLayer & pass them with a pageview hit.
Let me try to explain this with one example.
Sample example:

URL 1:
 (can be tracked through RegEx)
URL 2:

In the above example, “Kaabil” is the search term which is followed by search category values and “ahmedabad” & “national-capital-region-ncr”. Here in URL 1, regex could be simple, however in URL 2, regex could be challenging and a small mistake could distort the data. Hence, it is recommended to pass these values in the dataLayer as shown below:
Site Search Google analytics
Once these values are pushed to dataLayer, the next step is to create a Pageview tag that sends these details as a query parameter. Here’s the final outcome,Site Seach without query parameters
So, now in Google Analytics, repeat method 1 by using “search” as a keyword & “city” as a category to get the site search report populated correctly.


Choose an appropriate method depending upon the structure of your website and the URL pattern for search functionality. You will notice that these reports will be relevant not only to Web Analysts, but also for SEO, UX, and even your design team.

For more information on Site Search, feel free to contact us or drop a message in the comment section below. We will be glad to assist you!

Use Internal Site Search to your advantage! Learn 3 ways to implement it in Google Analytics by
The following two tabs change content below.
Sasibhushan M

Sasibhushan M

Sasi is a certified Google Analytics consultant at Tatvic and has keen interest building deep-dive data analysis. He loves gaming and is an avid player of chess and Rubik's cube, Sasi is a computer science graduate and holds a post graduation degree in Behavioral Intelligence from IIM.

Leave a Reply

Your email address will not be published. Required fields are marked *