Blogger – How To Add Adsense Inside Single Posts Only

I was recently optimizing Adsense on one of my Blogger sites and decided I wanted to place Adsense inside the posts – but only on single posts, not on the home page or in the archives. Here’s how.

Why Blogger?

Although my primary blog platform is WordPress, I do occasionally use Blogger for some side projects. Why? Go and read everything that Grizzley’s written on his Make Money Online For Beginners site. Blogger can be an excellent option. It’s free, easy to create a site, can scale to handle massive traffic etc.

The only downside to Blogger is the limited ability to customize the site. With WordPress I can change pretty much anything I want. With Blogger I can only change things within the narrow framework that Blogger allows. In this case, I ran into the limitations with the built-in options to display Adsense ads.

Blogger’s Built In Options To Display Adsense

The easiest way to add Adsense to a Blogger blog is via the built-in gadget. I won’t go through the whole process, as it’s written about elsewhere, but you can add an Adsense gadget in the same way you can add a Profile gadget, Text gadget, Poll gadget, etc. Just go to Layout, then Page Settings, then click on Add a Gadget, select the Adsense gadget and then configure it.

The first time you use it, Blogger will ask you for your Adsense publisher number and link the blog to your Adsense account. Then you simply decide where you want the gadget to appear, what size and colour the ads should be and you’re off! You’re ready to start making money online.

You can also add Adsense between posts. To do this, click Edit on the Body gadget and turn on the Show Adsense Between Posts option. You’ll then be presented with the same options that the gadget gives you (size, colour etc).

Limitations With Built-In Options

There are several limitations to using Blogger’s built-in Adsense gadget:

1. Can’t Put Adsense Ads Within Posts

The main limitation with using the built-in Adsense gadget is that you can’t place ads within a post. You can add them before posts, after posts, between posts, in the sidebar, but not in the actual post.

It’s well known that the CTR (click through rate) is higher for ads within a post than for ads in other positions. So putting Adsense within a post will make more money for you. I cover how to do this below.

2. Can’t Use Channels

Another limitation of the built-in Adsense gadget is that you can’t use channels to track the performance of ad units.

However, this isn’t really a limitation – if you want to use channels, simply create your code on the Adsense site, then copy and paste your Adsense code into a JavaScript gadget, instead of using an Adsense gadget. In all other ways it will work the same as the Adsense gadget.

3. Blogger Only Shows Three Ad Units

The last limitation is only an issue for those people who place an Adsense unit in the sidebar. Some people choose not to do this, but I find that an Adsense unit in the sidebar performs relatively well (not as good as units at the top of the page, but better than those lower down the page).

The problem is that Google makes sure that only three ad units are displayed on a Blogger page, as per their Terms Of Service. Great in general, but it means you have less control over which ad units appear. Unfortunately the sidebar is rendered last in most templates, so it’s one of the units that disappear if there are too many units on the page.

This won’t happen on the single post page. However, if you display ads between posts (or within posts) then the sidebar ad unit will disappear on pages with multiple posts, such as the home page and archive pages. I explain how to overcome this below.

Adsense Within Posts

As I mentioned above, you can’t place Adsense ads within the post body using the built-in gadgets. To do this, we’re going to have to put our Adsense code directly into the template.

We still can’t put the ad unit in the middle of the post, but we can put it at the top of the post, below the title, with the text wrapping around it. Great! That’s proven to be the most effective placement, so that’s exactly what we want.

Now, the technique used to do this isn’t new. In fact I learned how to do it by reading Bonnie Calhoun’s Wrapping Adsense in Blog Post. You can go and read her post for the full instructions, but here are the basic steps:

  1. Get your Adsense code from the Adsense website
  2. Parse the code to replace special characters with HTML entities
  3. In Blogger, go to Layout, then choose Edit HTML
  4. Make a backup of your template by clicking Download Full Template
  5. Click Expand Widget Templates
  6. Search for <data:post.body/> or <p><data:post.body/></p>
  7. Place your Adsense code on the line immediately above this
  8. Save the template

