Internal Search Terms Analytics

Importance

Your website’s internal search provides a free look at what your audience wants from your website. Ensure you have analytics set up to capture this information and optimize your website accordingly.

Target Audience  

  • Marketing
  • Web Dev/IT

Definitions and Brand Guidance

GA4 = Google Analytics 4

GTM = Google Tag Manager

Instructions

Step 1: Set Up

Set up your website to collect internal search information.

  1. Go to your Google Analytics Account/Property in GA4.
  2. Under Admin > Data collection and modification > Data streams, select your website’s data stream and make sure Enhanced measurement is toggled on.
Screenshot from Google Analytics 4 of the Enhanced Measurement option.
  1. Click the cog to “Configure enhanced measurements” and under “Site search,” click “Show advanced settings.”
  2. Confirm that your “Search Term Query Parameter” is in the list. If not, add it to the list.
    1. The defaults should be: q,s,search,query,keyword.
    2. You can find your parameter by running a search on your site. The text just before the equal sign and search query is what should be in this list. It’s usually after a question mark. All of the search queries in the below examples are “test search.”
      1. Example: https://stratcom.illinois.edu/?s=test+search&search=1
        • On the Strategic Communications and Marketing website, the parameter is “s,” which you can see is just before my query “test search.”
      2. Example: https://illinois.edu/resources/search.html?search=&search_type=all&cx=006549799505564222509%3A-8lddip9q2g&cof=FORID%3A11&q=Test+Search&sa=Search+Website
        • An Illinois.edu search uses the parameter “q.” This is a trickier one to identify because there is a lot of text after the https://illinois.edu/resources/search.html path.
        • That said, if you have a few options in your parameter list, it will just use the first matching parameter and “q” was first.
      3. Example: https://test.com/?keys=test+search
        • Using this fake URL, you can see that the search term query parameter is “keys,” but that’s not in our list.
        • You should add “keys” followed by a comma to the beginning of the list. It will now be: keys,q,s,search,query,keyword.

Step 2: Testing

It is time to test if internal search terms are being recorded. Here are three ways to go about this:

  1.  Realtime Reports: If you go to Reports > Realtime overview and run a search on your website in a different tab, you should see an Event come in for “view_search_results.” If you click it, you’ll see the “search_term” parameter and can click it to confirm it worked.
  2. DebugView: Under Admin > Data display > DebugView, you can debug events happening on your site in real time, but you must have this set up already.
  3. Tag Assistant: This works in conjunction with DebugView above. In a separate tab, go to Google Tag Manager’s tag assistant (either clicking “Preview” on GTM or going to https://tagassistant.google.com/). Then, go to the website you’re testing and run a search. In DebugView, you should see an event for “view_search_results” and when you click it, you will see “search_term” as a parameter that you can also click.

Step 3: View Results

After 24-48 hours, you can now view results in the premade Reports section of GA4 or in the Explore section by creating your own exploration. This step will explain how to do the latter.

  1. To build an exploration, go to Explore in GA4 and either create a new free form exploration or add a tab to an existing one.
  2. Bring in the Dimensions for “Search term” and “Event name.”
  3. Bring in the Metric for “Event count.”
  4. Set up your exploration as such:
    1. Set the date range – If you just set this up, you won’t have much data to look at because it only starts collecting search terms from when you set it up.
    2. Rows = “Search term”
    3. Values = “Event count”
    4. Filters = “Event name” exactly matches “view_search_results”
      1. If you don’t do this step, it will look like you have a large number of searches for nothing. This is because you are measuring all events (page views, clicks, etc.), but when you filter to just the “view_search_results” event, you will get the right numbers.

Contact

Maggie Evenson, Analytics Specialist, evenson@illinois.edu