Support Center

Creating a search report using Google Analytics

Have you ever wondered what products your customers are searching for when visiting your store? This kind of information may be priceless to make decisions about what products you should incorporate to your inventory in order to increase sales.

You can get this kind of report using Google Analytics Search Reports or inside your Jumpseller store as well!


With GA4 (Google Analytics 4) you can easily collect this information.

Follow our guide if you haven’t configured it already.

Short-term report

Begin by going to the google analytics platform > Reports > Engagement > Events.

google analytics report


google analytics engagement report

Click on “view_search_results”.

view search results

On the “parameter name” field click “search_term”.

search term parameter

That’s it! This will give you the search terms and the number of times they were searched for in the last 30 minutes only.

realtime events

Long-term report

In order to see a longer-term report, on your left panel click on “Explore” > “Blank”.

explorations

Click on the plus sign in the “dimensions” section, type “search term”, tick “Search term”, type “event name”, tick “Event name” and click “Import”.

dimensions search term dimension event name parameter

Now do the same in the “metrics” section.

Click on the plus sign, type “total users”, tick “total users”, type “event count”, tick “event count” and click “Import”.

metrics total users parameter event count parameter

Then drag the “search term” dimension to the rows section and drag both “total users” and “event count” to the values section.

drag to rows

Finally, go to the filters section, drag “Event name”, select the match type as “exactly matches”, type “view_search_results”, and click “apply”.

filters results

That’s it! From now on you can check the number of times each search term is queried on your website, and the number of users and analyze it in the time period of your choice.

To change the time period, click on the date section, select the new time period and click “apply”.

date

2º method - UA and Google Tag Manager

Note: UA will stop working July 1st 2023. Move to GA4 as soon as possible to avoid possible losses of data gathering.

Before we move on to that, you have to make sure:

  1. You have a Google Analytics account connected to your store.
  2. Your Google Tag Manager Account is connected to your store.
  3. Your Google Analytics account is connected to your Google Tag Manager Account.

Setting up Google Tag Manager

In Tag Manager, we need to create two tags. One that triggers on simple page views and another that triggers when someone searches for an item on your store and then sends the data (term of search) as a variable to Google Analytics.

On the Google Tag Manager, do the following steps:

  1. Creating a Simple Tag to Record all the Page Views in Your Store. Let’s call it All Views.
  2. Create a more complex Tag, that triggers when a special action happens. In this case, when an internal search results page is loaded. We will call this tag Internal Search Views. This tag will have a variable and a trigger associated with it.
  3. Create a JavaScript variable in Google Tag Manager to pull out the query parameters. We will call this variable Search Query Parameter.
  4. Create the trigger Internal Search Trigger that will fire when an internal search results page is loaded.
  5. Add the Tag Internal Search Views as an exception to your regular page view tag called All Views. By doing this, the regular tag won’t show the pages that are a result of a search action.

Creating a Simple Tag to Record all the Page Views in Your Store

  1. In your main panel go to the left menu and select Tags.
  2. Create a new Tag by clicking on New.
  3. Name the Tag. We suggest using the name All Views.
  4. Click on the center icon.
  5. As tag type select Google Analytics - Universal Analytics.
  6. Set tag type as Page View and Google Analytics Settings as {{Tracking ID}}
  7. Check Enable overriding settings in this tag.
google tag manager all view

Creating a Special Tag to Record just the Searches on Your Store

  1. In your main panel go to the left menu and select Tags.
  2. Create a new Tag by clicking on New.
  3. Name the Tag. We suggest using the name Internal Search Views.
  4. Click on the center .
  5. As tag type, select Google Analytics - Universal Analytics.
  6. Set tag type as “Page View” and Google Analytics Settings as {{Tracking ID}}
  7. Check Enable overriding settings in this tag.
  8. On More Settings -> Fields to Set -> +Add Field. Set Field Name as page and the Value as /search?q={{Search Query Parameter}}
google tag manager internal search view

Creating a Variable

  • In your main panel go to the left menu and select Variables.
  • Create a User-Defined Variables by clicking on New.
  • Name the Variable. We suggest using Search Query Parameter.
  • Click on the center icon.
  • Choose as the variable type Custom Javascript.
google tag manager create search variable
  • The variable needs to have a script code associated. This is the code you need to copy and paste:
function () {
  // find and store the path of the current page
  var pagePath = location.pathname;
  // if the path starts with /search/, we know it's an internal SERP
  if (pagePath.indexOf("/search/") === 0) {
    // if the above checks out, let's figure out where the search term begins in the URL. Then, let's use that starting point to pull out the search term itself.
    var searchString = pagePath.substring(pagePath.lastIndexOf("/") + 1);
    // return what we found to GTM as the value of our variable
    return searchString;
  }
  // if it's not an internal SERP page, return "none"
  else {
    return "none";
  }
}

  • Click Save
google tag-manager setting-up search variable

Creating a Trigger

  • In your main panel go to the left menu and select Trigger.
  • Create a new Trigger clicking on New.
  • Name the Trigger. We suggest using Internal Search Trigger.
  • Click on the center icon.
  • Choose Page View as the trigger type.
google tag manager internal search trigger
  • On trigger configuration, this trigger fires on select Some page Views.
  • On Fire this trigger when an Event occurs and all of these conditions are true, select Page Path, starts with /search.
google tag manager setting up internal search trigger

Making an Exception in your All Page Views Tag

Since we are creating a special tag to record visits to the search page, you need to exclude those visits from the main record.

Go to your first tag (the All Views tag) configuration and click on Add Exception.

google tag manager add exception

Your final Tags Panel should look like this:

google tag manager tags panel

Set up Search Report on Google Analytics

In the Admin section of Google Analytics, turn Site Search tracking on and give Google Analytics the parameter you’ve set up.

  1. Go to your Admin panel on Google Analytics.
  2. In the View column, click View Settings

    google analytics view settings
  3. Under Site Search Settings, set Site Search Tracking to ON.
  4. Set q as the query parameter.
google analytics site search tracking

It can take a while (at least 24 Hrs) for data to show up in the site search report (Behavior -> Site Search in Google Analytics)

google analytics search report

If you have further questions or want to learn more about Google Analytics Search Reports, visit Google Support

Start selling in Google Commerce with Jumpseller

Free trial for 14 days. No credit card required.