Note 1: It’s very important to parse the code as per Bonnie’s site (ie replace < with &lt; and > with &gt; etc). If you do not do this, your Adsense units will not display correctly and you risk being banned by Google.

Note 2: You probably want to place your Adsense code within a floating div, so that the text wraps around it.

Here’s what the code will look like (with the publisher specific information removed). The first and last lines should already exist in the template, the rest is what you’re adding.

<div class='post-body entry-content'>
<div style='float: left;'>
&lt;script type=&quot;text/javascript&quot;&gt;&lt;!--
google_ad_client = &quot;pub-xxxxxxxxxxxxxxxx&quot;;
google_ad_host = &quot;pub-xxxxxxxxxxxxxxxx&quot;;
google_ad_slot = &quot;xxxxxx&quot;;
google_ad_width = 336;
google_ad_height = 280;
//--&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;
src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;&gt;
&lt;/script&gt;
</div>
<p><data:post.body/></p>

This solves the problem of getting Adsense to appear within the post, driving up CTR. However, the sidebar unit will still disappear on the home page, as there will be more than 3 units on the page (one embedded in each post).

Only Showing Adsense In Posts On A Single Post

To solve the problem of the sidebar unit disappearing, I decided that I only wanted to show Adsense within the post (ie solution in the previous section) on single posts. I didn’t want this ad unit to appear on the home page or on archive pages.

It would be easy enough to do this in WordPress / PHP, but I had no idea how to customize a Blogger template. I consulted Blogger’s Help facility and found a list of Layouts Data Tags, which let me see what could be done. Despite the options being fairly limited, I found the answer I needed: The pageType tag, which can have a value of ‘item’, ‘archive’ or ‘index’.

My XML coding skills are a little rusty, but thankfully it wasn’t hard to work out how to include some HTML based on the type of page:

<b:if cond='data:blog.pageType == "item"'>
PUT YOUR CODE HERE
</b:if>

This says: If it’s a single post, include the HTML (obviously you have to put it in). So single posts (pageType of item) will display the HTML, but the home page (pageType of index) and archive pages (pageType of archive) will not.

Applying this to our Adsense problem, here is the full code you need (with the publisher specific information removed). Use this instead of the code in the Adsense Within Posts section above. The first and last lines should already exist in the template, the rest is what you’re adding.

<div class='post-body entry-content'>
<b:if cond='data:blog.pageType == "item"'>
<div style='float: left;'>
&lt;script type=&quot;text/javascript&quot;&gt;&lt;!--
google_ad_client = &quot;pub-xxxxxxxxxxxxxxxx&quot;;
google_ad_host = &quot;pub-xxxxxxxxxxxxxxxx&quot;;
google_ad_slot = &quot;xxxxxxxxxx&quot;;
google_ad_width = 336;
google_ad_height = 280;
//--&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;
src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;&gt;
&lt;/script&gt;
</div>
</b:if>
<p><data:post.body/></p>

Of course, this means that only two Adsense units will be shown on the home page. If you’re doing things properly, most of your visitors should arrive on single posts, via the search engines, so this solution’s good enough for me.

Final Thoughts

If you want to make money online and you’ve decided that using Adsense on Blogger is the way to do it, then optimize it!

Hopefully this has helped you a) increase your CTR by showing you how to place Adsense units at the top of your posts and b) how to preserve income from the sidebar unit by stopping it from disappearing on multiple post pages.

