Apart from placing ads, Google Adsense provides Google search engine for a website which helps to earn more Google Adsense revenue. If you are an Adsense publisher, then you should try this method to make money with Adsense. When the user enters a keyword in your website search field, a user will redirect to the search page, where search result will be displayed along with some relevant ads. If a user clicks one of the ad links from search result page, you get a commission for this.
You may want to replace default Google search form with the different layout. We will show you how to this in the moment.
Let’s first see step by step guide on integrating Google Search engine on a website.
Add Google Adsense Search Box And Search Result Code
Login to your Adsense account. From your Adsense dashboard, click on My ads->Search->Custom search engines.
Click on the ‘New Custom search engines’ button. On the next page, fill out the form. For ‘What to search’ field, select the second option ‘Only sites I select’ and enter your website URL in the field.
Scroll down the page, click on the Search results, select the last option ‘on my website’ and enter the URL of your website search page where you will display the search result.
Next, hit the Save and get code button. It will open a pop-up window. Copy both Search box code and Search result code.
Search box code will go into the place of your search box. And Search result code will need to place on your search result page.
Replace Adsense Search Box
When we enter a keyword in the Adsense search box and hit submit button, it will redirect to a search page with the parameter ‘?q=YOUR_KEYWORD’.
For instance, if your search result page URL is http://yourdomain.com/search. Then your dynamic URL will become http://yourdomain.com/search?q=wordpress. Here ‘wordpress’ is the keyword we want to search for.
If you want to replace default Google Adsense search box, you just need to set action URL of a form to the search page and search field name as ‘q’.
<?php $q = isset($_GET['q']) ? $_GET['q'] : ''; ?> <form class="search-form" method="get" action="http://yourdomain.com/search"> <input type="search" name="q" value="<?php echo $q; ?>" /> <input type="submit" name="search" value="Search" /> </form>
That’s it! We hope you got to know about adding Adsense search on a website. If you have any questions or suggestions please leave a comment below.
- How To Customize WooCommerce Product Search On Your WordPress Site
- How To Create Custom Search Form In WordPress
If you liked this article, then please subscribe to our YouTube Channel for video tutorials.