Behavior

Set up and configure Site Search

Setting Up Site Search for a View

To set up Site Search for a view:

  1. Click the Admin tab at the top right of any screen in Analytics.

  2. If you are not already on the Account Administration screen, click the All Accounts link at top left, just below the orange bar.

  3. Click the account that contains the web property and view for which you want to set up Site Search.

  4. Click the web property that contains the view for which you want to set up Site Search.

  5. Use the View menu to select the view you want.

  6. Click the View Settings sub-tab.

  7. Under Site Search Settings, select Do Track Site Search.

  8. 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.
    For information about identifying query parameters, see Identifying Search and Query Parameters for Your Site.

  9. Select whether or not you want Google Analytics to strip the query parameter from your URL.
    Note that this strips only the parameters you provided, and not any other parameters in the same URL. This has the same functionality as excluding URL Query Parameters in your Main View: if you strip the query parameters from your Site Search View, you don't have to exclude them again from your Main View.
  10. 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 Google Analytics to strip the category parameters from your URL.
      Note that this strips only the parameters you provided, and not any other parameters in the same URL. This has the same functionality as excluding 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

The Site Search reports appear under Content on the Standard Reporting. It may take up to 48 hours for data to appear in your reports once you have configured Site Search.


Setting Up Site Search for POST-Based Search Engines

If you're using a POST-based search engine, the your-search-results URL would look something like:

http://www.yoursite.com/search_results.php

You have two options to use Site Search for POST-based search engines:

Option 1: Configure your web application to append the query keywords to the end of the URL (e.g., http://www.yoursite.com/search_results.php?q=keyword) and then set up Site Search as described in the previous section.

Option 2: Customize the tracking code on your results page to dynamically specify a virtual page path that includes the query keywords. The tracking code on the results page would look something like:

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

Learn more about: