The WordPress search function has never been good. And yet providing a good search function is a great way to keep readers on your site for longer.
I wrote back here about why I set up Google Custom Search on this site.
It was pretty much a no-brainer really: if you can get the leading search technology working on your site why the heck wouldn’t you..?
So here’s the process for setting up Google Custom Search on your site.
How to set up Google Custom Search
When you’re first setting up GCS it’s a good idea to carry out Steps 1 to 6 below first and leave the rest until later.
This will get your search engine up and running and you can make sure it’s working as you expect it to, before moving on to the remaining steps and adding further tweaks.
And when you’re making tweaks it’s important to make only one change at a time and check the results before making another.
If you make multiple changes at once you won’t know which one caused any changes in performance.
Go to the Google Custom Search homepage and click the ‘Create a New Search Engine’ button.
You will be asked to log in to your Google account or create a new one.
After logging in you’ll need to fill in some basic information:
Search Engine name and description: Use your site name or domain name and keep your description to less than 150 characters.
Keywords: Use as few keywords as possible (1 is best and no more than 3) but make sure they accurately represent the content on your site.
Using too many keywords restricts the search results, causing them to omit some articles.
I started off with around 8 keywords, and my initial search results were very disappointing. They improved dramatically when I cut it down to 3.
Choose your language settings. I have transliteration set to ‘off’ because it’s not available with the search element.
Choose your search preferences. I’ve selected ‘Search only included sites’ because I don’t want people leaving my site for another.
In the menu bar on the left, click on ‘Sites’ and add the URL of the site or sites you want included in the results.
In the menu bar on the left click ‘Indexing’. You will see the list of sitemaps that are associated with your Google account. These come from your Google Webmaster Tools settings.
The first time you set up a custom search engine it’s a good idea to select the sitemap url of the site to which you’re applying the search engine and click the ‘Index now’ button.
If you don’t have a sitemap you should set one up and submit it via Google Webmaster Tools. If you need to set up your GWT account and verify your site this article explains how.
You can also submit individual pages to be indexed if they’re particularly important. I haven’t submitted any individual pages for this site.
Important: Is this a new Custom Search Engine you’re setting up?
If so, you’ve now provided enough data for the initial set up. So move to Step 11 below to set the look and feel of your search widget and grab the code to install on your site.
You can come back and add tweaks and refinements to your settings (Steps 7 to 10) later, once your basic search engine is working well.
In the menu bar on the left click ‘Refinements’.
A refinement is the way you can offer options to searchers who type in a very broad search query.
For example, if a searcher typed in ‘WordPress’ as a search term, the refinements offered may be ‘WordPress themes’, ‘WordPress plugins’ and ‘WordPress backup’.
These are offered to searchers immediately below the search box and above the first results, and you define these options on the Refinements page.
If your searchers are typing in broad terms on subjects for which you have a range of articles you may want to categorise the articles you have and define them as refinements.
Make sure there’s a good range of articles within each category – for example I have 40 articles on WordPress plugins on this site – and add these terms as refinements.
In the menu bar on the left click ‘Promotions’.
A promotion is an article that you specifically want to appear in response to a particular search term or range of search terms.
You might use this if you wanted the review page on an affiliate product to appear, ahead of any other related page, whenever someone types in the name of the product, for example.
Add any pages you want to promote.
Go to the menu bar on the left and click ‘Synonyms’.
A synonym is a related term and it’s a way of broadening the results.
For example, a related term to ‘plugin’ would be ‘addon’, and adding this as a synonym would produce results as if both ‘plugin’ and ‘addon’ were included in the search query.
Be careful, though, because adding synonyms that are not truly related may produce some nonsense results, which would give your users a poor experience.
Add any synonyms that would be appropriate based on your site’s content.
In the menu bar on the left click ‘Autocompletions’
With autocompletions enabled your search engine will suggest related or previous searches based on the first few characters a searcher types.
I believe autocompletions is now available by default across all GCS engines, but you do have the opportunity on this page to add specific autocompletions to be included or excluded on your site, based on your site’s content.
Add any ‘to be included’ or ‘to be excluded’ autocompletions.
Go to the menu bar on the left and click ‘Look and feel’.
This page enables you to customize the appearance of your search results.
I initially chose to host the search results on my own site (search element) but I had a lot of trouble making the search results fit properly within my site layout.
It never looked good.
So I now host the results on a Google page. This is not ideal because searchers may initially be put off by the change in appearance, and think they’ve been shunted off to another site.
To get around that I’ve put a note above my search box explaining that the search results will appear on a Google page.
While this is not ideal, the process is more professional than having the search results appear on a page on which the formatting is all over the place.
So make your choices, then click ‘Save and get code’.
If you clicked ‘Save and get code’ from the ‘Look and feel’ page you will end up on the ‘Get code’ page. If not, then click ‘Get Code’ in the menu bar on the left.
The code in the box will have been generated based on the settings you made in the previous steps.
Copy the lot and paste it into your site. On this site I’ve pasted it into a simple text widget, which I’ve then named ‘Search This Site:’ and placed at the top of the first sidebar.
Google Custom Search is a powerful tool and it’s transformed the search experience on this site.
However, it does take a bit of testing, tweaking and re-testing to get it working right.
So, as I mentioned earlier, go through steps 1 to 6 above and install the search box on your site first.
Test it, tweak it if necessary (paying particular attention to the keywords you’ve set) and make sure it’s producing the results you expect it to.
Remember to make only one change at a time and test the results before making another.
Once it’s working to your satisfaction you can then go back and add the refinements in steps 7 to 10.