Skip to main content

Insert Adsense Block in the Middle of the post-Blogger

 How to place Adsense in the middle of Blogger posts.
The solution to this problem is quite simple: you only need to move the post body around the advertising code, just with a bunch of JavaScript and a couple of DIVs (divisions).
Works For both Old blogger and New Blogger.






1. In your Blogger template:


OLD BLOGGER

Find the tag <$BlogItemBody$> and replace it with following code:

<div id="prv<$BlogItemNumber$>"></div>

<div style="clear:both;margin:10px 0">
    <!-- Your AdSense code -->
</div>

<div id="fst<$BlogItemNumber$>">
    <$BlogItemBody$>
</div>

<script type="text/javascript">
var obj0=document.getElementById("prv<$BlogItemNumber$>");
var obj1=document.getElementById("fst<$BlogItemNumber$>");
var s=obj1.innerHTML;
var r=s.search(/\x3C!-- adsense --\x3E/igm);
if(r>0) {obj0.innerHTML=s.substr(0,r);obj1.innerHTML=s.substr(r+16);}
</script>


NEW BLOGGER

Find the tag <data:post.body/> (you must check Expand Widget Templates in Blogger console) and replace it with following code:

<div expr:id='"aim1" + data:post.id'></div>

<div style="clear:both; margin:10px 0">
    <!-- Your AdSense code here -->
</div>

<div expr:id='"aim2" + data:post.id'>
    <data:post.body/>
</div>

<script type="text/javascript">
var obj0=document.getElementById("aim1<data:post.id/>");
var obj1=document.getElementById("aim2<data:post.id/>");
var s=obj1.innerHTML;
var r=s.search(/\x3C!-- adsense --\x3E/igm);
if(r>0) {obj0.innerHTML=s.substr(0,r);obj1.innerHTML=s.substr(r+16);}
</script>

Note that you must replace <!-- Your AdSense code --> with block code provided by Google.


2. In every blog post:

Put a special comment
<!-- adsense -->
in the exact point you want to appear AdSense advertising.
Done!


Questions
  1. Does this method violate Google ToS?

    No. Answering a direct support request Google stated this method doesn't violate any of their program policies.
  2. What if I forget to put in a post the <!-- adsense --> comment?

    Nothing. The advertising block will appear in the traditional position you defined in your template before implementing this modification.
  3. What happens in Blogger home page and archive pages where there several posts with <!-- adsense --> comment appears together?

    Exactly the same thing happening before this modification: Google automatically inject in your posts up to 3 AdSense blocks. So just the first 3 posts (in a top-down order) in your home page or archive pages will have ads.

Comments

  1. it gives me a blank space above my every post

    ReplyDelete
  2. Anonymous that space is for ads....there is nothing wrong with that.

    Try and let me know if it was successful for you

    ReplyDelete
  3. Hi I have the same space problem.. ads never show up... ever?

    Please contact me at curiousread [at] gmail.com

    thanks

    ReplyDelete

Post a Comment


Spam/advertising comments will NEVER BE TOLERATED and will be deleted immediately!

I advise you to also "subscribe to the comment feed" and get email updates when I respond to your question.
Thanks for reading,
Admin

Popular posts from this blog

Best DoFollow Blog directories list for seo

List of Dofollow Blog directories,
Note: some items have profile information some do not, doesn’t matter, they’re all DoFollow Blog directories so submit your blogs to them all.
DOFOLLOW BLOG DIRECTORIES

Bloghop.com
Year Site Created: 2000
Indexed Pages in Google: 103,000
Backlinks in Yahoo: 542,700
PageRank: 6
Link Status: Dofollow
Quantcast Rank: 200,223
Editorial Policy: Yes
Spam in index: No
Submission rules: From the website:
We will reject: Spam blogs, hate blogs, stolen blogs, links to non-blog websites, links to illegal or illicit topics like child pornography. Blogs with under 5 posts are no longer accepted, but they might be waitlisted for later review if they look cool.
Commercial blogs are fine, but they must be “fun and useful.” Because of the huge amount of robot-generated blogs being submitted, blogs with the following will not be approved for listing: Acne, Mesothelioma, Real Estate, Lawsuits, Insurance, Gambling, SEO, Web Marketing, Medical Procedures and En…

Get ip-address widget for your blogger

Here is a unique collection of  IP address widgets which shows your visitors their Ip address,operating system,country,browser and the version of the browser.It is cool thing to display  ip address to your visitor's specially if you have TECH related blog.
Now you can get these any of these widgets and add these to your blogs by following these steps -

Get Ip Address Widget for your blog

1 .Choose any widget they are in different size and shapes,choose any according to your blog requirement.
2. Login to blogger dashboard ,and the click on Layout - > page Elements .
3. ADD a new HTML/Javascript gadget anywhere in your blog.
4. Copy any code from below(all are working) and paste in to HTML / Javascript gadget and then save your gadget.
5 Done,Your widget is Now live


1 .Square Ip Address Widget (Height=125px, Width=125px)<!--Ip Address Widget Starts--><span style="display: block; text-align: center;"><a href="http://myfundoo-blog.blogspot.com">…

27 Photography Blogger Templates for your Photo blog

This collection contain 27 different templates with unique banner unique design to each template, you’ll definitely find a Photography blogger template for you and your blog.The list includes Photoblog and Gallery style Blogger templates that you can use for showcasing your photos and design portfolio.Photo gallery blogger template

Don't forget to check out my previous collection of  33 music style blogger templates themes and xmls and
16 football/soccer blogger templates
1. Tequilas Flamejantes – DarkBlack color, Dark background. Gallery Blogger Templates 4 column, Right sidebar Fixed width, 1 sidebar.Photography Blogger Templates
This template for Gallery, Photo , blogs
DemoDownload 2.Tequilas Flamejantes – lightPhoto Gallery Blogger Templates This template for Photo gallery blogs Fixed width, Right sidebar. Yellow color, Light background. 4 column, 1 sidebar
DemoDownload 3. Photoplus Light Photography Blogger TemplatesFixed width, No sidebar. Light color, White backg…