Blogger – How To Add Adsense Inside Single Posts Only

January 16th, 2009 by Stephen Cronin (13,456 views)

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.

Subscribe To Site:
Share and Enjoy:
  • Twitter
  • Sphinn
  • DZone
  • Design Float
  • del.icio.us
  • StumbleUpon
  • LinkedIn
  • Tumblr
  • Posterous
  • Digg
  • Facebook
  • Reddit
Related posts

Tags: , , ,

78 Comments

  1. 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.

    1. Thanks a lot. I was searcing a way to ad adsense ads after my posts but didnt get the solution anywhere. Thanks

  2. 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. Hi Stephen,

    Great idea from you, i never think before about it, well done.

  4. 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

  5. Stephen, thank’s, can I translate it into russian?

  6. I had no clue on how do customize my blogging platform, I will study this post and figure it out. Thanks!

  7. 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.

  8. Like Max said, there are people who like this have no idea (I, for example.). So thanks for the info.

  9. I had no clue on how do customize my blogging platform, I will study this post and figure it out. Thanks!

  10. 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…

  11. Victoria BC Travel Guide Says:
     (Reply)

    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. 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.

  12. Blogger SEO Says:
     (Reply)

    Nice, i dont think this information can be explained more beautiful than this. Nice work Stephen.

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

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

  14. Blue Background Says:
     (Reply)

    Thanks for the code. It makes it easier to move adsense ads around while you test which ones make you the most revenue.

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

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

  16. 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

  17. 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!

  18. SMart tactics, good way to add more profit with adsense to your site

  19. I agree with you to insert adsense between posts. I have proved it to my high CTR.

  20. 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!

  21. 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

  22. 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

  23. i have tried this before but forgot to do the ad code conversion – thanks a lot :)

  24. 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.

  25. 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

  26. 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.

  27. 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!

  28. 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.

  29. Thanks a bunch for those tips Stephen. It sure opens up our options for using Blogger.
    Thanks!

  30. 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.

  31. Tina - Tattoo Removal Says:
     (Reply)

    These are cool tips. I haven’t tried it before because i thought it was not allowed on blogger. Thanks for the tips!

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

  32. 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

  33. 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?

  34. Hello Stephan,

    I applied your trick to show ads in a single post, but it’s not working for me.

  35. Serene disc repair Says:
     (Reply)

    Puja, just read the article again, maybe something you’re missing. i went to use his tricks and its working fine.

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

  36. 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.

  37. 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

  38. Thanks Stephen, i really had to know about this. I knew that there is a way to use it but i couldn’t found it now i am going to add my adsense.

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

  39. 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.

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

  41. Two <div and on </div

    1. 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.

  42. 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.

  43. 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…

  44. nice article and i interested about your information how Put Adsense Ads Within Posts

  45. 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.

  46. 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.

  47. 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.

  48. I have tried this several times.. and the result is quite good.. :)

  49. 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.

  50. Great post on adsense. I am thinking of implementing it and now I know how to do it on single pages!

  51. [...] Even though I haven’t yet made the decision of adding ads in my posts, I found my answer in How to add Adsense inside single posts only. It’s not a widget but it’s definitely worth [...]

  52. Thanks for this great article! It really worked!

  53. 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.

  54. 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.

  55. train horns Says:
     (Reply)

    Hi. This is a very helpful tip. specially for beginners in blooger who wants to boost up their adsense. Adding adsense in every post. Whew! love your post man.

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

  56. I agree with them that this is a great help to be able to customize especially for newbies. Keep it up!

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

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

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

  60. 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!!!

  61. This looks really simple after all that explanation. Thanks.

  62. Seems like a good idea to increase. Thanks!

  63. Thanks for the post, it really works on SEO too.

  64. 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.

  65. 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?

  66. 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?

  67. I did not realize blogger allowed that level of control. Good stuff!

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

  69. 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.

  70. Thank you so much for this one! It really helped me a lot position my adsense ad units in my blog! Thanks!

  71. 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!

  72. 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.

  73. 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. 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

  74. 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

Leave a comment

THIS BLOG IS NO LONGER DOFOLLOW

Rules: Leave your name! No inappropriate or offensive comments. No links to inappropriate or offensive sites. Comments must contribute to the discussion.


Get your ad shown hereGet your ad shown hereWPVote - Digg for WordPress Lovers Advertise

WordPress Plugins by Stephen Cronin

Want a Custom WordPress plugin? See my Services page.

Greasemonkey Scripts by Stephen Cronin

Visit my home page at Userscripts.org.