Friday, September 17, 2010

How to put AdSense in the middle of Blogger posts

Sure you wanted to add Google Adsense code inside your Blogger Template, & you found it’s not a simple copy & paste job. Now your in luck dude!

This is something not mentioned in the AdSense optimization for Blogger. Since blogger blogs doesn't support advertisements in the middle of the post by default. Yet, small hack will enable you to do it.
At the movement Ads in the middle of the post make a plus touch of the revenue. however, it can always do better impact on your AdSense revenue. Please share your ideas and experience in the comments.



This site does not confirm an increase in profits when an ad is in the middle of a post, but explains how to put AdSense in the middle of a Blogger post.


Solution

There is a simple way to solve this problem: move post body around the advertising code, just with a bunch of JavaScript and a couple of DIVs. In 2 easy steps:

1- In your Blogger template:

Find the tag <data:post.body/> (you must check Expand Widget Templates in Blogger console) and replace it with following code:
<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 that you must replace <!-- Your AdSense code --> with block code provided by Google.
Since you cant put Javascript inside blogger editor you will need to convert your adsense code, here is two sites you can convert your adsense code inside it. So you can add ads any where inside your blog body or inside your post. 
Blogger Ad Code Converter 
Adsense Code Converter For Blogger Blogs

 2- In every blog post: 

In every blog post: Put a special comment
<!-- adsense -->
in the exact point you want to appear AdSense advertising.

Thats is
Done!

This method also works with other advertising systems, like Yahoo! Publisher Network (YPN), Microsoft adCenter, Chitika, AdBrite, or others.

Answering a direct support request Google stated this method doesn't violate any of their program policies.
I search so much and i find too little sources, but i really would love to thank this site and it call ads in the middle i have learned from it so much.

No comments:

Post a Comment