Automatically Display Any Affiliate and Adsense Ads in the Middle of Blog Post?

How to add any affiliate ads including AdSense ads in the middle of Blogger Blog post automatically? This widget will measure the post page height automatically and start display ads In the Middle Of Blog Post. You can display any ads or widget in the middle of Blog posts.

In WordPress platform we often see advertisement can be display in different places. Generally it can be done by the help of Plugins. 

And Plugins helps to circulate the ad place and display in different place. This is one of the most effective way to increase Ads revenue. And this strategy works best to increase ad revenue.

In Blogger platform hasn't any opportunity to use plugins mobilize ad placement trick. But we can use JavaScript to display ads at the middle of the Blog post that can increase our ad revenue. Most of the returning Blog readers become ad blind, because they know where ads has placed in your site and they avoid that place.

But by using this widget you can display ads in the middle of the Blog posts and readers will click on ads naturally.

Automatically Display Any Affiliate Ads in the Middle of Blog Post?

Previously I have shared a widget where we can display AdSense ads anywhere inside of a Blogpost. But that widget you have to use manually, because while you make post you have to place manual code <!-- adsense --> like this, where you want to display ads. Many users may not like this widget because of manual works.

So to get ride from that you can use this automatic affiliate ad display widget. Even now you can display any widget in the middle of Blog Post. This widget has several features, those are as follows:
  • Display ads at the middle of the Blog Post.
  • You don't have to manually put code.
  • This will automatically search the place to display ads.
  • You can display multiple ad units.
  • Any widget like related post widget can be display at the middle of the Blog posts.
  • You can easily  remove the widget.
Sounds great! I hope you are pretty excited to integrate this widget in your Blogger site. So let's proceed to the tutorial. Please take a backup of your Blogger template before proceed. After that go through the below steps-by-steps walk through.

Step #1: Log in to your Blogger Account and go to Dashboard

Step #2: From vertical options click on Theme ->Edit HTML->

Step #3: Instantly locate <data:post.body/>  by Pressing  Ctrl+F (Windows) or CMD+F (Mac) 

You will find this code  <data:post.body/>  3/4 times, Please go for second one.

Step #4: Once you find it then replace <data:post.body/> code by below script.

<div expr:id='&quot;adbox&quot;+'/>
<div style='clear:both;text-align:center;margin:15px 0 15px 0'>
<!-- Place Your Ad Code here -->
<div expr:id='&quot;adsbox&quot;+'><p><data:post.body/></p></div>
<script type='text/javascript'>
var obj0=document.getElementById(&quot;adbox<>&quot;);var obj1=document.getElementById(&quot;adsbox<>&quot;);var s=obj1.innerHTML;var t=s.substr(0,s.length/2);var r=t.lastIndexOf(&quot;&lt;br&gt;&quot;);if(r&gt;0){obj0.innerHTML=s.substr(0,r);obj1.innerHTML=s.substr(r+16);}
Step #5: Please replace line with your affiliate ads, AdSense or widget code. And click "Save template” from the HTML editor.

Note that for placing AdSense ads you must parse the script first. Simple use are Parser to use AdSense code in the widget.

You can check your Blog post now and see ads has started display in the middle of the Blog Post automatically.

A Simple Solution

If your Blog already have many posts then you may see some problem. Some broken script will appear at the bottom of the ad banner. To fix this issue simply make a gap between ad banner and texts in Blog post editor. After that see the preview, if you see broken script is not appearing then simply publish or Update the post.

If you have any query regarding this widget then simply feel free to write a comment below. I will try to get connect with you soon. Thank you.
ansary says: 5/17/2017

i want to show 3 ads inside my post,How to do it?

BloggerSpice says: ADMIN 5/18/2017

Hi Ansary Pangader,
I didn't test the 3 ads but you can replace the below text from above code by 3 AdSense ad script. I think it will work.

<!-- Place Your Ad Code here -->

Please let me know. :t

Joseph O. says: 5/31/2017

thank you for this... works perfectly

BloggerSpice says: ADMIN 5/31/2017

Hi Joseph O :)
Thanks for your feedback.:up

Phonetweakers says: 7/07/2017

Thanks man, it works! thumbs up to you

BloggerSpice says: ADMIN 7/09/2017

Welcome phonetweakers.. :up

Anonymous 8/18/2017

Sorry if I sound like a beginner...
I don't understand replace line with your affiliate ads

BloggerSpice says: ADMIN 8/20/2017

Hi There
In the above code block you will see a line like below

<!-- Place Your Ad Code here -->

just you have to replace this line by your affiliate ad script. Every affiliate ad network will provide their script to display their own advertisement. So you have to generate ad script and replace this <!-- Place Your Ad Code here --> line by your affiliate script.

Thank you :up

iPostcity says: 8/31/2017

please i cant find this code in my template

BloggerSpice says: ADMIN 8/31/2017

Hi there,
You have to find below code. And you will find it 2/3 times in your blogger theme.


Thank you ^_^

iPostciTy says: 9/02/2017

am done with it now
but i wanted to display 2 ads unit inside my post
is it possible?
my web urel is htt://

BloggerSpice says: ADMIN 9/05/2017

Hi iPostcity,
Just add 2 ad script. and it will start display 2 ad banner. :)

RAM says: 9/05/2017


use this above and below

it will cover the total post from start to end

BloggerSpice says: ADMIN 9/09/2017

In this case you can use non-responsive ad banner.

728px X 90px

Mehbub says: 9/13/2017

How To Place Adsense Ads In Middle Of The Post In Blogger

BloggerSpice says: ADMIN 9/16/2017

Please read the article you will understand. Thank you :)

Unknown says: 9/22/2017

I used your guide, and I was able to place ad code automatically in the middle of blog post. I must confess itS quite perfect BUT the broken script spoilt everything. I've about 260+ articles published on my blog, and I can't go back to start adding space between ad banner and text. Even when I tried to add gap between an ad banner, the broken script still appears. I'd be extremely glad if you can fix the broken script automatically and update the codes again... I'll be anticipating for your response.

(Also I love your middle ad banner) I really want something​ like this.

BloggerSpice says: ADMIN 11/13/2017

Hi Henry Emmanuel
This widget conflict only with table script. If your Blog post containing table then your table will break. But if your site is full with written text then it will work fine.

Alternatively you can use manual system to place the add in the middle of anywhere of the Blog post. Still I am following this method.

Thank you :)

I have a blog website made in and not with wordpress or blogger. I just get adsense approval by google and place ads on bottom of the page but i am not able to place the ad in the top portion or right sidebar or in middle of post or below the post title. Can you help me out. My website url is
Thank you...

BloggerSpice says: ADMIN 11/17/2017

Hi Neetu :t
Sorry I don't have any experience on you can make query on their forum

I can give solution on Blogger and WordPress only. Thanks for dropping you comment. :)

Imocheezy says: 2/06/2018

Thanks for this, it worked for me on my blog

SBmade says: 2/09/2018

It's really great.I followed your advice.It really worked.keep posting.
Thank you.
visit -

BloggerSpice says: ADMIN 2/18/2018

I am very glade to hear that. :)

TL says: 6/13/2018

Thanks a lot! I tried many methods available on Internet but this one worked like a fire.

BloggerSpice says: ADMIN 7/01/2018

Welcome Bro :)

Contact Form


Email *

Message *