Why Every Site Needs a Search Engine

This article gives you two ways you can implement site-specific searches on your web page. Think of it as like having your own site-wide search engine. The question is: why should you do it?

It's simple, really: keywords used by your target market are part of your marketing resources. They help in market research, market development, and outreach marketing.

Search terms used by your visitors tell you what they want to see on your site. They also tell you how you should be marketing your site, what content you you should be producing, and how items should be listed for sale.

However, it can be tricky to make the most of this valuable information, and capturing it through various plug-ins is not always straightforward, or cheap.

Both these techniques are highly transparent, and free to use; my advice is to start using on-site search to monitor your existing market and build out your strategic keyword management process using the data that you gather as a result.

The Simple Search Solution

Use Google site search.

The background to this approach is represented by the following Google query:

  • site:searchengineland.com keyword research

This simple instruction tells Google to only return results for the site mentioned. This is convenient for site owners who want to check their coverage of keyword terms, but also very convenient if you want to provide a site specific search function.

The only caveat is that the pages must be indexed by Google.

Drop-In Javascript

There are two parts to the solution:

  • The HTML for the search form;
  • The Javascript to open the search.

Refinements on the following drop-in HTML and Javascript are many and various:

  • open the search in a new window;
  • open the search in an inline frame;
  • use various search modifiers to steer the result;
  • etc.
The one major advantage is that you'll see, in your web traffic statistics, the search terms being used to query Google. This means that you can check that people are coming to your site for the right reasons, and, crucially, check that you're still serving them to the best of your ability.

Here's the basic HTML:

<input id="search query" type="text" />
<button 
onClick="window.location.href=submitSearch(document.getElementById('search_query').value);">
Search</button>

All that this does is call the Javascript function submitSearch (defined below) with the contents of the text input (that's what all that getElementById code does), and then set the URL of the current page to the result of the submitSearch function.

Here's the Javascript (stick it at the top of the page, in the head section):

<script type="text/javascript">
function submitSearch(search_query) {
  search_domain = encodeURIComponent('site:your-domain.com');
  search_text = '+"' + search_query.replace(" ", "+") + '"';
  return search_domain + search_text;
}
</script>

This snippet forms the query out of the site and the query text, making sure that it is safe for use in a URL. Important: you should replace your-domain.com with your own domain.

The result is a Google search page, containing results for the keywords typed in by the visitor, restricted to pages from your site. In your logging, you will then see an Exit with the URL, inclduign the keywords.

Note that this doesn't work for sub-domains terribly well; so, for it to work, you will need to buy your own domain name, even if you only use it to point to Blogger!

More Advanced Options

Create a Google Custom Search engine, and add it to your site.

There are a few pre-requisites:

  • Your site is registered in Search Console;
  • You have Google Analytics set up.

The process is relatively painless, if a little technical. However, as always, the Google help on the topic is pretty good, and as long as you can edit your web site HTML, it should be fairly straightforward.

A big plus for bloggers, especially, is that it can be monetised via AdSense, too.

Tip: You get a bit more power, and advanced analytics (thanks to integration with Google Analytics and Search Console) including the ability to use sub-domains.

So, What Now?

The worst thing you can do is nothing.

At a minimum you need to give your site users a decent way to search your content for something that is meaningful to them. The next worst thing would be not to track the things they look for.

Google has tried to make this a bit more opaque, in the name of privacy. They hide the content of query strings made by users who are logged into their Google account, for example. However, you should attempt to get as much search data from your own site as possible.

Why?

The reasoning is simple: if a visitor comes to your site, looking for something specific and can't find it, it's your responsibility to make sure that you supply it.

This is how market research operates. Strategic keyword management - treating your pool of available SEO friendly keyword phrases as a valuable business resource - relies on market research.

Without it, you're just throwing spaghetti at the wall, hoping that some of it sticks.