Google AdSense is a best way to earn revenue through your blog. For this purpose placement of ads on right place is very important where coverage is maximum. In this post we will discuss advanced practices to display ads at right place to generate high revenue from your blog and give worth to your writing skill. There are two places in a post where there is high coverage of a ad unit. Coverage of ad unit means clear visibility to readers and more chances of clicks. One of the most important location is just below post title/ start of the post on post page and other is mid section of the post. In this article we will also discuss how to show ads on Blogger posts only. Ads on “Static Pages” like about us, contact, privacy policy and other pages of same type will not appear.

Put Google AdSense in middle of post

Most recent version here –

https://www.techprevue.com/adsense-in-middle-of-post-blogger-advanced-practices-part-2/

Display ads at Start and Mid section of the post automatically

Here under is a script that will show ads at start and mid section of the post automatically. This script find the the mid part of the post and automatically place ad here. For some blog like tech blogs where HTML code sharing is common will not work perfectly it might come between shared code. But for all other blog it will work perfectly.

This code is also for those who are using scripts to show post summary on home page.

CASE-I: For those who are using post summary on home page.
To use this script go to template and search for <data:post.body/> and replace this code with the following code, and save the template.

CASE-II: For those who are using default Blogger template i.e. no post summary on home page.
To use this script go to template and search for <data:post.body/> and replace this code with the following code,

<b:if cond='data:blog.pageType == &quot;index&quot;'>
<data:post.body/>
</b:if>

Now paste the following code just above it, and save the template.

<!-- Ads in mid of post: automatically -->
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<div expr:id='"atmid" + data:post.id'/>
<div style="clear:both; margin:10px 0;text-align:center">
<!-- Paste Ad code here: Appear at mid of the post -->
</div>
<div expr:id='"attop" + data:post.id'>
<div style="clear:both; margin:10px 0;text-align:center">
<!-- Paste Ad code here: Appear at top of the post -->
</div>
<data:post.body/>
<div style="clear:both; margin:10px 0;text-align:center">
<!-- Paste Ad code here: Appear at bottom of the post -->
</div>
</div>
</b:if>
<script type="text/javascript">
var obj0=document.getElementById("atmid<data:post.id/>");
var obj1=document.getElementById("attop<data:post.id/>");
var s=obj1.innerHTML;
var t=s.substr(0,s.length/2);
var r=t.lastIndexOf(" ");
if(r>0) {obj0.innerHTML=s.substr(0,r);obj1.innerHTML=s.substr(r+1);}
</script>
<!-- Ads in mid of post: automatically -->

If you want to display ads on certain posts, you can use post label to control ads visibility. The following script may work for you.

To use this script go to template and search for <data:post.body/> and replace this code with the following code, and save the template.

<!-- Ads in mid of post: automatically -->
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<div expr:id='"atmid" + data:post.id'/>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.name == &quot;Label-Name&quot;'>
<div style="clear:both; margin:10px 0;text-align:center">
<!-- Paste Ad code here: Appear at mid of the post -->
</div>
</b:if>
</b:loop>
<div expr:id='"attop" + data:post.id'>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.name == &quot;Label-Name&quot;'>
<div style="clear:both; margin:10px 0;text-align:center">
<!-- Paste Ad code here: Appear at top of the post -->
</div>
</b:if>
</b:loop>
<data:post.body/>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.name == &quot;Label-Name&quot;'>
<div style="clear:both; margin:10px 0;text-align:center">
<!-- Paste Ad code here: Appear at bottom of the post -->
</div>
</b:if>
</b:loop>
</div>
</b:if>
<script type="text/javascript">
var obj0=document.getElementById("atmid<data:post.id/>");
var obj1=document.getElementById("attop<data:post.id/>");
var s=obj1.innerHTML;
var t=s.substr(0,s.length/2);
var r=t.lastIndexOf(" ");
if(r>0) {obj0.innerHTML=s.substr(0,r);obj1.innerHTML=s.substr(r+1);}
</script>
<!-- Ads in mid of post: automatically -->

