How to put Adsense Ads anywhere inside Blogger Posts

Bloggers often struggle to put adsense ads at the correct place so that they get sufficient clicks on their ads. One such place is in middle of the post (not on the homepage). One way is to add the same code in the HTML coding of each post, but its too complicated and need repetition of same thing again and again. There is an alternate method to achieve this goal.
It will take some time and skill of yours to implement it, but in the end results will be amazing.

What do u need:

  • Basic understanding of HTML coding.
  • Fluent in using Notepad (Find and Replace Function)
  • Able to press Ctrl+C and Ctrl+V buttons on your keyboard.


So lets start it. Follow the following steps to put adsense ads anywhere inside blogger posts.

1. Edit any post and place the following code in the HTML coding where you want the adsense ad to appear and then save and close.

<!-- adsense -->

2. Open your adsense account and create a new adsense unit of the desired shape and size. Copy the asynchronous code of ad unit and paste it in a notepad.
3. Use find and replace feature of notepad and perform the following things

  • Find < replace with &lt;
  • Find > replace with &gt;
  • Find " replace with &quot;

4. Now your Ad code is ready. You can put it inside <center> and </center> to align it in the center position in the blog.
5. Paste the following code above the ad code in the notepad

<div expr:id='"adsmiddle1" + data:post.id'></div>
<b:if cond='data:blog.pageType == "item"'>
<b:if cond='data:blog.pageType != &quot;static_page&quot;'>
<div style="clear:both; margin:10px 0">


6. Paste the following code after the ad code in the notepad

</div>
</b:if>
</b:if>
<div expr:id='"adsmiddle2" + data:post.id'>
<data:post.body/>
</div>
<script type="text/javascript">
var obj0=document.getElementById("adsmiddle1<data:post.id/>");
var obj1=document.getElementById("adsmiddle2<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>


7. Now open the template in blogger. Now you have to edit its HTML coding. Its better to take backup of your template coding before editing.
8. Once you are inside Template HTML coding, click inside 1st line of code and press Ctrl+F and try to find the following code

<data:post.body/> 

9. There may be three instances of this code inside template code. You have to replace the second instance of it with the complete code in the notepad. Save the template.
10. You should get the desired results now. But if you don't then revert back the step 9 and replace the 3rd instance of <data:post.body/> with the code in notepad.

Note: Different blogger templates work in different way. Thats why in some templates step 9 works while in some step 10 works.

You may leave your comments to let me know if this trick works for you. Your suggestions are most welcome.
Share this Article :
Email

No comments:

Post a Comment