Add a Google Website Search


One of the things I have had on my to do list was to replace the WordPress search with the Google Custom search. The WordPress search gives decent search results, but it is hard to compete with the accuracy of Google website search. I was reminded about that today when I was searching for a post I knew I had written about url canonicalization but I could not find it with the WordPress search quickly. I have written about Google custom search in the past and decided that this was the time to add it to the site.

Adding a Google Custom Search to your website or blog is a very easy thing to do. The first step is to visit the Google custom search to create your new custom search. Click the nice big button that says “Create a Custom Search Engine” to get started.

You will then be presented with a screen similar to the one below. Follow the simple instructions to setup you website search engine by giving your search engine a name and description. You probably want to skip the keywords box for a website search engine. It is important to select “Only sites I select.” under what sites you want to search, unless you have network of websites that you want to including in your results. In the select some sites input box make sure you take a look at the “Tips for Formatting URLs. You need to enter the URL correctly or your search engine might not search your entire website. For example to search all of a website you need to enter it like this:

Entire sites: Specifying www.mysite.com/\* will include all the pages on www.mysite.com.

Google Custom Search setup

Once you agree to the terms of service you can then try out your new website search engine and manage many if the smaller details about it. Some of the sections you might want to pay attention to to manage your website search include the look and feel tab and the code sections. The look and feel options allow you to customize the search box, colors and add your custom logo to the Google hosted results pages. Whether you choose to host the results on your website or let Google host the results it is always nice to blend the results with your colors and logo.

The code tab allows you to setup the search to host the results on your own website or blog instead of relying on Google hosting the results. This is great to keep people on your website and blog as well as blend the website search even more with your website. In order to host the results on your own website you need to create a new page for it. Depending on what content management system you use or blogging software this can be different for everyone. The basic requirement is you need to create a new page to host the results with the Javascript code that Google gives you. For example using WordPress I created a new page called Search Results and I published it. I hide it from the menu using the Page Link Manager plugin. Once you have the URL for the page, paste it into the Google Custom Search Code page then you can copy and paste the search results Javascript code into the search results page you just created.

You will also need to include the search box on your site somewhere. An easy place it to copy it into a sidebar text widget or place it directly into your theme like I have. Once this is all done you can use your new search engine to search your website.blog and make it easy for people to find what they are looking for all with them not leaving your website. The added bonus is that the the Google Custom Search can also be linked to your Adsense account, making you money every time someone clicks on an ad on the search results.

I took me roughly 20 minutes to add a Google custom search to the LGR Internet Solutions website and blog but it has already been a benefit to my users. I have noticed people doing searches in my statistics and reading more pages on the website. As a result my overall bounce rate has gone down and my page views have increased. While that is not just because of the search box, it has helped to keep people here and reading. Take a look at adding a Google custom search to your website/blog. It could help them find exactly what they are looking for.

Categories: google tools web-design