How do I create a Google Custom Search Engine?

In order to make a Google Custom Search Engine to include in your app, follow these steps.

1. First you should perform a Google site search on your website to ensure that Google will return good results. If Google has not indexed your site, or indexed it poorly, then setting up a Google CSE may not be worth the time and effort.
a) Go to www.google.com.
b) In the search bar, type the following: site:www.yourwebpage.xyz searchterm
c) Where the url of your site is in PURPLE, and any search term is in GREEN
d) Examine your results to make sure they are what you expect them to be.

2. Setup a Google account if you don’t already have one. The search engine will be bound to this account, so you may want to make it an account that is owned and maintained by your company, not a personal account.

3. Make a Google CSE.
a) Go to https://cse.google.com and log in with your Google account.
b) Type your url into the “Sites to search” box.
c) Type a name for your search engine into the “Name of the search engine” box.
d) Click the “CREATE” button.
e) Customize the search engine as you wish. You can set up Safe Search and many other options in your dashboard.
f) In the setup tab, click on the “Search Engine ID” button. You will need this ID later.

4. Get an API key
a) Go to https://console.developers.google.com and log in with your Google account.
b) Create a new project.
c) Click on “Credentials”, then click “Create Credentials”. On the dropdown click “API Key”. You will need the Key later.
d) Click on “Library” on the side bar.
e) Type “Search” into the search bar. When the results appear, click on “Custom Search API”
f) Click “Enable”.

5. You now have set up your Custom Search Engine. You will need the CSE Key from Step 3f and the API Key from Step 4c in order to set up your app to use your search engine. Once the search is set up, you will see a magnifying glass icon in your header.