Adsense ad iframe有1/3的时间是空的html主体



我试图让Adsense广告在我的网站上正常工作,但不知何故,在某些页面上,它们加载不一致。广告加载正确,可能有2/3的时间,但偶尔空间会保持空白。据我所知,问题不在于没有广告;创建了广告的iframe,添加了data-load-complete="true"标签,但不知何故,该广告的htmlbody标签仍然为空:<body marginwidth="0" marginheight="0"></body>

<ins class="adsbygoogle" style="display: block; height: auto !important; min-height: 0px !important;" data-ad-client="ca-pub-..." data-ad-slot="6818818970" data-ad-format="auto" data-full-width-responsive="true" data-adsbygoogle-status="done">
<ins id="aswift_1_expand" style="display:inline-table;border:none;height:280px;margin:0;padding:0;position:relative;visibility:visible;width:900px;background-color:transparent;">
<ins id="aswift_1_anchor" style="display: block; border: none; height: 280px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 900px; background-color: transparent; overflow: visible;">
<iframe id="aswift_1" name="aswift_1" style="left:0;position:absolute;top:0;border:0;width:900px;height:280px;" sandbox="allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation-by-user-activation" width="900" height="280" frameborder="0" src="" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no" allowfullscreen="true" data-google-container-id="a!1" data-google-query-id="CJf52ubwxewCFQKFgwcdwIoMHw" data-load-complete="true">
<html class=" yirjomiyii idc0_322">
<script type="text/javascript">window["_gaUserPrefs"] = { ioo : function() { return true; } }</script>
<head>
<script>window.top.postMessage('{"msg_type":"resize-me","key_value":[{"key":"r_nh","value":"0"},{"key":"qid","value":"COCMyfTkxewCFcaadwodDGMDxA"}],"googMsgType":"sth"}', '*');</script>
<script>window.top.postMessage('{"msg_type":"adsense-labs","key_value":[{"key":"settings","value":"[\"ca-pub-...\",[[1]]]"}],"googMsgType":"sth"}', '*');</script>
</head>

<body marginwidth="0" marginheight="0"></body>
</html>
</iframe>
</ins>
</ins>
</ins>

据我所知,通常情况下,如果广告没有加载,adsbygoogle类的元素甚至不应该有任何子元素。有没有人遇到过这样一个问题:一个看似部分加载的广告有一个空的html正文?有什么想法可能导致这种情况或如何避免这种情况吗?

这很正常。AdSense并不总是返回广告。当AdSense没有找到任何广告时,它会像您的例子一样返回空的iframe。如果可能的话,空插槽应该折叠(注意调整我的大小消息(。我们不清理DOM(例如,删除所有的ins元素和iframe(,因为它不会影响页面的外观。它可能会节省一些内存,但考虑到它有3个额外的DOM元素,这些节省是很小的。

最新更新