105 responses on “Blogger – How To Add Adsense Inside Single Posts Only

  1. Andy@mlm email leads

    Great post Stephen,
    I just found you site and really liked the initial page I read. I have subscribed to your RSS feed for post updates.
    Thanks for the great info.

  2. Stan @ Free PS3

    I have to say I was looking for a similar thing but for WordPress blogs? I know how to add it to every blog post but I want it so I can add them to individual posts.

    I get too worried about the ‘maximum number of ad spaces per page’ Google rule.

    Thanks for the information though as I can implement it on a few blogger blogs I have.

    Cheers

  3. Alfred

    Thanks for the ping back to my site, came here to check the post but I think i actually learnt some new things like wrappings the adds.
    Will subscribe to this blog. Thanks again

  4. Max@Stemulite

    I do something similar on WordPress, but this is great for anyone who doesn’t know how to crack open the WordPress ‘engine’ and make changes. Nicely done.

  5. Dave@Lift Chairs

    I have also found that adsense in the sidebar preforms pretty well.

    I need to go back and spend some more time on it, but about a month ago I spent a few days optimizing all my sites. I created a simple function that placed the ads on pages based upon their title and category. This makes tracking which ads are preforming much easier. It also makes adding ads easier, because I can simply call the function, rather than having to insert the google code…

  6. Victoria BC Travel Guide

    Blogger is a great place for beginners but gets limiting really quick when you want to customize. My dad is on blogger and he is happy to be able to have a simple interface in which he may expound to the world. Heaven forbid he would want to do anything else then I would have to introduce him to wordpress. Baby steps.

    LINK REMOVED: because of failure to use KeywordLuv syntax (name@keywords)

    1. jack@Gry dla Dzieci

      I agree. It’s better to start everything on wordpress than try to avoid limitations of blogger later on or, what’s worse, to move the whole blog to another platform.

  7. Katherine@Funny Mom Blog

    Great post. I have taught myself everything I know, and am missing so much… posts like this are greatly appreciated!

  8. Oly@coatingvloeren gietvloer den haag

    Thanks for the code, im thinking about doing the same thing, im not rly good with this sort of things tho :(

  9. Rajeev@top b schools in india

    hai Stephen
    today i read your many posts which are full of information and new interesting things. Inserting the Adsense in between the post is a really very good idea. I wanted to do the same but i didn’n know how? but now have find the answer and i am going to implement on my blog.
    thanks

  10. Chelle@Alcoholism Help

    I had considered using blogger for my sites a few times, but just hated all the limitations…not to mention Google keeps a small chunk of your adsense revenue. (Which I guess for some doesn’t matter? But I’d rather pay $7 for the domain and keep that 20%!) So for me, it is wordpress and only wordpress.

    But you’ve got a great point that anyone using adsense should know: ads in the post itself really do make the most money! If someone only would have told me that a year ago!

  11. Jenn@Kennesaw real estate

    I never thought about adding adsense in between posts. I usually just have it on the right or left column. Seems like a good idea to increase CTR. Thanks!

  12. Avinashtech

    i am trying to put the ads just below tiles of posts on home page and i am partially successful too but my problem is , after showing three adsense ads in 3 posts, the other posts on home page show Blank space( same size as that of adsense).. any help?.Mine is a customised template

  13. Wendy@online sweepstakes

    Thanks so much for the instructions. I wasn’t sure how to find what I was looking for in Google to come up with this solution for only showing Google Ads in single posts but I’m glad I stumbled across your site. I know how to “hack” the HTML and make ads ONLY appear on the homepage but the other way around was a different story. Now to test and make sure it is working properly.

    Thanks so much (Grizzly would be proud) Wendy

  14. Marc Norris@Business Management

    I personally have had little success making the “big bucks” from Blogger, but to be honest, I haven’t really put in the effort – so it is my fault.

    But I think that I will try what you have advised above and see what I can do – I have a couple of niches that I was going to make a website for anyway, and by using Blogger, my investment will be nothing but time.

    Thanks for the ideas you wrote here, I’ll try them out, and hopefully report back with my results.

  15. sagar

    hey friend my site is way2hight.blogspot.com i want to put the ads after one blog but i can’t find
    ## waht should i do please tell me
    And thnks for other information

  16. bill@IT Governance

    Funny how this is still so complicated with Google’s own product. You would think Adsense would be able to be better integrated into Blogger by now.

  17. bleuken@Hectic Capiznon Bloggers 2009

    I thought this is impossible until I’ve read this post. Blogger don’t allow it to customize the placements of the ads. I will try your suggestion to my current blog on Blogger. Thank Step!

  18. Lori

    Some really great tips. I agree with the earlier comment that it seems a little strange that Adsense, a google product, wouldn’t be more agreeable with Google’s own Blogger setup.

  19. John@Handy Bundle mit Fernseher

    I am using WordPress and haven’t tried Blogger yet. I didn’t know Blogger has a built in option to display adsense. Well, I guess I must try Blogger soon. Thanks for enlightening us about Blogger with this post.

  20. Deb@Itchy Skin Rash

    Thank you for explaining this. I know how to do single posts with adsense for wordpress but didn’t know how to acheive this using blogger. I appreciate the detail as many sites do not go into step by step and us non-techies can get lost.

    Deb

  21. Lix@Hectic Capiznon Bloggers 2009

    This is great tips Step. But can you help me? I want to show my adsense in a non plain background so do you have an idea on how to show adsense w/ transparent background?

  22. Adam@Tattoo Removal

    Blogger is OK to start with, but I think more advanced online marketers will almost always want the extra features that self-hosted WordPress offers. I find myself using special plugins all the time to enhance a website.

  23. Katrina Kaif

    Yeh !!! Last night I just wanted to do the same thing and searching finally i got a small peace of code and i was on way.

    The thing i made it with Google pages to wrap my adsense code like Image in right side of content you can see it here distance.openuniversity.googlepages.com

    I think this is a code you can use to put your adsense code right or left side of your content with any content. no matter blogger or wordpress

  24. Shawn @ Adsense Alternative

    Nice post. I’ll admit I have never considered blogger for this kinda thing. While it’s somewhat limiting, it does have it’s uses.

  25. Chamsoo

    Thank you Stephen,
    But There’s an error.
    Two ==> two .
    In your first code there’s two and one .
    Add an other .
    Thanks.

    1. Stephen Cronin Post author

      Hi Chamsoo,

      No error. As I said above: The first and last lines should already exist in the template, the rest is what you’re adding.

      So the first <div> already exists, you’re not adding it. There is a </div> for it somewhere further down the template. You only add one <div> and one corresponding </div>.

      Hope that makes sense.

  26. Bert@Hectic Capiznon Bloggers 2009

    I tried this on my blogger blog but I am having trouble implementing it. I should get through your instruction again, I might have missed something. BTW, I saved this document on my PC for future ref. Thanks.

  27. Reena@Katrina kaif wallpaper

    this code is working with selected or randomly any customized template but not all. i have been trying to add it in my present blog but :( the format of add was being changed.

    finally left it and decided to not put adsense in for a while…

    gonna try today…

  28. Analekto

    Well written article, well done.
    Should anyone be interested I have documented a method here on how to add two AdSense units anywhere within the new blogger post body.

  29. Pete@ HDTV Tech Guide

    Stephen, thanks for this tutorial I am considering using Adsense at least when I have more posts in my two little blogs. But for now I am busy trying to write stuff for them. I will be sure to drop by again because I do not know a thing about code.

  30. Kai Lo@Blog About Nothing

    I like having Adsense inside my posts. Blogger doesn’t have an easy option for you to do that. Thanks for giving the instruction on how to do this.

  31. Tom@Best Portable GPS

    Stephen, love your site. I think that it is important to put adsense on single pages and not just the whole blog. That is one reason blogger is a limitation.

  32. Pipo

    Hi. I’m having trouble here. I tried showing adsense within posts and it worked. When I tried showing adsense in single posts, it failed. Any idea how to fix that?

    Thank you so much in advance.

  33. Pipo

    I was able to make it work now! Finally. Just one question though. How do i put margin between the ad and the post content? The post content is touching the border of the ads.

  34. Kai Lo@seo my blog

    This is great way to get more clicks with the adsense inside posts. It is better than putting them on sidebar.

  35. Sarah@http://www.freemoviefairy.com

    I actually havn’t tried blogger yet, can it outbeat wordpress?
    by the way slick design mate!

  36. Elton@Best GPS

    WordPress is far more better than blogger because it is more flexible and also opportunities for earning in wordpress is more than blogger.

  37. Andy@Engagement Rings

    Hi.. I have a blog and i would like to publish adsense’s advertisements on just one of my entries.

    I currently have a working adsense account, but ‘simply pasting’ the adsense code into that particular blog-entry doesn’t work.. ie,nothing appears.

    I only wish for the adverts to appear on just this one post (and not for the other entries), how can i go about doing this? Thanks!!!

  38. Robert@Free Internet Marketing Ebooks

    Hi,
    I ‘ve added my adsense code above this code like in your example, but after 1 hour nothing happened. Usually adsense add appear after 10 minutes, and in this time this area is blank. Probably I do something wrong but I don’t know what.

  39. John@?????

    what kind of traffic do you need to actually make money of adsense, I mean if I have 100 uniques a day, will I even get money for a post that let’s say gets 50 pageviews a day?

  40. John@?????

    what kind of traffic do you need to actually make money of adsense, I mean if I have 100 uniques a day, will I even get money for a post that let’s say gets 50 pageviews a day?

  41. Jay@ Love Poems & Love Quotes

    I profit from adsense very well. Blogger is very user friendly with adsense too. I just love the integration it is superb.

  42. Jossep Victor

    I just know that we can’t place any Google Adsense inside the post content.
    Now i’m going to make them between the post. ;)

    Great tips.

  43. Boffill

    Sorry for this follow up comment. Anyway, I just wanna inform you that I’ve seen a blog that has adsense unit in within the middle of the post. I think its from bloggerbuster.com I’m not really sure which blog is it but yes, I’ve seen one. Anyway, you are a very big help to me and my blog!

  44. DFB

    Hi,

    Thanks for the information. Actually, I implemented the single most thing on my blog, even before reading this post.

    I stumbled upon this page looking for something which is a bit different from what you mentioned and can complement your approach very well. Here’s what I am looking for:

    For the item page, I want exactly what you mentioned in this post. However, for the main page, I want the adsense unit ONLY and ONLY on the very first/topmost/latest post. I don’t want it on the second, third or subsequent posts. Only on the first/topmost/latest post. Is there a way to achieve this on blogger?

    I have been searching for this info for past many days but haven’t had any joy so far.

    Looking forward to some insight from you.

    Thanks.

  45. Ajit Kumar

    Hi Stephan,
    I followed every step, but there was an issue. My Ad is displayed on the first three posts, but not thereafter. Thanks a bunch for sharing though. Appreciated. Do take care and have a great day!

    Regards,
    Ajit

    1. Techno Primer

      Hi Ajit,

      Your problem does not concern the codes given by stephen, I can assure you that the code works. It has to do with googles TOS, google only allows 3 ads to show on a sinlge page. If you happen to show more than 3 post in a page, google ads will only appear on three of your posts and will not show on the rest.

      Hope that helps cheers

  46. Techno Primer

    Hi Stephen,

    Thanks for sharing the code


    PUT YOUR CODE HERE

    It did not only help me solve my adsense problem but it also solved my “related post” widget problem. Through trial and error I found out that i can actually use this code not only to show adsense but other widgets and codes too.

    Kudos to your mate and keep it up

    Cheers

  47. OPTIMUM HEALTH

    There is far better way to do it-without modifying adsense code and even without visiting adsense.
    Example is my new blog(click up there to see)

    Same process until copying and pasting your adsense code-instead you just put this line:

    -you can choose right or left to be blended

    Why do i write this?Simply cause method above was pain in the ass to do it and it wasn’t showing ads at all!

    There are few more steps prior doing it but i think everyone here knows what to do-beside that this is your tutorial…..

  48. OPTIMUM HEALTH

    Damn! it’s not showing the code-here it is again(?)

    -this is how blogger shows your ads anywhere!

    Sorry for double post!

    1. Stephen Cronin Post author

      Hi OH,

      WordPress has stripped your code out. I’m interested in your solution, so I hope you see this and try again. Next time, try putting <code> before your code and </code> after it.

  49. Vinod Kumar Jadge

    Hi Stephen,

    Thanks for the solution mate, I implemented this simple technique on all of my blogger
    blogs and works like a charm.

    I didn’t get how OH (in the last post ) implemented this but with your solution I just put the adsense code in the notepad ++ and find and replace does everything, Wrap the code and done. :-)

    Thanks again

  50. Allan

    hello,

    thanks for this tutorial..the instructions is really complete and easy to follow for non-tech savvy like me. but i want to put my ads and widgets about the title post…how can i do it?

    Thanks in Advance.

  51. Sherified

    Thank you so much! This article is a big help.
    I’ve been looking for tutorial on how to add adsense code in blogger template.
    This is my first time using blogger, since my self-hosted domains before has now expired. Now, I’m using a free blogsite to earn money again.

  52. Jerry

    I really enjoyed this topic very helpful, though i had idea about programming, i am not well educated in the coding of Blogger Blog so i tried many thing in the XML code but the needs weren’t fulfilled, when i tried to put the adsense code between single content(My intention) the ads also appeared even in home pages other contents.

    with your tutorial i got good example of Editing Blogger code not only with Adsense integration also other parts of blog

    Thank u very much

  53. Daniel White

    Thanks for this, I was getting rather frustrated of trying to figure this out for myself and just couldn’t get it to work.

    The blog.pagetype part did the trick and now my AdSense ad is now showing correctly right under my single post page title. :)

  54. gie

    Sorry, if in case that you delete my previous comment which is my important question here it is..(I never notice the rules here, my apologize)

    Hello! If I would put the adsense code for a single post, it would automatically delete the other adsense on my home page?

    1. Stephen Cronin Post author

      Hi Gie,
      Actually it was just in moderation…
      Adding the code for a single post won’t change it on your home page. You may have to be careful that you don’t go over the three ad units allowed (although I think Google just won’t serve the extra ones up if you go over).

      1. gie@freelancers tips

        Hi Stephen! Thanks for the fast reply!! I am not sure if my blog exceeds the three allowable ads..can you take a look please?? I already deleted the one the I formerly added..but I would like to be sure..please check it..

        1. Stephen Cronin Post author

          Hi Gie,

          Just had a quick look and it seems that more than three are showing on the home page – one for each post. Maybe you’re missing the lines before and after you’re Adsense code:


          PUT YOUR CODE HERE

          If those lines are there, it shouldn’t show the in-post ads on the home page, only on the post itself – and that will stop it showing too many.

          Of course it’s been a while since I wote this and Blogger has changes a bit, so it may be that those lines no longer work (but I’d be surprised).

          1. gie@freelancers tips

            sorry for the dumb question..I don’t really get it…

            What code you want me to put here??

          2. Stephen Cronin Post author

            Hi Gie,

            Whoops sorry, the code didn’t show properly. I meant to say:

            <b:if cond=’data:blog.pageType == “item”‘>
            Your Adsense code
            </b:if>

            You have already put your Adsense code into the theme. It just needs the first line and 3rd lines to be put around it.

            Hope that makes more sense.

          3. gie@freelancers tips

            Hi Stephen!

            I got an error…it says:

            Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
            XML error message: Open quote is expected for attribute “{1}” associated with an element type “cond”.

  55. St Pete Guy

    This is the second website I have found basically the same information and I would like to try this idea but now that you have said I could get banned by Google if I do it wrong I am a little hesitant. I am not great at editing html so this worries me some. I certainly want to add adsense to my posts but at the risk of doing it wrong and getting banned I am having second thoughts. Is it as difficult as it sounds?

  56. Bob

    Wow. It worked for me but I did not parse the code but it worked still. The parsing is for the old blogger or for the new blogger platform?

    Thank you.

  57. Kiash

    Nice tutorial! Is there any way to put ad on the above of Jump Break? If any one please post a tutorial for us. Thank you!

  58. abbas

    Thanks for sharing such kind of information ….. nice post …… i will quote some of this information in my blog My Blog thanks Mr. for this artical ….. Abbas Abu Gazleh

  59. Emmanuel

    Nice post, but my chalenge is quite the opposite. I want to display a 300*250 ad unit on all my blog pages ‘EXCEPT’ my blog post pages. Is there any way the code above can be reversed???
    Note: I placed the adcode directly in my blog’s template just before the start of the tag

  60. Kam

    This is really nice. Well explained and easy tu understand. Thanks for the post. Bookmarking for future reference. talkrelationship.blogspot.com

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Anti-Spam Quiz: