Internal Site Search is a powerful and underutilized website feature. While there are no direct SEO benefits from implementing Site Search (wait don’t leave yet, I said no direct benefits!), the information it provides can be used to understand and improve visitor behavior, allowing you to address areas of low or lost engagement (hello indirect SEO benefits!)
Understanding what your visitors are looking for, but can’t find, on your site can help you understand how Google is ascribing value to your site. You may already have the content your visitors need, but if they cannot easily find it, are you sending the right signals for Google to evaluate it? As Google’s algorithms become more complex, it is a high probability that user engagement is (or will be) correlated with being a factor for positive organic positioning. Utilizing Site Search to understand the signals your website is sending is more important now than ever.
First Let’s Set Up Site Search Tracking in Google Analytics
For this strategy to work, you’ll need to have an internal site search engine implemented on your website. Most content management systems such as WordPress will likely have them integrated, but if yours doesn’t, you can walk through an intuitive guide from Google themselves.
If you do already have an internal site search engine implemented, and, like most people, you’re running Google Analytics, activating tracking is very easy to do:
1. Log into your Google Analytics account.
2. Select your profile.
3. Click ‘View Settings’.
4. Toggle ‘Site search Tracking’ to ‘On’.
Depending on how your internal site search is set up, this next step may vary for you. Go to your website and perform a search on your internal site search. Now, look at the URL structure in your browser bar.
Before the search term, (in this example the search term is ‘test’) everything that appends after the trailing slash ‘/’ is known as the ‘query parameter’. We will want to strip this from our data.
In this scenario, the ‘?s=’ is the query parameter. The question mark and equals sign are not necessary to include within the Google Analytics Site Search settings interface (however, other programs may require it). We will want to use everything in between; in our example, the letter ‘s’ is what we will be using.
5. Type your query parameter into the Query parameter field.
6. Check the box for ‘strip query parameters out of URL.
7. Click Save.
So what did we just do?
We wanted to be able to see the specific search terms that your visitors are typing into your Internal Site Search without seeing the query parameters in the URL, and these settings achieve just that. Easy, right? But wait…there’s more!
Now Let’s See What Our Visitors Want! (What They Really, Really Want!)
One of the first things that you may notice is the keywords that people are using to find your site and the search terms that they use on your site are entirely unrelated. For example, new customers may only know your brand name, and it’s not until you can see that secondary search term that you can uncover their true intent. In some cases where the initial keyword is (not provided), the secondary search term can be a helpful insight into better unveiling what (not provided) may actually mean.
Now let’s put together a quick Custom Report to get some real actionable data:
- Create a Flat Table with the following dimensions:
- Keyword – All keywords, both paid and unpaid, used by visitors to reach your site.
- Destination Page – The page that the visitor arrived on from the keyword used to reach your site.
- Start Page – The page your visitors searched from.
- Search Term – The search terms used by visitors to internally search your site.
- Search Destination Page – The page visitors saw after performing a search on your site.
- Source / Medium – Where your traffic came from.
There are a variety of metrics that you can also set up, such as:
- Total Unique Searches – The number of times people searched your site. (Duplicate searches within a single visit are excluded.)
- Results Pageviews / Search – The average number of times visitors viewed a search results page after performing a search.
- % Search Exits – The number of exits from your site that occurred following a result from an internal search.
- Time after Search – The amount of time visitors spent on your site after getting results for the search term.
There you have it. This custom report can be tailored to fit your needs, but it provides valuable data that can be used fill many gaps in the visitor journey:
- Create new content that your visitors were expecting to find initially.
- Provide better access to content you already have, but that your visitors can’t find.
- Uncover the pages your visitors are searching from, to address a gap in page content or clear next steps in a user journey.
- Uncover source/medium combinations that may be setting up the wrong expectations, such as an email campaign/landing page combination.
- Compare and contrast search terms over time for insight into visitor trends and seasonality.
There are endless strategies that this report can be used to develop, but the one thing this report still doesn’t tell us is whether any results were generated for the visitor to even act upon.
Let’s fix that with Google Tag Manager.
“Sorry, No Results Found”
Four words that just gave your visitor a bad experience. Much like the 404 Error page, if you don’t have any results for your visitor then you should give them some options.
Perhaps you could provide them links to your most popular content or blog articles, or a unique discount code if you’re an ecommerce store. At the very least, expand upon the short generic message that is provided when there is no content to show, with something more personable.
For a long term strategy, let’s use Google Tag Manager to help us view the search terms that yielded no results for our site. If you’re not familiar with Google Tag Manager (and you should be) then I recommend running through a fantastic breakdown of Google Tag Manager written by UpBuild’s very own Ruth Burr Reedy.
OK – are you ready? Is your Google Tag Manager account ready?
All right, let’s get cooking!
Here are our the ingredients for our ‘Google Tag Manager Site Search Soup’:
- Tag #1 – No Results Found
- Tag #2 – UA – No Results Found
- Variable #1 – Results
- Variable #2 – Internal Search Term
Tag #1 – No Results Found
First let’s set up a new tag type of ‘Custom HTML’ and use the HTML code snippet below:
Quick Overview:
Name: No Results Found
Tag type: Custom HTML
HTML:
var str = {{Results}};
var patt = new RegExp(“Sorry, no posts matched your criteria.”);
var noresult = patt.test(str);
if (noresult) {
dataLayer.push({
‘event’: ‘uaNoResultsFound’,
‘gaEventCategory’: ‘Internal Search’,
‘gaEventAction’: ‘No Result’,
‘gaEventLabel’: ‘{{Internal Search Term}}’
});
}
</script>
IMPORTANT: You will need to customize the line that reads ‘Sorry, no posts matched your criteria.’ to the actual text that appears on your search results page when there are no results found.
Trigger #1 – No Results Page
Next, we’ll set up a trigger for the custom HTML snippet to act on.
Quick Overview:
Name: No Results Page
Trigger type: Page View – Window Loaded
Fires on: Some Window Loaded Events
Conditions: URL contains ?s=
NOTE: We will want to fire this when the URL contains our search query parameters, in our scenario it is ?s= (refer to the beginning of this article to find yours). If your browser bar doesn’t contain any, here is a great article on how to track without using search query parameters.
Now we should have our first tag and trigger set up as follows:
Tag #2 – UA – No Results Found
Our second tag needs to gather all of the data and send it over to our Google Analytics account.
Quick Overview:
Name: UA – No Results Found
Tag type: Universal Analytics
Track type: Event
Category: Internal Search
Action: No Result
Label: {{Internal Search Term}}
Google Analytics Settings – Variables enable you to easily use and maintain settings across tags.
- If you don’t have this variable set you may configure settings for this tag independently by checking the override checkbox and setting your UA Tracking ID via the override settings.
- If you want to set your UA Tracking ID as a variable you can simply choose ‘New Variable’.
Then set your Tracking ID and click ‘Save’.
We defined our Category and Action in the code snippet as ‘Internal Search’ and ‘No Result’. You can, of course, change these to suit your preferences, just be mindful of changing them in the code snippet also if you choose to do so.
For our label, we are going to be using a variable {{Internal Search Term}}, so that we can capture the internal search term that yielded no results (more on that in a minute). Lastly, be sure to add your own Google Analytics Tracking ID in order to gather the data from this tag.
Trigger #2 – UA – No Results Found
This trigger will fire when no search results are found, which will initialize our Google Analytics tag.
Quick Overview:
Name: UA – No Results Found
Trigger type: Custom Event
Fires on: Some Custom Events
Conditions: Event equals uaNoResultsFound
This is how everything should look for the second tag (again, you’ll want to put in your own Tracking ID for this to work):
Variable #1 – Results
This variable is what we use to recognize when there are no results found by using the message that displays on the search result page.
Name: Results
Variable Type: DOM Element
Selection Method: ID
Element ID: (This will vary based on your own website naming conventions. For our setup, the ID of the section containing the phrase ‘Sorry, no posts matched your criteria.’ is ‘main’.)
Variable #2 – Internal Search Term
Quick Overview:
Name: Internal Search Term
Variable type: URL
Component type: Query
Query Key: s
This is the variable that will capture the search query to be sent to Google Analytics.
The Result
That’s it!
Now we can see which search terms generated no results for our visitors. Pairing this data with the other dimensions and metrics can now help you develop complete actionable content strategies from a fully diverse custom report.
Why Stop There?!
Internal site search is a great way to capture a variety of keywords from lost visitors. But now that we know how to track the query we can apply that to other search fields too. Let’s say you offer a location-based service. Using an internal search field can help you ask specific questions to visitors:
- Enter your zip code/city – Discover new service areas that you could expand to.
- What service do you need? – Discover new services you might not currently offer.
- Find an article on: – Let your visitors drive your content strategy directly.
Internal Site Search can be a very powerful insight into understanding your visitor and allows you to ask your visitors questions without intrusive surveys or emails. The true value is using your newfound information and leveraging it against additional data in Google Analytics to build a better experience for your future visitors. Instead of creating pages of content for SEO, build a website based on what you naturally know and let your visitors fill in the gaps.