如何在博客文章中插入多个adsense单元

时间:2019-06-03 21:06:30

标签: blogger adsense posts

我购买了一个Blogger模板,该模板可以选择在每个Blogger帖子的中间添加一个adsense单元,并且我想在较长的帖子中添加多个Units并确定在广告之后出现多少段之后,这是广告脚本,但它也包含在布局中,如图所示。 如何在长帖子中添加多个单位。

我试图按如下方式修改代码,但没有用

<script>//<![CDATA[
var firstImg = document.querySelector('.amp-content img');firstImg.style.display='none';
function insertAfter2(addition2,target2) {var parent = target.parentNode;if (parent.lastChild == target) {parent.appendChild(addition); } else {parent.insertBefore(addition,target.nextSibling);}}
var adscont = document.getElementById("adsCent");var target = document.getElementById("adsCenter");
var bungkus3 = target.getElementsByTagName("br");if (bungkus3.length > 0){insertAfter(adscont,bungkus3[2]);}
var bungkus = target.getElementsByTagName("blockquote");if (bungkus.length > 0){insertAfter(adscont,bungkus[0]);}
var bungkus2 = target.getElementsByTagName("h2");if (bungkus2.length > 0){insertAfter(adscont,bungkus2[2]);}
    //]]></script>

<div class='mg-ads' id='adsCent'><div class='a3lan-Center'/>
<script>//<![CDATA[
var firstImg = document.querySelector('.amp-content img');firstImg.style.display='none';
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("adsCent");var target = document.getElementById("adsCenter");
var bungkus3 = target.getElementsByTagName("br");if (bungkus3.length > 0){insertAfter(adscont,bungkus3[2]);}
var bungkus = target.getElementsByTagName("blockquote");if (bungkus.length > 0){insertAfter(adscont,bungkus[0]);}
var bungkus2 = target.getElementsByTagName("h2");if (bungkus2.length > 0){insertAfter(adscont,bungkus2[0]);}
    //]]></script>

enter image description here

0 个答案:

没有答案