How to Integrate Google Adsense Search into Your WordPress Site

How to Integrate Google Adsense Search into WordPress Site

Adding Google Custom Search on your blog is a nice way to increase your Google Adsense earnings.

Just a few days ago, I read somewhere that adding Google Adsense search on the site can make more revenue from Adsense than the normal ads.

So I added Google Adsense search to some of the sites including this one.

And yes, it does improve Adsense earnings as advertisers spend more on search ads than display ads.

If you click on the search icon on the menu, you can see Google custom search being loaded, as seen in the image below. (Not after the changes in MaherHackers design.

Google Custom Search

How to Add Google Search in Your WordPress Site

To add the custom search engine to your site, First, go to

After logging into your Adsense account, go to Ads for Search > Custom search engines and click on the New custom search engine button on top.

Create custom search engine adsense

In the next window, you can create your custom search engine.

Add custom search engine

Here, you can create your custom google search. You need to edit the following:

Name: Give your custom search engine a name. It’s just for your knowledge.

What to search: You can either have it search and display results of the entire web or search only your site. In this case, you should configure it to search only your site.

To do that, first, select Only sites I select and then add your website URL to the new field that shows up. Don’t use https:// and www.

For example, I used for custom search engine on this blog.

Keywords: You can set keywords related to your site to have google feature ads and results based on the keywords.

But you don’t need to add anything here. You can leave it be.

Country or territory: Here you can select which country google search results you want to show on your site. For most bloggers, you can choose United States.

Next, Click on Search results link and it’ll toggle more options like this:

Toggle Search Result Options

Here, select on my website on search results and add the URL where you want the results to show.

Next, create a page on your site with that URL.

When you save all this, you’ll get two codes, one for the search box and one for the search result page.

You have to paste the search result code into this page. So your google search results will display on this page.

After setting all this up, Click save and get code. You’ll get the following page with the codes:

Google Adsense Custom Search Code

The Search box code is to display the google search on your site.

You can add Adsense search to WordPress sidebar by adding the code to a widget.

If you want to integrate the search to the header or menu, you will need to edit theme files or use a child theme.

Once you have added the search box on the site, next you need to set up the page where the results will display after the user searches for a query using the search box.

As discussed above, you have already created a page for this earlier.

Edit that page, and add the Search result code into this page by editing the page as text.

That’s how you can integrate Google Adsense search into your WordPress site.

But that’s not it, you can also make some more changes to integrate it seamlessly with your site.

Edit Google Adsense Custom Search Engine

To edit your custom search engine, Go to

You’ll see your custom search engine here. Click on it to edit it.

Next, click on Look and Feel from the sidebar.

Change Look & Feel of Custom Search Engine

In the layout tab, you can see different options to choose how your search result page should look.

By default, it should be two pages.

But you can change it depending on how you want to display it.

I am using the Overlay option. In this option, the results display on the same page in a pop-up window.

You can also change the color of results to match your website coloring by going into the Themes tab.

To change search box look, Go to Customize tab on Look & Feel options and you can change settings any way you like.

You will also see a live preview of the search box on the right side so you can figure out the best design that suits your site.

I have also changed some CSS code to make the custom google search box look good on the site.

You can also do some CSS changes to make it more appealing.


That’s it. By doing these steps, you can add a Google Adsense Search to your WordPress blog easily.

Play around with the options to customize the look of the search and results to make it look good on your site.

Share your thoughts in the comments below!

Web Hosting
  • Thanks very much