In this tutorial, I'll be showing you how to add Adsense codes inside you blog posts. This method can also be used to place any other Ad codes inside your blog posts. It can be before the first paragragh, below the Title, or in the Second paragragh, just anywhere in the post you
choose to add the Adsense codes.
Carefully follow the steps below and you'll do just fine..
Now let's begin...
Step 1
Copy the adsense code and Parse it here. Now copy the Parsed code to your notepad
Step 2
Login to your blogger dashboard
Step 3
Click “Theme/Template” and select “Edit HTML”
Step 4
Now search (press Ctrl + F inside the template box) for this tag
<data:post.body/>
This tag usually appears in several places, so you should look for the second tag and replace it with the following code
<div expr:id='"adsmiddle1" + data:post.id'></div><b:if cond='data:blog.pageType == "item"'>
<b:if cond='data:blog.pageType !=
"static_page"'>
<div style="clear:both; margin:10px 0">
<!-- Your Ad Code Goes Here -->
</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>
Note: Replace “Your Ad Code Goes Here” with your Parsed Adsense code or any other parsed code. To make the Ad appear at the center of your post, add the <center></center> scripts before and after the parsed adsense code
Here is how it should look like
<div expr:id='"adsmiddle1" + data:post.id'></div>
<b:if cond='data:blog.pageType == "item"'>
<b:if cond='data:blog.pageType !=
"static_page"'>
<div style="clear:both; margin:10px 0">
<center>
<!-- Your Ad Code Goes Here -->
</center>
</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>
Step 5
Now Save Template
After doing that, we are going to Embbed the Adsense annototion inside the HTML, to where you want the Ads to appear in your post.
Step 1
First you have to create a new post or edit your previous post. Now Click on HTML beside COMPOSE
Step 2
Now add <!-- adsense --> to where you want the Adsense ads to appear in the HTML box
For example:
Here is a sample text. here is a sample text. here is a sample text. here is a sample text. here is a sample text.<br /><br /> <!-- adsense --> here is a sample text. here is a sample text. here is a sample text. here is a sample text. here is a sample text.
Anywhere you Embbed the Adsense Annotation, that's where the ads will appear. But if you don't Embbed it, the Ads will automatically appear below the Post Title.
I hope you enjoyed this tutorial. You can follow this blog on our Newsletter to get our new updates delivered to your mail.
0 Comments