installing two ads unit in the middle of a post

installing an ad unit in the middle of a post with reference to the percentage of published article manuscripts. So ads do not always appear under the first and fourth paragraphs only, for example, but ads may appear under the first and second paragraphs, under the third and sixth paragraphs, or under different paragraphs according to the large number of at least the number of paragraphs on the post itself. Where the application can be done by doing the following steps:

1. parse the first AdSense script / ad code to be installed.
2. edit the theme / template and then look for the <data: post.body /> section. Furthermore, if the part has been met, then replace it with a series of code below.
But remember ...! Do not forget to replace the section that says <! - Delete this section and then replace it with the script that has been parsed ad. -> with the AdSense code you previously parsed.

<b:if cond='data:blog.pageType == &quot;item&quot;'>
   <b:if cond='data:blog.pageType != &quot;static_page&quot;'>
     <div id="ad-script1">
       <div style='clear:both;'>
         <!-- Delete this section and then replace it with the script that has been parsed ad. -->
      </div>
     </div>
   </b:if>
</b:if>
<div
 id="tgtp">
   <data:post.body/>
</div>
<b:if
 cond='data:blog.pageType == &quot;item&quot;'>
   <b:if
 cond='data:blog.pageType != &quot;static_page&quot;'>
     <div
 id="ad-script2">
       <div style='clear:both;'>
         <!-- Delete this section and then replace it with the script that has been parsed ad.. -->
       </div>
     </div>
     <script
 type='text/javascript'>
     function insertAfter(tbh,tgt) {
       var prt = tgt.parentNode;
       if (prt.lastChild == tgt) {prt.appendChild(tbh);}
       else {prt.insertBefore(tbh,tgt.nextSibling);}}
       var tgt = document.getElementById("tgtp");
       var ad1 = document.getElementById("ad-script1");
       var ad2 = document.getElementById("ad-script2");
       var tg1 = tgt.getElementsByTagName("p");
       var tg2 = tgt.getElementsByTagName("br"); 
       var pt1 = tg1.length; var pt2 = tg2.length;
       var ps1 = pt1*30/100; var ps2 = pt1*60/100;
       var br1 = pt2*30/100; var br2 = pt2*60/100;
       var bl1 = Math.round(ps1); var bl2 = Math.round(ps2);
       var bk1 = Math.round(br1); var bk2 = Math.round(br2);
       if (pt1 > 2) {
           insertAfter(ad1,tg1[bl1-1]); insertAfter(ad2,tg1[bl2-1]);
       } else if (br2 > 1) {
           insertAfter(ad1,tg2[bk1-1]); insertAfter(ad2,tg2[bk2-1]);
       } else {}
     </script>
   </b:if>
</b:if>
3. save theme / template.

Information:
You can change the numbers 30 and 60 in sections 30/100 and 60/100 to change the percentage of ad layouts.
The script detects the presence of the <p> or <br> tag contained in the post, assuming that both tags are common and most widely used in the creation / preparation of articles with the blogger / blogspot platform.