Find Missed Site Search Terms Using GTM on Your WordPress Website

Though using Google Analytics settings, you can find the missed site search terms but I personally feel that Google Analytics does not show you the entire missed search terms. Also, GA does not show you the site search terms in particular for which your website returned a soft 404 page.

On my travel blog called, I have done some manual site searches but I saw them missing in my Google analytics report. So, I thought I would implement missed site searches through GTM on my own blog and compare the results. So let’s go. Here is a video that you can watch or you can skip to the content for a detailed explanation.

How to Find Missed Site Search Terms Using GTM

It has some pre-requisite before you proceed for this implementation. The pre-requisite is you should have GTM for WordPress plugin installed. Here is the link to it.

Find the site search term in the data layer

Once you have the plugin installed. In the Google Tag Manager, use the preview mode to see the Data layer variable automatically inserted by this plugin. I search for abcdefghi on my website and here are the data layer variables.

Data layer variables

You can see abcdefghi in the data layer being held by the data layer variable named siteSearchTerm.

Create a data layer variable for the site search terms

We will use this data layer variable to capture all the site search terms. Here is how to create it. Select the variable type as data later and put in the variable name and save it.

Site search term data layer variable

Create a data layer variable for soft 404-page titles

Logically, missed site search terms will appear only on the soft 404 pages of the website. So, in this case, we have to track the search terms appearing on the soft 404 pages. So, to capture that, we will create a data layer variable which will capture the title tag of the page with “Nothing Found”. We will use CSS selectors for that.

  • Inspect element by right-clicking on the title and see the CSS. To me, it looks like this and probably for all other WordPress blogs as well

CSS selector for wordpress blog title

As you can see above, the title is in h1.entry-title CSS selector. So, we will now create a data layer variable to capture this using DOM element as shown below.

Wordpress entry title data layer variable

Create a trigger to fire only on the soft-404 pages

This is going to be a simple trigger in where the trigger type will be page view. So the trigger will fire only on the page views. Use the data layer variable in the condition that this trigger will only fire when the entry title equals nothing found.

Trigger for nothing found wordpress tracking

Create a tag to capture the missed site search terms now

Tag for tracking missed site search terms

The tag type will be Google analytics. The track type will be an event. You can fill in the category and action as per your choice. In the label, we are going to capture the missed site search terms so here, we are going to use the data layer variable that we created to capture the data layer site search term. Another important setting is set up the non-interaction hit as true.

Now you are done with setting up the Google Tag Manager to capture the missed site search terms. You can do a random search on your website now but before that put GTM in the preview mode. You can see that on the page view, the tag that I created to capture the missed site search terms was fired.

Not found site search term tag fired

You can also check for the same in the real time in Google Analytics. and here is what it look likes for me.

I hope this was helpful for you.

Have a Question? Get in Touch!

Leave a Reply

Your email address will not be published. Required fields are marked *