Friday 6 July 2012

how to add Adsense ads in the post wherver you want

untitled1 
Adsense earnings for image ads are highly derived by the location where they are placed and for the text ads if placed inside the body depends upon how inherited they are with its surroundings.

For post there are post header ,post footer and middle of post where you can place the Adsense ads. Adsense code can be easily placed in post header and footer but for the middle certain JavaScript technique has to used.
For placing the code in the middle Go To Blogger Layout >> Edit Html. Check the box Expand Widgets Template and search for the below code.

<data:post.body/>
and replace it with this one
<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>
Replace the blue line with your Adsense code and save the template.
Now whenever you are writing any post just add the below code at the place where you want the Adsense ads to be shown in the post.
<!-- adsense -->
and continue writing the rest post.
Now whenever you will publish your post you will see Adsense ads in between posts at the place where you placed the above line.

No comments:

Post a Comment

Looking For Your Favorite E-Books, Softwares, Movies etc. Let Us Know, All You Need To Do Is Comment & Subscribe Our Blog And Get it soon