-->
[Guide] - Add automatically Adsense Ad below Post Title and within all blog posts in Blogger

[Guide] - Add automatically Adsense Ad below Post Title and within all blog posts in Blogger


How to automatically add Adsense Ad below Post Title and within all blog posts in Blogger. Here on this post, we are going to show you how to automatically add Adsense ads below post title and within all blog posts in Blogger. 

By using this method, you will save yourself the stress of copy the ads code and adding it to every post individually.

Unlike WordPress where there are many plugins that can be used to automatically insert ads within the blog post, Blogger is different.


By default, the Blogspot platform doesn't provide widgets for the easy insertion of Ads inside a blog post. Although some custom Blogger templates come with this option like the Magone Blogger theme, others do not.

As a result, once you've launched your stunning new Blogger website and gotten approved by Google Adsense, placing ads inside posts(in-article ads) becomes very tedious, especially if you had already written many articles. 

You can easily add ads to the sidebar section, above the post and below post in some Blogger themes, but What about adding ads automatically within all posts? kmergsm has a solution for you. 

Here on this post, we are going to show you how to automatically add Adsense ads below post title and within all blog posts in Blogger. By using this method, you will save yourself the stress of copy the ads code and adding it to every post individually.


Automatically add Adsense Ad below Post Title and within all blog posts in Blogger

For this to work, you will be tweaking, or let's say customizing your Blogger template. And to avoid any issues since you may erroneously mess up your theme, first of all, take a backup of your theme before starting.

Backup your theme

As we said earlier, you will need to first of all backup your Blogger theme before applying this customization. This should help restore if anything goes wrong.

To backup your Blogger theme, proceed thus;
  • Log in to your Blogger dashboard and click on "theme".
  • Next, under "theme", click on "Backup/Restore"

Adding automatic in-article ads on Blogger posts

There are different possible ads placements within a blog post. And the popular placements are below the post title and in-article(inside post body). Below, we have described all the necessary steps as well as codes to use.

Add automatic Adsense ad code below post title or below the post content

Adding automatic Adsense ads unit below all blog posts tittle in Blogger can be done using the following lines of code:


<div class='Adsense-ads' style='margin:5px;'>

[Add Your Converted Adsense Code]

</div>



  • All you need to do is copy this line of code, go to Blogger dashboard → Theme → Edit HTML 
  • Next, search for the line of code below and paste the code provided above just above it. In case you want Adsense ad unit to show below the post content(Adsense match-content), then paste the code above just below the line of code us have below.



<data:post.body/>


  • After pasting code for Adsense ad unit to appear below all post title, copy the Adsense ad unit you want to appear below the title of the post and parse it using this tool then replace "[Add your Converted Adsense code]" with the parsed Adsense code.

Automatically add Adsense ad within all blog posts in Blogger

Doing this won't be as straight forward as the case of the below post title. We will be in need of a javaScript to help place the ad units after a particular length of the blog post. To do this, you will be using the code below.
  • Start by going to the theme editor.
  • Next, search for the line of code below
<data:post.body/>


  • Replace this line of code with the code provided below. Also, note that you will find this code many times(3 times) you will have to test to see the one that works. Usually the third but might vary with different themes.

<div expr:id='&quot;post1&quot; + data:post.id'/>
<div class='Adsense-auto-in-article' style='margin:20px 0'>
<center>

[IN ARTICLE ADS 1] 

</center>
</div>
<div expr:id='&quot;post2&quot; + data:post.id'><data:post.body/></div>
<script type='text/javascript'>
var obj0=document.getElementById(&quot;post1<data:post.id/>&quot;);
var obj1=document.getElementById(&quot;post2<data:post.id/>&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+4);}
</script>

  • You will have to parse the Adsense ad unit using this tool and replace "[IN ARTICLE ADS 1]" in Orange color with it.
The code above will add an Adsense Ads unit at half the post length. If you want to add multiple Adsense ads units(above post title, below the post body, and in the middle of the post), then you will have to use the code below.

                <div expr:id='&quot;post1&quot; + data:post.id'/>
<div class='Adsense-auto-in-article' style='margin:20px 0'>
<center>

[IN ARTICLE ADS 1] 

</center>
</div>
<div expr:id='&quot;post2&quot; + data:post.id'><div class='Adsense-ads' style='margin:5px'>
<center>
[ABove title Ad]
  </center>
</div><data:post.body/><div class='Adsense-ad2' style='margin:5px;'>
<center>
[Below post content Ads]
  </center>
</div></div>
<script type='text/javascript'>
var obj0=document.getElementById(&quot;post1<data:post.id/>&quot;);
var obj1=document.getElementById(&quot;post2<data:post.id/>&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+4);}
</script>

You will have to replace the </data:post.body/> with the above line of code to add multiple ads inside the blog post automatically.

0 Response to "[Guide] - Add automatically Adsense Ad below Post Title and within all blog posts in Blogger"

Enregistrer un commentaire

Article Top Ads

Article Center Ads 1

Ad Center Article 2

Ads Under Articles

close