Two methods to use Google search on your website. Using google search on your website is an effective method to help visitors find content quickly. It also gives an idea of what users are searching for on your website.
Method 1: Using Google custom search
- Go to cse.google.com
- Login with your Gmail id.
- Enter your website URL. (If you want to search the entire web, enable search the entire web).
- Go to edition-> Click on get code.
- Add this code to your website and take live.
- If you are on Wordpress, you can add this code using the WP Google search plugin.
Method 2: Using the Google custom search API
- Create a Google custom search engine.
- Enter your website URL.
- Get your CX or search engine ID from your Google custom search control panel.
- Get your Google custom search JSON API Key from here.
- Formulate your Google custom search API URL in the following format.
https://www.googleapis.com/customsearch/v1?key={YOUR_API_KEY}&cx={CUSTOM_SEARCH_ENGINE_ID}&q={KEYWORD}