Support

Using Google Analytics to know what kind of products your customers are looking for when they visit your store

A Complete Guide

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 and Google Tag Manager. You can do this wiht your Jumpseller store as well!

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.

For more information on how to get your accounts running, please visit: How to use Google Products with Jumpseller


Contents


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