Recently, we were lucky enough at Twentyone to be able to attend the Search Leeds conference, coming back with several key insights into some of the things happening in the digital marketing industry.
One of the most interesting talks we saw was from Stephen Kenwright at Branded3, who emphasised the importance of tracking your website searches.
Stephen explained that by tracking what people are searching for on your website, you can get crucial insights into your audience and what they are looking for. Most importantly, you can see how well your website performs as its own search engine.
For example, you can see how relevant the search results are to a user’s query, or find out which searches return ‘not found’ results. This is a key thing to be aware of, as dead-end searches like this can affect bounce rates on your website, ultimately affecting user engagement.
We thought that Stephen’s point about tracking dead-end website search queries would be particularly useful for some of our own clients. Stephen’s slides note that it’s possible to do this via Google Tag Manager (GTM), so we quickly got to work on implementing this on some of our clients’ search-enabled Wordpress websites.
At Twentyone, we regularly use Google Tag Manager as part of our SEO and Conversion Rate Optimisation services to help us understand aspects like user engagement, as well as to improve goal tracking. We’ve previously written about the benefits of Google Tag Manager, but since we know there’s very little resource available around the implementation of search tracking for WordPress in GTM, we’ve decided to write this handy step-by-step guide for you.
To set up website search tracking in WordPress with Google Tag Manager, you need to follow these 6 simple steps:
First we need to capture whether a result was found or not for the performed search on your website. We do this by creating an identifier on a page element of the search.php file within your website theme, which is then used to display the returned results:
Next we need to create a variable with the ‘type’ of ‘Dom Element’ in Tag Manager for the identifier we created in Step 1:
Next we need to capture the search that the user entered into the search box on your WordPress website. When performing a search on a WordPress site you are redirected to the search results page and the search query forms part of the url parameters of the results page. So, for example if we searched for ‘widgets’ on a website with the domain of www.mydomain.com then we would be presented with the search results at a URL of: https://www.mydomain.com/?s=widgets. So, we just need to capture the query after the ‘/?s=’ by doing the following:
Next, we need to capture whether the search query by the user returned with ‘Results’ or ‘No Results’ and we need to use this as our ‘Action’ when setting up the Tag.
As discussed in Step 1, when a user searches on a WordPress site and there are no results to return, the WordPress search page displays a default message of something like “Sorry, but nothing matched your search terms. Please try again with some different keywords.”. Obviously, we need to simplify this as all we really need is a value such as ‘No Results’ as the ‘Action’ in Tag Manager:
Before we piece it all together and create a Tag, we need to create a trigger that specifies which webpage to trigger the tag on. In this case, we want this Tag to trigger on the WordPress search results page.
Now we need to put it all together and build the Tag.
That’s all there is to it!
Once you’ve submitted and published the trigger, you can then test it by going to ‘preview’ mode Tag Manager and performing a search on your website.
Typically, we also create an ‘event goal’ in Google Analytics with a category equal to ‘Search Used’, so that we can monitor this as a conversion in GA.
By following these simple steps, you can easily monitor the way your website users are engaging with the search functionality on your website. You can report on queries that return ‘No Results’ and use this data to make informed marketing decisions. For example, if you have an ecommerce website and people regularly search for a product that you don’t stock, then you might decide to find a supplier of that product and add it to your inventory. Equally, you can identify regular searches on your website which might suggest that people are finding it difficult to find certain items, which might indicate you need to look at the structure and UX of your website.
If you have any questions or need any more help or assistance, don’t hesitate to get in touch with us! You can give us a call on 01254 660 560, or email us at firstname.lastname@example.org. Let’s talk!