Notes –
1. You can use three different label for three different ads at top, mid and bottom of the post. Must change value Label-Name with actual Label of your post.
2. Must change following three values with your three different/same ad code.
<!– Paste Ad code here: Appear at top of the post –>
<!– Paste Ad code here: Appear at mid of the post –>
<!– Paste Ad code here: Appear at bottom of the post –>

Display ads at Mid section/ Custom location in between the post manually

If you want to place an ad at custom position in between post, then there is also a solution for you. You have to place <– ads –> tag where you want to show the ad i.e. at custom position in between your each post.

To use this script go to template and search for <data:post.body/> and replace this code with the following code, and save the template.

<!-- Ads in mid of post: automatically -->
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<div expr:id='"atmid" + data:post.id'/>
<div style="clear:both; margin:10px 0;text-align:center">
<!-- Paste Ad code here: Appear at mid of the post -->
</div>
<div expr:id='"attop" + data:post.id'>
<div style="clear:both; margin:10px 0;text-align:center">
<!-- Paste Ad code here: Appear at top of the post -->
</div>
<data:post.body/>
<div style="clear:both; margin:10px 0;text-align:center">
<!-- Paste Ad code here: Appear at bottom of the post -->
</div>
</div>
</b:if>
<script type="text/javascript">
var obj0=document.getElementById("atmid<data:post.id/>");
var obj1=document.getElementById("attop<data:post.id/>");
var s=obj1.innerHTML;
var r=s.search(/x3C!-- ads --x3E/igm);
if(r&gt;0) {obj0.innerHTML=s.substr(0,r);obj1.innerHTML=s.substr(r+13);}
</script>
<!-- Ads in mid of post: automatically -->

Same as I explained above if you want to display ads on certain posts, you can use post label to control ads visibility. The following script may work for you.

If you want to place an ad at custom position in between post, then there is also a solution for you. You have to place <– ads –> tag where you want to show the ad i.e. at custom position in between your each post.

To use this script go to template and search for <data:post.body/> and replace this code with the following code, and save the template.

<!-- Ads in mid of post: automatically -->
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<div expr:id='"atmid" + data:post.id'/>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.name == &quot;Label-Name&quot;'>
<div style="clear:both; margin:10px 0;text-align:center">
<!-- Paste Ad code here: Appear at mid of the post -->
</div>
</b:if>
</b:loop>
<div expr:id='"attop" + data:post.id'>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.name == &quot;Label-Name&quot;'>
<div style="clear:both; margin:10px 0;text-align:center">
<!-- Paste Ad code here: Appear at top of the post -->
</div>
</b:if>
</b:loop>
<data:post.body/>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.name == &quot;Label-Name&quot;'>
<div style="clear:both; margin:10px 0;text-align:center">
<!-- Paste Ad code here: Appear at bottom of the post -->
</div>
</b:if>
</b:loop>
</div>
</b:if>
<script type="text/javascript">
var obj0=document.getElementById("atmid<data:post.id/>");
var obj1=document.getElementById("attop<data:post.id/>");
var s=obj1.innerHTML;
var r=s.search(/x3C!-- ads --x3E/igm);
if(r&gt;0) {obj0.innerHTML=s.substr(0,r);obj1.innerHTML=s.substr(r+13);}
</script>
<!-- Ads in mid of post: automatically -->

Notes –
1. You can use three different label for three different ads at top, mid and bottom of the post. Must change value Label-Name with actual Label of your post.
2. Must change following three values with your three different/same ad code.
<!– Paste Ad code here: Appear at top of the post –>
<!– Paste Ad code here: Appear at mid of the post –>
<!– Paste Ad code here: Appear at bottom of the post –>
3. Add <– ads –> tag tag in each post in HTML mode.

Important:
Before adding/injecting AdSense or some other ad codes in a Blogger template, you have to Parse it otherwise it will not appear in post(s). To parse AdSense code you can use our AdSense code parser code. It is available on the following link.

Parse AdSense Code in One Click

Most recent version here –

https://www.techprevue.com/adsense-in-middle-of-post-blogger-advanced-practices-part-2/

References:
1. http://www.o-om.com/2013/06/menampilkan-iklan-ditengah-posting-berdasarkan-label.html

Still have doubt leave a comment or open a topic in our forum.