google search script code

Google Search Script

Rate this article

Share this article

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.

Create your own search script using Google :

  1. visit google custom search: https://cse.google.com/cse/google search script
  2. 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.google search script
  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 the “Name of the search engine” input box. Click on “create”, so that a custom search engine for all the URLs mentioned will be created instantly.google search script
  5. As shown above, the 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 a public URL, upon opening, will show the search demo built on top of the Google search index.
    3.  Modify your search engine: This is for modifying search settings. “View it on the web” link will show the demo of the search as a preview. If you modify any settings, you can visit this URL and get a search demo quickly.google search script
    4. “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 script
Google search settings

Adding Google Search Script:

google search script code
google search script code

Once you have done changes, save settings and get the code in the “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 of Google search script:

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

Disadvantages of Google search script:

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

If you are looking for an 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

FAQs

1. How do I Create a Web Search?

It is very simple to create a new web search using Google and add it to your site. You only have to choose which site you want to search and give your search bar a name.

 

Steps to create your search engine:

  • First, go to the custom google search page and sign in.
  • Then go to the ‘Programmable Search Engine’ homepage and click on the “new search engine” option or the “create a custom search engine” option.
  • After you find the “sites to search” box, type in the sites you want to include. URLs can also be typed in there. 
  • Then you can end this task by going to “name of the search engine” if you want to change its name, and clicking “create”. 

 

2.How do You Find Out What Script a Website is Using?

Every web browser, including Google, will let you know your source code. However, to do that, you need some commands that will help you view it.

For The PC Users:

  • Google Chrome: First click on three horizontal lines in the upper right. After that, select “Tools” and click on “View Source.”
  • Firefox: Go to the “Firefox” menu. Under the “Web Developer” button, click “Page Source.”
  • Edge/Internet Explorer: You can right-click and select “View Source”.

For The Mac Users:

  • Chrome: First, go to “View” and click on “Developer” and “View Source” consequently. After that, simply right-click and select “View Page Source”. 
  • Safari: You can just right-click and get the “Show Page Source” option from the webpage itself.
  • Firefox: Lastly, right-click to select “Page Source” or navigate to the “Tools” menu, click on “Web Developer,” and select “Page Source.” 

3.What Is A Script Browser?

Browser scripts are a form of function or code that uses JavaScript to run in web browsers. These browsers help you check your client-side rendering, your application and help you with your scripting. To know this in detail, you either have to know about Selenium, Puppeteer, etc., or you have to hire a coder for implementation.

The steps you should know in Browser Script:

Navigation: 

It has similar usage to a browser’s location bar as it can also navigate to locations. It either freshly opens a browser context and goes there, or navigates from one location to another. 

Click: 

If you specify an element such as class or title, then this function can step-click that element on the page. It is usually used for clicking buttons or links.

Type:

This step imitates typing texts into text fields and text-entering areas. You can specify and command it to write just what you want. If it doesn’t find something, then it waits for that thing to appear. 

Scrape:

It functions similarly to “view source” and is usually used for scripting, because it shows the elements that exist on the screen. 

Evaluate Block:

If you ever need to do on-page automation, this may come in very handy as it does it in a very refined way. 

4. How do You Search For a Script?

There are only two types of script searches- “Find” and “Find and replaced”. Both of these boxes will stay open even if you are working. Also, if you select the text, it automatically goes to the “Find” field.

ExpertRec Site Search

Are you showing the right products, to the right shoppers, at the right time? Contact us to know more.
You may also like