Google Search Script

Google search script for sites is an easy and effective way to add search capabilities to your site. The only issue is that google search has ads and for an ad-free search, experience, click here.

#1. Create your own search engine:

visit google custom search : https://cse.google.com/cse/

google custome search home2. Sign in to Custom Search Engine using your Google  Account

3. After sign in, go to “https://cse.google.com/cse/create/new” to create a new search engine.

new google search engine

4. In the site to search input box, mention your site ( ex. https://www.expertrec.com). Also, you can mention a particular URL path, so that all URLs under that path will only be searched, ex. www.expertrec.com/blog. You can also use the regex pattern for the URLs to be searched. If you need all the subdomains to be searched, you can mention it. ex. *.expertrec.com which will cover all subdomains for searching. By default, the name of the search engine will be the domain name, which can be changed under “Name of the search engine” input box. Click on “create”, so that custom search engine for all the URLs mentioned will be created instantly.

custom search created

As shown above, Below options are shown:

  1.  Add it to your site: This step will be for obtaining and adding javascript code to your site.
  2.  View it on the web:  This is public URL, upon opening, will show the search demo built on top of Google search index.
  3.  Modify your search engine: This is for modifying search settings which

“View it on the web” link will show the demo of search as a preview. If you modify any settings, you can visit this url and get search demo quickly.

Google Search Results Demo

Google Search Results Demo

“Modify your search engine” consists of various settings such as search layout, themes, search box customization and thumbnail(image), promotions, refinements, autocomplete etc.

Google search settings

Google search settings

#2 Adding Google Search Script:
google search script code

google search script code

Once you have done changes, save settings and get the code in “look and feel”  settings tab by clicking on “save & get code”. You can see where to put this code inside HTML page, by clicking “See HTML Example” button. Generally, this piece of code is kept where the search box needs to be shown to Users. Note that, search on your site is powered by this simple piece of code. So on your preproduction site, you can see this integration and roll out to production very easily. And search using google search script should be live on your site.

Advantages:

  1. Get results for Web, Images, Videos, News, Files, and Weather
  2. Easy to setup

Disadvantages:

  1. Google will show ads in the search results. So sometimes customers may see ads of your competitors in your site itself.
  2. Gets difficult to manage look-and-feel as per your website theme

If you are looking for ad-free google search script alternative, you can sign up with ExpertRec search script.

ExpertRec Search Script:

  1. head on to https://cse.expertrec.com?platform=cse
  2. Enter your site URL
  3. Add Sitemap URL ( if present)
  4. Get the Expertrec Search Script code and add it to your site

User Interface for this integration is highly customizable and can be modified to match your site theme easily. ExpertRec Custom Search code explains more on this.

Google Search Script is a powerful script to create your own search engine based on Google. With this script, you can instantly get results for Web, Images, Videos, News, Files, and Weather. But Google will show ads in the search results. As an easy alternative, you can try Expertrec Site Search.

ExpertRec Site Search

govind dhonddev

Govind Dhonddev is a Software Engineer at ExpertRec, who loves coding, food and writing blogs.

You may also like