Posted on November 15, 2017 by Stewart Liesnham
Introduction to Magento 2 Search
Magento 2 search can sometimes be suboptimal when more than one search term is used. Your initial reaction might be that the search engine isn’t very good. However, using data collected from the Magento 2 admin and using some experience, the platform offers some great flexibility to customise and therefore optimise search results. The end result can be a much better user experience for your site visitors and hopefully a better conversion rate. To find out more, read on.
Before we dive in, there are some key considerations before you start trying to customise your search within M2.
Understanding user behaviour
First, we need to take a step back from the M2 website under consideration and look at how the visitors arrive at your website in the first place. If you are using Paid Search Engine Marketing and Search Engine Optimisation for organic search, then the ‘searching’ has most likely been done BEFORE the visitor arrives at your website. Hopefully, they’ve landed on the right page to meet their needs. In other words, these users are arriving at the website on the product page they are looking for. As such, Magento search is less critical to this type of user. What is critical is ensuring you have a good Digital Marketing strategy to ensure these potential buyers are finding your products through search and landing right where they need to in order to purchase.
Everyone else that lands on your site, through more generic search terms or through your efforts to promote your business and products/services, may be better considered a ‘browser’. They land on your site because they are interested in what you have to offer but might not have a specific product or service in mind. This is the main target audience for optimising your on-site Magento search terms.
We’ll get into a specific example shortly. For now, I’ll show you how to find where you customise search terms in the site admin. So, when you are logged into your M2 admin, click on the Marketing tab and then under SEO & Search you will see ‘Search Terms’ – as highlighted in the image below. Select this option and it will take you through to the Search Terms page.
The Search Terms page in the Magento 2 admin
When you select the option above it will open the Search Terms page, as shown below.
The purpose of this page is two-fold. First of all, it’s where all your user intelligence is to be found in terms of what people have searched for on your website. This is actual, real-world data and therefore a potential gold mine in terms of understanding users search behaviour. This page will show you the most recent search queries, how many results that query received and how many times it’s been used. You can filter the data by Uses so that the most frequently used search terms are shown at the top. Not only can you see popular search terms you can also see mis-spellings and other such data which you can use to provide a better visitor experience. There are two key opportunities here;
Within the search queries used, you may find things like common mis-spellings or people searching using singular (eg. fridge) when your products are only listed in their plural form (e.g. fridges), and vice versa. This is your opportunity to catch these and redirect them to the actual search results (products) they were looking for rather than no results which can be frustrating and result in visitors leaving your website.
Products or Brands you don’t stock
If visitors are searching for products or brands you don’t carry, rather than give them zero results in the search, redirect them to a Magento landing page that can offer them alternatives. This would be like going the extra mile if you were face to face with the customer. It shows understanding, great customer service and may result in a sale when otherwise the visitor would have just moved on.
Creating Your Custom Search
Here’s an example below of how the search term ‘black fridge’ returns unexpected results. Because we have two words in the search, Magento treats these as mutually exclusive. So, in this case, ‘black’ is being weighted higher than ‘fridge’. So items in the database that are ‘black’ are being listed above those that are ‘fridges’, the search terms are not being used collectively because that’s not how the search works in Magento. This makes sense if you think about it but also, Magento has provided loads of customisation options, which is the purpose of this blog post of course. It should also be noted that you can also ‘weight’ product attributes in Magento in order to optimise search too – that however is outside of the scope of this article.
To deliver better results for this search term we can set up a custom search term within the M2 admin. More on this below.
Having determined that this search terms doesn’t work as we’d like it to, we can add this as a search term in the admin as described. In order to do this, we need to determine a destination URL so that we can effectively override the search and direct that specific term to a specific page. Below I’ve selected the ‘Fridges’ category from the main site navigation. Then I’ve used the search filter on the left to select just the black fridges. This sends me to the page URL as shown below. Copy this URL to your clipboard and then we will use it to set up our custom search.
If you now go back to the site admin you can create a New Search, this will display the following information. All we need to do is add the search query (in this case black fridge), select the Store View we want this search to apply to, and then add the redirect URL which we copied above. Click save. Please note that if the search query already exists in the database you will need to search for this on this page and then edit it – this only applies if you get a message to say that your search term already exists. As mentioned above, you can also set up a custom search for products or brands that you don’t carry. So if there’s a brand you don’t carry but you have some great alternatives – redirect that search term to a Magento landing page suggesting alternatives. You may make a sale when otherwise the visitor is just going to leave and go somewhere else. It’s also a great opportunity to share your knowledge with your visitors because you may have a much better alternative, this is your opportunity to say why.
If you now go back to the main website and carry out the same search as before, you will get the results as shown below. Perfect!
Search synonyms in Magento 2 is another way to customise search. This is a way to link related search terms but only applies to single words. If you have a single word search term that is commonly misspelt, you can link these by creating a Synonym. You do this by creating a list of words, separated by commas. When anyone searches for any of these words, they will all be linked to the same search results. These are especially useful for single search terms that can be misspelt. For anything else, there are the custom search options above.
How to Video
Here’s a video with a step by step guide that shows you how to do everything I’ve talked about above.
Successful websites are as much about the experience as they are your products and services. You want to get your visitors to what they want quickly and with as little friction as possible. This is why Magento 2 has these really useful features that allow you to fine-tune your visitors’ search experience. Now you know how this works it’s well worth spending time regularly, fine-tuning this part of your website.