Enabling Site Search in Google Analytics with Missing Query Parameters

If your site uses a site search facility you will probably want to know what your users are looking for.

This kind of information can be particularly helpful in two areas:

  • Mining for keywords – it’s likely that people will use the same search terms on your website as they are using in a search engine so knowing what they are looking for can help you create keywords lists for better targeted paid advertising campaigns as well as SEO
  • Optimizing landing pages – visitors might use the site search on a landing page if they are having issues in finding relevant content. This can flag potential navigational issues with your site.

By default site search is not enabled in Google Analytics and so you will have to do this in the Admin section of the account for every view you might have created.

To do this simply go to View Settings and switch Site Search Tracking on. You will need to specify the query parameter search terms are associated with.

Enabling Site Search when the query appears in the URI

Many content management systems will simply add the search term as query string data in the URL which makes setup easy. To see if this is the case you can simply perform a search on your website and look for the query parameter used by your CMS.

This will typically look something like this: www.yourwebsite.com/?q=searchterm. In this case the query parameter needed is ‘q’. Once you find the query parameter simply add it to your view settings as shown below (in this case the search parameter is simply “search”).

Enabling Site Search when the query parameter is missing

Some content management systems however e.g. Drupal will display the search term as part of the URL without a query parameter. This may look something like this: www.yourwebsite.com/search/searchterm.

In this case the search will be captured as a regular page view and data won’t be available in the site search reports.

A simple way around this problem is to create an advanced filter that extracts the search term from the Request URI and outputs it to Search Term field. Your advanced filter will look something like this:

If you have implemented Google Analytics via Google Tag Manager you can alternatively create a variable that uses JavaScript to rewrite the URL from a www.yourwebsite.com/search/searchterm format to a www.yourwebsite.com/?q=searchterm format.

 

Contact us

Anders Analytics Limited
Baltic House
4-5 Baltic Street East,
Clerkenwell
London EC1Y 0UJ
United Kingdom
Telephone: +44 (0)207 788 7798
Email: info@andersanalytics.com

Google Certified Partner