Add Adsense In the Middle of Posts

Add Adsense In the Middle of Posts

Ad placement and customization has been written and discussed much in the webosphere. In fact, a famous heat map detailing the ideal places for a higher click through rate (CTR) has been floating around for quite a few years now. Then, Google also has a dedicated help section outlining the best positions for ads on blogs, forums, and sites covering the news, classifieds and gaming.

For blogs, an ad unit somewhere in the middle of your post can potentially boost your CTR, especially if its a lengthy post with fewer images. Unfortunately, unlike WordPress which has a number of excellent plugins for injecting ads anywhere in your blog, blogger does not have this options.



But thanks to a simple JavaScript solution developed by adsinthemiddle, you can place your Adsense code within a post - anywhere.

Its worth noting that this method does not, by anyway violate the Adsense policies.

1. To Manually Display Ads In The Middle of Selective or Every Post:

Manually inserting Adsense ads in the middle of posts in blogger is pretty simple, here are two easy steps to do so:

  • Before proceeding, do backup your template as a precaution.

Step 1: On New Blogger (Post Designer Template):

Find <data:post.body/>. Now, replace it with a parsed copy of the following code:

To parse your HTML, you can use this HTML Parse Tool.

<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>

Note: In the above code, replace <!-- Your adsense code here --> with your actual Adsense code.
Step 2:

Now, where ever you wan't your ad unit to appear, put a special comment:

<!-- adsense -->

Done.



share this article to: Facebook Twitter Google+ Linkedin Technorati Digg
Posted by Unknown, Published at 10:33 PM and have 0 comments

No comments:

Post a Comment