In this article, we will understand what is google custom search. As per Wikipedia,

Google Custom Search is a platform provided by Google that allows web developers to feature specialized information in web searches, refine and categorize queries and create customized search engines, based on Google Search. The service allows users to narrow the 11.5 billion indexed web pages down to a topical group of pages relevant to the creator’s needs. Google launched the service on October 23, 2006.

When can I use Google Custom Search?

Google Custom Search leverages Google’s web index.  Hence if you have a public website (more details below), then we can create a custom search engine with only our website(s).

Let’s dig deeper at what we mean by a publicly accessible website.

  1. It should be accessible over the open internet.  No VPN, etc should be needed to access the website.
  2. It should not be behind a login.  Anyone without signing in should be able to read your content.
  3. robots.txt should not be blocking your pages from bots.

Now, if you satisfy the above requirements, you can use google custom search to power your website search box.

Create an account at google custom search.

Enter a list of urls/website addresses you want the search to work on. And click Create.

You will be greeted by a Congratulations screen.

On the Get Code page, you will get the code to take the search live.  In this code, you will find cx id.  The following gif highlights the cx code.  Do note this down as this is needed to get an ad free gcs.

Once you have pasted the code in your html pages, you can use the search feature.  If you want to rather pay and not see ads of your competitors in your search results, note the cx id, and proceed to ad-free GCS article.