How To Add AdSense Ad Unit Codes In Middle Of Post On Blogger New Themes


Adding and displaying Google AdSense Ad Units Code (Display or Link Ads) in the middle of blogger blog posts will increase your AdSense earnings via CTR (Click-through-rate). Previously, i wrote a post on how to add adsense link ad below post title in blogger and adding banner ad below blogger blog post. In these posts, I also included how to add these ad codes in new blogger themes, old blogger blog themes and other premium themes aside the ones from blogger recommended.


There are many tutorials out there on how to add Google AdSense ad code in middle of blog posts but this one here is the best i have seen that won't disturb your post if you are a blogger that blogs on "Blog Widgets" or "Coding".

Using my tutorial on adding adsense code in middle of blogger blog posts, you can make the AdSense code display below first line break in your post. Though you can increase the line.

Read Also : How To Apply For Google AdSense in Nigeria and Get Approved Instantly (2017 Guide)


How To Get Started


Generate Your Ad Code and Parse it

Sign in to your Blogger Dashboard

In the left menu, click "Theme" >> "Edit HTML" (make the page load completely)

On the html editors page, click CTRL+F button on your keyboard to search for the below code.

<data:post.body/>


Then select and replace <data:post.body/> with below code


<b:if cond='data:blog.pageType == &quot;item&quot;'>
<div id='ad-target'>
 <data:post.body/>
</div>
<div id='ad-content'>
<div style='margin:15px 0;text-align:center;clear:both;'>
       YOUR PRASED AD CODES
</div>
 </div>
<div id='ad-target'><blockquote class='tr_bq'>
 <script type='text/javascript'>
function insertAfter(addition,target) {
var parent = target.parentNode;
if (parent.lastChild == target) {
parent.appendChild(addition); 
} else {
parent.insertBefore(addition,target.nextSibling);
}
}
var adscont = document.getElementById(&quot;ad-content&quot;);
var target = document.getElementById(&quot;ad-target&quot;);
var linebreak = target.getElementsByTagName(&quot;br&quot;);
if (linebreak.length &gt; 0){
insertAfter(adscont,linebreak[1]);
}
</script>
</blockquote>
</div>
</b:if>
<b:if cond='data:blog.pageType == &quot;static_page&quot;'><data:post.body/></b:if>


Modifications


  • Change 15 to the to amount of space you want to be between your advert and content. You should adjust it if you are using adSense because it is a policy violation for your Google ads to be close to your content.
  • YOUR PRASED AD CODES - Replace this with your Google AdSense or other ad networks parsed ad unit code. Affiliate ads can also be added. 
  • Change  to the number of line break you want your ads to display. 


If you are using blogger old theme or other premium themes aside the ones from blogger recommended, use below format to add your AdSense code.

Search for <div class='post-footer-line-1'/> . 
You might find two of the code, make use of the first one which is usually for mobile while the second is for desktop view.


Now place the parsed adsense ad code under the above code.

Recommended :

==> How To Add AdSense 'Ads by Google' Link Ads Below Post Title in Blogger New and Old Themes
==> How To Add Google AdSense Banner Ad Codes Below Post On Blogger New and Old Themes





Subscribe To Our Newsletter
Follow Us On Twitter and Instagram

Comments