If you are an AdSense publisher running AdSense ads on your WordPress site then there is an other easy way to increase your revenue potential.Google offers a custom search box code inside AdSense account which can be placed on all pages complying AdSense publisher guidelines. Especially when you have lot of pages on your site, it is a good idea to place a search box on the sidebar. This search box will not only help users to quickly get the relevant content on your site but also going to generate more revenue for you. In this article we will discuss how to add a Google custom search box on your WordPress site.
How to Get Google Custom Search Box Code?
Step1 – Getting Search Code
Login to your AdSense account and navigate to “My Ads” tab. Click on the “Custom search engines” option available under “Search” section and then click on “+ New custom search engine” button.
Similar to creating content ads fill out the required details on the page. Ensure to select “Only sites I select” option under “What to search” section and enter the URL of your WordPress site.
Select custom channel if needed, appropriate styles for the search box and the ads to be displayed on the search page. The important section is the “Search results” section and choose the option “on my website using an iframe” for “Search results” and provide the URL of the page on which you want to display the search results. In this example we want to display the search results on the page with the slug as “search”.
Click “Save and get code” to generate the search box and search results page code.
More Customizing Options
If you want to customize the search box then click on the “Access more advanced search features” link. This will take you to the Google custom search box creation page outside your AdSense account.
Here you can customize the look and feel, theme, thumbnail option on the search results, statistics and logo for your search box. Once you finished the customizations, click on the “Save & Get Code” button. Unlike AdSense ads, the custom search box code has two parts:
- Code to be placed on the search box widget
- Code to be placed on the search results page
Note: Ensure the page URL is correct on the ad code as well as on the text link below the ad codes.
How to Add Google Custom Search Box in Your WordPress Site?
Now that you have the search box code and the next step is to paste them on your WordPress site. Go to your WordPress admin dashboard and create a new page with the slug as “search”. The page URL should be same as the URL on the ad code and you don’t need to add any content on the page.
Paste the second part of the ad code (Search results code) on the “search” page. You may need an external plugin if your theme does not support adding custom HTML / Script on the page. Publish the page and ensure the page is accessible with the correct URL.
Now go to “Appearance > Widgets” section and add a “Text” widget to the sidebar. Paste the first part of the ad code (Search box code) inside the “Text” widget and save the changes. You are done with adding a custom search box on your WordPress site, test the search box by entering a keyword and the search results should be displayed on the “search” page within your site.
Points to Remember
- Note Google custom search box can also be used without AdSense publisher account directly from custom search box page, learn more about this in our earlier article.
- You can customize the search box either using inline CSS or using separate CSS class.
- Be aware that Google shares 51% of the revenue with publishers for search ads while the sharing is higher on content ads with 68%. Learn more on Google AdSense revenue sharing mechanism.
Leave a Reply
Your email is safe with us.