If you are not sure what this little blogger hack do then take a minute to look at this gardening blog, you would get the picture.
Few months back I came across this cool hack which lets you put adsense ads in the body of your blogspot blog posts. Doing this not only gives you more flexibility with your ad placement but may also lead to higher CTR. So what are we waiting for, lets jump right into the good stuff.
Getting the ads in the body of your blogger posts needs your to change your blogspot template little bit. Please remember that depending on the template you have the code might be little different but the main idea would be same. I would advice you to copy your template code in your favorite text editor for easy searching.
First find the section in your template where you need to make changes - this section is usually labeled by following comment:
<!-- START POST --> and <!-- END POST -->
Now that you have found the section which needs to modify, next you have to find that single life which needs to be replaced by the code I would provide later in this article. This is usually the 4th or 5th line from the top of this section containing the tag <$BlogItemBody$>. Just search in the text editor if you can't find it. The line that needs to be replaced is
<div class="text"><$BlogItemBody$></div>
Once you have searched this line just replace it with the following code:
<div class="boxblog">
<div id="prv<$BlogItemNumber$>"></div>
<div style="margin:10px 0 -10px 0">
<!-- Replace this code with YOUR google adsense code -->
<script type="text/javascript"><!--
google_ad_client = "pub-0539739230171210";
google_alternate_color = "ffffff";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "78B749";
google_color_text = "CCCCCC";
google_color_url = "CCCCCC";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
<div id="fst<$BlogItemNumber$>"> <$BlogItemBody$>
</div><script language="JavaScript">
var obj0=document.getElementById("prv<$BlogItemNumber$>");
var obj1=document.getElementById("fst<$BlogItemNumber$>");
var s=obj1.innerHTML;
var r=s.search(/<adsense>/igm);
if(r>0) {obj0.innerHTML=s.substr(0,r);obj1.innerHTML=s.substr(r+9);}
</script></div>
This is all you have to do. Now just save the template and republish your blog.
But you may wonder where exactly will your ads appear in the post. Well you can choose the exact location for you ads. Simply put the "<adsense>" tag (without quotes) in your post's body and the adsense ads would appear in its place. If you forget to put the tags for some post then the ad would appear at the top of the post.
That's it. Give it a try, put it on your blogs. Come back here and post a comment about your experience.
If you enjoyed this post Subscribe to my RSS feed.
related posts
July: $31
June: $35
My goal for this blog is to reach that 1k per month target in 12 month or delete this blog if it fails. I would maintain a weekly updates in this section.