• X

    How to create Google custom search code using adsense search unit

    By in Google adsense

    Bluehost hosting

    Google adsense is one of the best contextual advertisement program for bloggers. It never lets your blog run out of advertisement. Google allow lots of ad unit to integrate in your   blog. You can see my previous post on Maximum number of adsense ad unit on a single page. Though later on Google adsense dumped the video unit.


    google adsense logo thumb How to create Google custom search code using adsense search unit

    Few days back we talked about how you can improve adsense revenue using adsense for rss feeds. Another good way to increase your adsense revenue by adding adsense for search unit.

    Using adsense for search unit help you to add search box in your blog and also help you to add extra revenue in your pocket. If you have a blog with 1000 of posts ,adsense   search box will be very handy for you.

    Here are the screenshot which will easily help you to understand how to create Google custom code adsense unit

    Login to your Google adsense account and Click on adsense set up

    adsense setup thumb How to create Google custom search code using adsense search unit

    Click on adsense for search option

    adsense for search thumb How to create Google custom search code using adsense search unit

    On the next page, Edit your setting, see screenshot for more detail

    search set up thumb How to create Google custom search code using adsense search unit

    Click on continue and in the next box select the search box style and length you want to use into your blog.

    google custom search option thumb How to create Google custom search code using adsense search unit

    Click on continue and in the next box,

    You can select various options like where do you want your search window to be open. You can also create a new page on your wordpress blog and use it to show search result.

    you can make changes like ad placement and ad colors. After making those changes. Click continue and copy your adsense search unit code and place at appropriate place in your blogspot or wordpress blog.

    A sample adsense search unit code will look like this.

    <form action="http://www.google.com/cse" id="cse-search-box" target="_blank">
        <input type="hidden" name="cx" value="partner-pub-xxxxxxxxxxxxxxxxxxxx" />
        <input type="hidden" name="ie" value="ISO-8859-1" />
        <input type="text" name="q" size="26" />
        <input type="submit" name="sa" value="Search" />
    <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&amp;lang=en"></script>

    I hope this tutorial will help you to easily create adsense for search unit.

    Don’t forget to read my previous tutorial on

    Subscribe to Download WordPress Guide Worth $99

    Article by

    Harsh has written 1123 articles.

    If you like This post, you can follow ShoutMeLoud on Twitter. Subscribe to Blogging tips via RSS or EMAIL to receive instant updates.

    { 18 comments… read them below or add one }


    Can i use custom search with the built in search box of blogger template ?


    Harsh Agrawal

    I guess yes! You can! :)


    George Serradinho

    I tried this adsense search before and had a page up on my blog, but eventually I took the page down. I could see no one used it besides myself.

    Thanks for the info, very detailed post.


    Harsh Agrawal

    Adsense for search box does great when you have lots of posts and lots of readers are following you from long. They will prefer to look back into your post using it.
    Well the adsense for search unit are not very effective but still a great way to solve two purpose.
    # Search box for users
    # Monetization


    George Serradinho

    About my previous commnet:
    I never put in my twitter name and it somehow populated it by itself. Is that right? Maybe it took my username from a previous comment I submitted.

    My twitter account is still suspended.



    I have not used custom search on my tech blog yet. Thinking to add it on this weekend.


    Harsh Agrawal

    Even I added it late and I believe it’s a good idea to add it because it will be useful in both the ways.
    User experience and monetization.


    George Serradinho

    Maybe I will try it again, but for now I’m working on other big projects to get some kind of income.


    Curious Little Person

    Have not started using adsense or any other ads for that matter!

    You write great stuff! Keep up the good work!



    Harsh Agrawal

    Thanks for your comment Sandeep :)
    Though I will suggest its a good idea to start with moderate advertising in the begining. If you are not monetizing your blog now, you are missing a part of income which belong to you.



    Harsh, I have setup the code, but didn’t paste it.

    Basically, what i want is when a user searches and hits enter, I want the same theme layout but without sidebar. Meaning full page wide google search results. How to achieve that?

    Any idea?


    Harsh Agrawal

    Yes Nihar
    That can be easily done
    You need to create a new page and name it as yourdomain.com/search
    In the last step where you are getting an option to select how you want page to open, you can use custom page and enter your Page URL

    That will help. If not I will write a new post for the same.



    I used the adsense search box on a few of my sites, but like one of the commenter’s above, hardly anybody used it so I took it down.
    Informative post though :)


    Nick Aster

    Does anyone know how to get this to work with wordpress? It seems impossible to do anything with wordpress without either knowing PHP or waiting around for someone to build you a plugin. Any links appreciated!



    i WANT TO USE CUSTOM SEARCH RESULS open on my own page.How to do?



    not working as google adsense gives two pieces of codes one of search widget and other for search result page which will appear showing search results,how to use these two codes????



    Hey just one query.Where i should paste code which is for search page. I have made a page and added to it but nothing works. Could you please add these points in this post as update.



    was an unsuccessful attempt, page where i have placed code is getting published as blog post ,how to avoid that ???


    Leave a Comment

    Previous post:

    Next post: