AdsenseArticleBlogger

How to place Adsense Ads in Every Blogger Post Automatically

This tutorial will help you in inserting every kind of AdSense ads or other platform ads to every post of the blogger blog. Follow the steps provided below and place your ads every post.

Insert Adsense ads code automatically in every blogger post

We can easily implement Adsense Ad code to show ads in every Post. We can use “text and image“, “text-only ads” or a new type of Native Ads “In-Article Ads”. If you’re looking to place AdSense ads automatically in your blogger feed then you can refer our this article to setup In-feed ads for blogger.

Place AdSense Ads in Blogger Post Automatically
Place AdSense Ads in Blogger Post Automatically

How we can implement Adsense ads automatically in blogger posts?

Google introduced new kinds of native ads for its publishers to increase revenue and a good user experience. Native kind of ads helps you to increase your revenue by 60%. Read this complete article it will help you a lot. To implement Adsense ads in blogger you have to make some changes in your blogger template.

But here, you can add any kind of ad unit using our code, provided below to implement ads in the middle of a blogger blog. You just need to copy the provided code, change ad unit values with you and place it as suggested in this article.

Step by Step guide.

1. Insert AdSense ads code in every blogger post automatically, using XML code.

By implementing the code provided below into your blogger theme file, you can show adsense ads on every blogger post.

<b:if cond='data:blog.pageType == "item"'>
<div id='techaak-target'>
 <data:post.body/>
</div>
<div id='techaak-content'>
<div style='margin:15px 0;text-align:center;clear:both;'>
      <!--Place Your Prased Adsense Adcode here-->
</div>
 </div>
<div id='techaak-target'>
 <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("techaak-content");
var target = document.getElementById("techaak-target");
var linebreak = target.getElementsByTagName("br");
if (linebreak.length > 0){
insertAfter(adscont,linebreak[2]);
}
</script>

</div>
</b:if>
        <b:if cond='data:blog.pageType == "static_page"'><data:post.body/></b:if>
  1. Copy Above Code and Paste it in Notepad or any text editor application.
  2. Open Your Adsense Account
  3. Generate Adsense Ads or any ads(Text and Image) code
  4. Now Prase Ad code —Click here to Prase Your code
  5. Replace line <!–Place Your Prased Adsense Ad code here–> with your Prased Adsense Code generated in step 4.
  6. Now Open blogger.com and select “Theme”
  7. Download your theme for backup.
  8. Now click on “Edit HTML”
  9. Now you’ll see XML of your blog.
  10. And Now search <data:post.body/>. If not able to find, copy the whole file and edit it externally using any text editor.
  11. Replace <data:post.body/> with the above code(created in Notepad).

Note: In the latest blogger theme there is only one <data:post.body/> tag but if you’re using older themes there maybe 2 or 3 or more result for <data:post.body/>. In such an old version of the theme, you’ve to make hit and the trial method by checking all <data:post.body/>. In most of the templates, it works on 3rd result of <data:post.body/>.

Changes to be made are:

  • Replace “**YOUR PRASED AD CODES**” with your own ads code.
  • This code you replaced, will appear in the middle of Blogger Blog as an Adsense ad.
  • Ads will be placed only after the 2nd Paragraph.

To place Multiple Adsense ads Automatically in Every Post of blogger

And If you want to place more than one Adsense Ads in your blogger post, Replace code given below instead of the previous code.

<b:if cond='data:blog.pageType == "item"'>
<div id='techaak-target'>
 <data:post.body/>
</div>
<div id='techaak-content1'>
<div style='margin:15px 0;text-align:center;clear:both;'>
      <!--Place Your 1st Prased Adsense Adcode here-->
</div>  
 </div>
 <div id='techaak-content2'>
<div style='margin:15px 0;text-align:center;clear:both;'>
      <!--Place Your 2nd Prased Adsense Adcode here-->
</div>  
 </div>
<div id='techaak-target'>
 <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("techaak-content1");
var target = document.getElementById("techaak-target");
var linebreak = target.getElementsByTagName("br");
if (linebreak.length > 0){
insertAfter(adscont,linebreak[2]);
}
</script>
     <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("techaak-content2");
var target = document.getElementById("techaak-target");
var linebreak = target.getElementsByTagName("p");
if (linebreak.length > 0){
insertAfter(adscont,linebreak[2]);
}
</script>

</div>
</b:if>
<b:if cond='data:blog.pageType == "static_page"'><data:post.body/></b:if>

Place the two different AdSense ads, in the <!--Place Your Prased Adsense Adcode here-->. We recommend you to place max 2 ads if your article is 600 words longs. If you place the higher number of ads then invalid clicks may increase, and lower the CPC you get, that is completely a wrong practice.

If you find the above article helpful, or any doubt ask in the comment section below. We’ll be happy to help you. Thank you.

Ashok Kumar

Love Coding, Love Blogging what else to explain :).

Related Articles

7 Comments

  1. Hello Dealsyou, you can create

    below

    and copy paste new script below last script, and make this changes in new script line = var adscont = document.getElementById(“techaak-content2”);
    in place of techaak-content2, place techaak-content3
  2. Hello Dealsyou, you can create <div id="techaak-content3"> below
    <div id="techaak-content2">
    and copy paste new script below last script, and make this changes in new script line = var adscont = document.getElementById("techaak-content2");
    in place of techaak-content2, place techaak-content3

  3. I am very grateful for you as a searched alot and i didn’t find any effective way till i found that post. Thanks alot

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to top button