SpyLoaded Forum






News




Author Topic: How to place Adsense Ads in Every Blogger Middle Content Post Automatically  (Read 4979 times)

Offline Mr. Babatunde

  • Administrator
  • Hero Member
  • *****
  • Posts: 7352
  • BBM : C004561AA



We put a lot of effort into writing each article, therefore we can't make it much more difficult by manually inserting the Ads code into each Blogger blog post. How may AdSense advertising be added automatically in the middle of every Blogger blog post by Inserting AdSense ads code in every Blogger post automatically, using XML code? is the topic of this tutorial. Take the actions outlined below.

Selecting AdSense Ad code from AdSense and adding it to every blog post takes a lot of effort and time. We may occasionally neglect to include the codes. Revenue is lost as a result of this. The answer is to once again add the AdSense advertisements code and unwind. Every blog post automatically inserts your AdSense advertisements code.

STEP TO ADD ADS IN MIDDLE CONTENT ON BLOGSPOT

Code: [Select]
<b:if cond='data:view.isPost'>
<div id='seoneurons-target'>
 <data:post.body/>
</div>
<div id='seoneurons-content'>
<div style='margin:15px 0;text-align:center;clear:both;'>
      <!--Place Your Prased Adsense Ad code here-->
</div>
 </div>
<div id='seoneurons-target'>
 <script type='text/javascript'>
function insertAfter(addition,target) {
var parent = target.parentNode;
if (parent.lastChild == target) {
parent.appendChild(addition);
} else {
parent.insertBefore(addition,target.nextSibling);
}
}
var adscont = document.getElementById("seoneurons-content");
var target = document.getElementById("seoneurons-target");
var linebreak = target.getElementsByTagName("br");
if (linebreak.length > 0){
insertAfter(adscont,linebreak[2]);
}
</script>
</div>
</b:if>
 <b:if cond='data:view.isPage'><data:post.body/></b:if>

1. Copy Above Code and Paste it in Notepad or any text editor application.

2. Open the Google Adsense Account

3. Generate Adsense Ads or any ads(Text and Image) code

4. Replace line <!–Place Your Prased Adsense Ad code here–> with the Adsense code.

5. Now Open blogger. com and select “Theme”.

6. Download the theme file for backup.

7. Now click on “Edit HTML”.

8. Now you’ll see XML of your blog.

9. And Now search <data:post.body/>. If you cannot find it, copy the whole file and edit it externally using any text editor.

10. Replace <data:post.body/> with the above code(I.e. the below copied code).

11. SAVED

Note: In the latest Blogger theme, there is only one <data:post.body/> tag, but if you’re using older themes, there maybe 2 or 3 or more results for <data:post.body/>. In such an old version of the theme, you’ve to make hit and the trial method by checking all <data:post.body/>. In most of the templates, it works on the 3rd result of <data:post.body/>.

Place Multiple AdSense ads Automatically in Every Post of Blogger

Code: [Select]
<b:if cond='data:view.isPost'>
<div id='daoptimisticinfo-target'>
 <data:post.body/>
</div>
<div id='daoptimisticinfo-content1'>
<div style='margin:15px 0;text-align:center;clear:both;'>
      <!–Place Your Prased Adsense Ad code here–>
</div> 
 </div>
 <div id='daoptimisticinfo-content2'>
<div style='margin:15px 0;text-align:center;clear:both;'>
      <!–Place Your Prased Adsense Ad code here–>
</div> 
 </div>
<div id='daoptimisticinfo-target'>
 <script type='text/javascript'>
function insertAfter(addition,target) {
var parent = target.parentNode;
if (parent.lastChild == target) {
parent.appendChild(addition);
} else {
parent.insertBefore(addition,target.nextSibling);
}
}
var adscont = document.getElementById(&quot;daoptimisticinfo-content1&quot;);
var target = document.getElementById(&quot;daoptimisticinfo-target&quot;);
var linebreak = target.getElementsByTagName(&quot;br&quot;);
if (linebreak.length &gt; 0){
insertAfter(adscont,linebreak[1]);
}
</script>
     <script type='text/javascript'>
function insertAfter(addition,target) {
var parent = target.parentNode;
if (parent.lastChild == target) {
parent.appendChild(addition);
} else {
parent.insertBefore(addition,target.nextSibling);
}
}
var adscont = document.getElementById(&quot;daoptimisticinfo-content2&quot;);
var target = document.getElementById(&quot;daoptimisticinfo-target&quot;);
var linebreak = target.getElementsByTagName(&quot;br&quot;);
if (linebreak.length &gt; 0){
insertAfter(adscont,linebreak[3]);
}
</script>

</div>
</b:if>
<b:if cond='data:view.isPage'><data:post.body/></b:if>

Note: Place the two different AdSense ads in the <!–Place Your Prased Adsense Ad code here–>. We recommend you to place a max of 2 ads if your article is 600 words long. If you place a higher number of ads, then invalid clicks may increase and lower the CPC.

target.getElementsByTagName("br"); Declares the ads’ location. Here to default tag for Blogger post is br for the break
. You can change it to p, h2, h3, h4 according to the need. If you don’t know what this is, then leave it as it is.

insertAfter(adscont,linebreak[n]); Declared how many tags the ads should be visible. Where n=number of tags-1, i.e., for 4 tags, n will be 4-1=3.

So if you want to display after 1 line break, then place 0 instead of 3,
display an ad after 2 tags, then put 1 instead of 3,
and so on.

Source: Seoneurons










TAG:





 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Note: this post will not display until it's been approved by a moderator.
Name: Email:
Verification:
"5 eggs" Multiply By "4 eggs" Is what ?:


Close
SimplePortal 2.3.6 © 2008-2014, SimplePortal