Optimize Internal Site Search Conversion Rates With Google Tag Manager

July 17, 2014

Often overlooked, Internal Site Search’s importance shouldn’t be underestimated. Recently, as I was exploring our company’s website, I noticed that our internal search results weren’t as helpful as I anticipated.

I conducted a search on our site for “google analytics”, a term very significant to us at LunaMetrics. I was shocked to see that all the top listed results were blog posts.

While blogging is important to us, it’s also important for our visitors to know that we offer trainings around the country and Google Analytics services to clients. All the relative content we had created through our blog was coming back and actually overpowering our other results, hardly an ideal situation.

We, as marketers, do a lot to get people to our site. From search engine marketing to analysis of internal analytics, we make it a top priority to ensure our website is extremely visible across all channels of the internet. Why then does it seem that we tend to slack when it comes to internal search results of our own site?

Not being able to quickly see our Google Analytics trainings after my query was a definite problem. If you’re in a similar position, here’s how I sought out to address it.

Let’s Break Optimization into Two Steps:

  1. Checking to see if you have a problem
  2. Addressing your problem areas

Checking To See If YOU Have A Problem

The first step in checking to see if you have an internal search optimization problem is to create a list of terms you would like to test. The easiest way to do this is to export the list of site search terms from Google Analytics.

Once you have a list of site search terms take the most popular (we chose to do the top 25) and determine what your top results are. You can give this project to an intern (bad idea) or do it programmatically like we did!

After reading Michael’s recent blog post and talking over the problem with LunaMetrics’ Jon Meck, we came up with a solution. Using SEO Tools for Excel, we created a site search scraper. This Excel document uses the SEO Tools XPathOnURL function to crawl pages for specific content.

We used it to diagnosis issues with our internal site search, by crawling our internal search results page for the first result that appeared and storing it in the Excel file.

Internal site search varies depending on your website, so you will have to look through your own results in order to figure out where to pull your search results from. For us, we found that the 1st search result was always within the H3 tag. This is what we wanted to concentrate on. Once the file loads and the site scrape is complete, you will have a list of search results.

The next step is the important one. From the list of search results you need to identify problem areas, or areas where you think the top search result should actually be something else. As I mentioned before, our first problem area was “google analytics” which wasn’t returning results for either Services or Trainings. Once you have identified the problem areas, you are going to address them.

Addressing Your Problem Areas

There are many ways to address content problems with internal search. Depending on what you use for site search, you could dynamically change your search results so they better encompass the problem terms, or you could look for a new site search that would allow you to do so.

If you don’t have that option, you can try the method I tested, which involves using Google Tag Manager to fire suggestions every time one of these “problem terms” is queried, containing the information that you deem more relevant to your company.

I am favoring the GTM route because it still works even when you add more content to your site. If you are always adding new content to your site, you never know if something you just added suddenly becomes more relevant than the result you optimized prior to adding the new content.

Here’s the basic gist of how we’ll address the situation. A person arrives on the search results page, we’ll check to see if they searched for a keyword that we’re optimizing for, and if so, we’ll use GTM to insert a suggestion.

Before I discuss how to implement GTM, you should look at your problem terms and group anything that is similar together, as these keywords will become the terms that trigger your Tag Manager suggestion to fire.

After grouped, you need to generate a new message for each group that better promotes the more relevant content. For us, we included a brief description and HTML links to more relevant content. Here is what it looks like inside of the the suggestion wrapper:

Site Search Suggestion from GTM

We will be using a Lookup Table Macro inside of GTM, so we’re also limited to just 255 characters for this new message.

How to Implement

1. Create a Macro to pull the site search term from the URL. If your site search term doesn’t show up in the URL with query parameters, you may need to find a creative solution here. For us, it was as simple as using a URL macro and entering the site search parameter, “s”.


2. Create a Lookup Table Macro to match the search query term to the suggestion text. Check out this link to automate the Lookup Table Macro.


3. Create a Rule for when the page is equal to the Search Results page and where the Lookup Table has returned a value. This way it will only fire when someone searches for a term that we listed in the Lookup Table.


4. A Custom HTML Tag was made for the shell going around the search term suggestion. I modified the Expand Message example from this blog post about inserting Ads on your site through Tag Manager.

5. The Lookup Table Macro was inserted into the Custom HTML Tag in order to populate the message inside of the suggestion box.


6. Set the firing rule to be the Search Results rule we just created.

7. Lastly, you’ll want to add some sort of tracking to this, to see if your optimization was worthwhile. For us, we used a class on the links and a Link Click Listener to fire a Google Analytics Event every time someone clicked on our suggested links.

Make sure you test and debug as much as needed to get this box to look right, then Publish to your site!

After successful implementation of this Google Tag Manger Suggestion Box, here is what it looks like now when I search for Google Analytics.


Good luck with your own optimization and let us know what you are doing to stay on top of your internal site search in the comments below!