How to place Ads anywhere in your Post

Placing Adsense in the right "place" is important for it increases your revenue(maybe or maybe not). Using Blogger platform, you can place Adsense below the post title or just after your posts. Why not put it in the middle? It will be great like this site: http://screenrant.com/hobbit-3-peter-jackson/

And I would like to share what I have found, here how to do it. With this method you can place your Ad with your own preference, either in the middle, near middle or bottom, anywhere! 

Here's how to do it!

1. Find the  <data:post.body/> (tick the Expand Widget Templates) then replace that tag with the code below:
<div expr:id='"aim1" + data:post.id'></div>
<div style="clear:both; margin:10px 0">
<!-- Your AdSense code here -->
</div>
<div expr:id='"aim2" + data:post.id'>
<data:post.body/>
</div>
<script type="text/javascript">
var obj0=document.getElementById("aim1<data:post.id/>");
var obj1=document.getElementById("aim2<data:post.id/>");
var s=obj1.innerHTML;
var r=s.search(/\x3C!-- adsense --\x3E/igm);
if(r>0) {obj0.innerHTML=s.substr(0,r);obj1.innerHTML=s.substr(r+16);}
</script>
Put your Adsense Code below the  <!-- Your AdSense code here -->. 
The Adsense code is look like this:
<script type="text/javascript"><!--
google_ad_client = "ca-pub-2640009821158318";
/* middle */
google_ad_slot = "8095494903";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
To avoid errors you need to convert  Raw HTML to Escaped HTML by using this site: click here
Instead of using the code given by google adsense use the escaped HTML code. And place the Escaped HTML Code below the  <!-- Your AdSense code here -->.  

2. Then in every Blog post you need to add this line:
<!-- adsense -->
Place it in exact point where you want the Ad to appear.
You have to click HTML Tab, then add the code on where you want. Then publish it while your in HTML Tab.

That's it! By default, if you will not put the "<!--adsense-->" line the Ad will appear at the top.

SOURCE

Popular posts from this blog

Add/Subtract Single Digit Number in Assembly Language

Set table width to 100% on PDF export in Datatables