How I Make Adsense Appear In Middle Of Blogger Posts (New and Old) Without Using Post Template Feature


In my previous post, I explained how to easily place Adsense ads in middle of Blogger posts using the Blogger "Post Template" feature. Although the trick is very easy to implement and automatically displays ad in desktop and mobile view, the trick doesn't display the ads in old posts.


If you want the ad to display in the middle of all posts (old and new), you will have to hack your blog's html and add some codes to it. I stumbled on the trick here, implemented it and works fine on my blog. I even use the trick to make Adsense ads appear in the middle of posts on Blogger mobile view.

This script in the trick actually looks for number of <br/>  (line break) tags inside your post and display ad unit.

adsense in middle


How To Get Started

==> BACK UP your blog template. Very Important!
==> Generate your Adsense ad code from www.google.com/adsense
==> Parse the Adsense ad code at www.freehtmlparser.blogspot.com (paste and click "Encode")
==> Login to your Blogger dashboard and back up your template ( Very Important! )
==> Go to "Template" > "Edit HTML"

==> Use CTRL F to search your HTML for the JQuery script below:

<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js' type='text/javascript'/>

If it exists, move on to the next step. If not, copy the script above and paste directly above </body> in your blog's html

==> Use CTRL F to find </body> again and directly above it, paste the code highlighted below:


<b:if cond='data:blog.pageType == &quot;item&quot;'>
<script>
 $AdCode = $("#AdCode").html();
 $("#PostBody br:lt(1)").replaceWith($AdCode);
 $("#AdCode").remove();
</script>
</b:if>

==> Save the Template

==> Go back to "Template" > Edit HTML. Use CTRL F to find <data:post.body/> . Replace it with the code below:

<div id="PostBody">
 <data:post.body/>
</div>


<div id="AdCode">
<div style='margin:5px 0;text-align:center;clear:both;'>
 <!-- Paste PARSED Ad Unit Code Here -->
</div>
</div>

==> Save the template

NB: Your template might have 2 or more <data:post.body/> codes. You have to identify correct one by using "try and error" trick. The 2nd or 3rd instance works in most templates though.

==> Go to "New Post" > "Options". Ensure you select "Press Enter for line breaks".



That's all.

To make it appear on mobile view, find <b:includable id='mobile-post' var='post'> in your HTML and replace the <data:post.body/> under the line as explained above.

I hope it works for you.

If it doesn't work for you, you can simply revert the changes by uploading the back up you created before implementing the trick.





Comments

  1. Wow! This is indeed an advanced trick. WIll try it and if it doesn't work, will stick to the simple post template trick. Thanks for sharing..

    ReplyDelete
  2. Anonymous9/09/2014

    This will definitely make alot of sense in Blogger mobile view. WIll try it too once on PC. Thx boss

    ReplyDelete
  3. Oh great new trick gonna try this on my blog www.healthtutortips.com

    ReplyDelete
  4. This trick is certainly brilliant, Jide. Though I don't use Adsense on my blogs, I can predict that the new ad position will certainly guarantee more visibility and hence a higher click through rate.

    Sincerely, I hope this makes more money for all who are both on Blogger and are running Adsense.

    Make the day great!

    Always,
    Terungwa

    ReplyDelete
  5. Pls i need your response sir. Is 35thousand pageviews ok for applying for adsense? If it is not, then how many pageviews must i have before applying for adsense?

    ReplyDelete
    Replies
    1. I don't think that page views really matter. I had less than 3k page views when I applied and was approved.

      Have quality contents and adhere to Google's AdSense programme policy, and you're good to go.

      Delete
  6. I have tried several times to implement the Google adsense in my blog post but it does not show. Can you help me sir?

    ReplyDelete
    Replies
    1. always add the code when on HTML view and not on 'Compose" or else it wont show

      Delete
  7. pretty cool, I'll try it on my blog, think I'll earn better this way

    ReplyDelete
  8. Thank you but Not working for old posts. What I have to do?

    ReplyDelete
  9. mr jide, the one of making it to show on mobile is confusing to me, en lighting me the more. thanks

    ReplyDelete
  10. Hello Jide!

    I've tried, but really cant get this to work on my blog.

    Am actually trying to embed a Google Adsense link Ads at the middle or end of my post but it just wouldn't come up.

    Any recommendations?

    Thank you.

    ReplyDelete
  11. This actually works for me. I have implemented it on my www.topandroidstuff.blogspot.com site. Check it.

    ReplyDelete
  12. Jide thank you very much, it works perfectly well on our blog(benueforum.com)though the mobile aspect is confusing as I can't find the under the mobile description above. Please can I have more explanation?

    ReplyDelete
  13. Jessica5/05/2016

    please i need more explanation on the mobile view implementation also the desktop view is not showing well on this particular page http://www.futogbedu.com/2016/03/why-do-guys-love-touching-breast-of-ladies.html please help

    ReplyDelete
  14. tenx Jide for this wonderful trick. it worked perfectly on my blog. take a look at WizyTechs.Com

    ReplyDelete
  15. how can i make the code appear after first few lines under the post title

    ReplyDelete
  16. been trying since but i dont get it right

    ReplyDelete
  17. Thanks you sir for this trick.

    ReplyDelete
  18. Is it me or do you have more than 3 adsense ads on your site? I count 4, isn't that against adsense TOS?

    ReplyDelete
  19. Nice tutorial, let me give it a try

    ReplyDelete
  20. when i open edit html page in layout and search for the word u told for data post body it doesnt show any codelike this anywhere in that html edit page \thans help me to add ads in my blog thanks

    ReplyDelete
  21. Thanks so much for your update Sir, followed your instructions and I was able to place my ads at the top and below posts on my blog http://www.afrikkupdate.com/

    God bless you Sir Jide!!

    ReplyDelete
  22. Thanks for the info, I implement it on my blog and it works perfectly

    ReplyDelete
  23. thanks
    it really helped

    ReplyDelete
  24. Wow, Thanks for this... I just applied it to my blog( http://www.appgamedownload.com/ ) and booom I got it right...

    ReplyDelete
  25. I don't understand this. Please explain,

    "To make it appear on mobile view, find in your HTML and replace the under the line as explained above"

    ReplyDelete
  26. it works perfectly, God bless Ogbonge master,

    ReplyDelete
  27. Thanks very much
    Now my AdSense can display in all post

    ReplyDelete

Post a Comment

We Love To Hear From You But Don't Spam Us With Links!

Want to be notified when I reply your comment? Tick the "Notify Me" box.

If your comment is unrelated to this post or you're trying to ask question about an old post, please drop it at our discussion platform here.

THANKS.