How to get more actionable insights from your Site Search data

Gary Stubbenhagen

As a junior analyst, one of my first tasks was to look at search terms, how many results were returned, and whether we needed to add search aliases to the engine to improve the experience.

Today, search engines have come a long way and we no longer need to keep on top of such things – if the content is there, the search engine will probably do a decent job of putting it in front of users – but the value of this data doesn’t stop at optimising the engine, we can use it to inform our content production, SEO, and many other aspects of digital marketing.

We all accept that successful marketing requires insight into what our customers want from us. Your site search data is where your customers scream this loud and proud, when was the last time you listened?

Site Search Reports

Google Analytics contains four pre-configured reports for your search data:

Overview and Usage are good for looking at the impact of site search on the user’s journey, whereas Search Terms and Search Pages allow you to dive into what actually happened.

For me, the Search Terms report is most useful of the four; much of the other data is derived from this table and it provides the granular insight we need to take action to improve things.

Take this example from the Builtvisible blog; ecommerce is the most commonly searched term by a mile, but almost all searches result in the user leaving the site.  We know we have lots of really great ecommerce content, so why is this?

Search Terms Report

Google Analytics 4 (GA4)

As with a lot of things in GA4, it’s very easy to get data collection going but a little more complex to access the insight.

For a simple breakdown of search queries, head to the Events report, find “view_search_results”, and click it to open the summary report for the event.

For the more advanced metrics we have in Universal Analytics, such as search depth or % exits, you’ll need to head over to BigQuery.

I can’t find that event!

If you can’t find the “view_search_results” event, double-check the search parameter in the Enhanced Measurement settings then use the DebugView to ensure the event is firing correctly.

If you’re seeing the event firing but you’re still not getting the data in reports, it may be that the data has been withheld. GA4 does this when data volume is low and may be considered identifiable. You can read more about data thresholds here.

Solution? You could turn off Google Signals, as without Signals thresholds are only applied to demographic data, but the data should still be available in BigQuery, so I’d recommend heading over there.

Big Query output

Improving Search Insights

So, we’ve seen how easy it is to set up Site Search and get some insights from it, but how insightful were they really? Let’s take another look at that Builtvisible blog example, why are people who search for ecommerce content leaving the site?

If you have a high % exit for most queries then it’s probably a UX problem with the results page, or technical problem with the engine itself. At this point, a quick check of your JavaScript Error events or a reccy in Hotjar should put you on the right track.

But, if it’s just a couple of terms, it’s more likely an issue with the search results; either they’re not relevant enough, or there weren’t any at all. The trouble is, we have no way to know which is true with the data in Google Analytics Site Search reports.

We also don’t know whether the search was filtered, and what effect that had on the results returned – maybe we have lots of SEO content for ecommerce, but not so much Data content.

Google Analytics will never give you all the answers, you’ll need to turn to some UX tools to dig into some of these questions, but with a bit of customisation we can get a better steer as to where to direct those efforts.

The data layer

As always, the first step to improving our data in Google Analytics is to get the missing data into the Data Layer.

When the search results page loads, have your developers push a data object containing all the search context: term, filters, and results count. Ideally, this should be added before the container loads, so that you can pass it in with the existing pageview.

dataLayer.push({
  "event": "site_search_results",
  "search_term": "ecommerce",
  "search_filters": "digital_pr",
  "search_results": 0
});

Custom dimensions and metrics

To collect this search context data, you’ll need some custom dimensions and metrics:

The Search Results custom metric will provide the total number of results returned across all searches, which isn’t that helpful in itself. So, I recommend getting a Calculated Metric set up for Avg. Search Results.

Calculated Metrics

Wait, why do you need to create a Search Count metric? Google Analytics provides only a count of unique searches, which would cause inaccuracies in your calculated metric, so we create a count of total searches to improve this.

Amend the tagging

First up, create Data Layer variables for search_term, search_filters, and search_results.

Then we need to create our search count metric, we can do this by creating a Custom JavaScript variable which returns 1 when the search data is detected.

function(){
  if("{{dlv – search_term}}" != undefined){
    return 1;
  }
}

Finally, we need to add our new custom dimensions and metrics to the GA Settings variable. This will send the additional search data whenever it is defined in the data layer.

GTM settings variable configuration

GA4

Adding the data to GA4 events is almost exactly the same; in your GA4 Configuration tag, add parameters for search_filters and search_results.

Parameters set in this way will be globally applied – in other words, they will be set whenever the data is available, exactly the same as with the GA Settings Variable for Universal Analytics.

You’ll notice in the example below that I haven’t included the search_count for GA4, this is because I’m building my reports in BigQuery and can create my count in there.

GA4 Custom Dimensions

Custom reports

Armed with this new search context data, we can create a custom report which allows us to explore search in more detail. Which might show us something like this:

Site search example

Now we know exactly what we need to do – create more Data content about ecommerce! Looks like I have a busy month ahead!

Another analysis that might be worth looking at is % Search Exits for your top queries broken down by search filters. If you have a particularly high % Search Exit for some filtered searches, it may indicate lower relevance of those results specifically.

For GA4, you may find it tricky to get this level of detail in Analysis Hub. This is because many of the metrics we’re familiar with (e.g. % Search Exits) aren’t pre-defined in GA4. I’d recommend using BigQuery for this level of analysis for now.

Data is only as valuable as what you do with it

Site Search is a really rich source of data and the default reports are a great starting point, but with a little effort we can make them so much more actionable.

Take the time to expand your understanding of site search, then pop it at the heart of your marketing efforts.

Still not sure where to begin with Site Search? Fear not, our Data team are here to help.

Leave a comment


Join the Inner Circle

Industry leading insights direct to your inbox every month.