Getting started with Programmable Search Engine

Add Programmable Search Engine to your site

Once you've created your Programmable Search Engine, you can add the Programmable Search Element code to your site. To do this, you'll need to copy some code and paste it into your site's HTML where you want your search engine to appear.

  1. From the list of search engines, select the search engine you want to implement on your site.
  2. Click Overview, under Basic on the right hand side, you will find Code.
  3. Click Get code
  4. Copy the code and paste it into your site’s HTML source code where you want your search engine to appear.
  5. Paste the code in every page where you want a Programmable Search Engine box. You can paste the code anywhere within the <body></body> tag of your webpage.
  6. If you've chosen the "Two page" layout option, you'll need to copy and paste two snippets of code:
    1. Paste the first code snippet where you want the search box to appear.
    2. Paste the second code snippet where you want the search results to appear.
    3. For two-page layout, type the URL of the webpage that will show the results for your search engine. Type the query parameter name embedded in the url, which is parsed by the search results page. 
  7. If you've chosen the "Two column" layout option, insert the code for the search box in one column and the code for the results in another column.
  8. If you've chosen the "Results only" layout, insert the code snippet in the webpage where you want the search results to appear.


  1. The <div class="gcse-search"></div> element is a placeholder - this is where the search element (both search box and search results) will be rendered.
  2. If you are using hover effects for your Search element, your HTML page must use a supported doctype such as <!DOCTYPE html>. For the most cross-browser compatibility, it is recommended that your HTML pages use a supported doctype such as<!DOCTYPE html>.


Clear search
Close search
Google apps
Main menu