Forum Moderators: martinibuster
<script type='text/javascript'>
<![CDATA[
// Run when the DOM content is loaded
document.addEventListener('DOMContentLoaded',function(){
// AdSense ads lazy load, so they can't be examined right away
setTimeout(function(){
// Search the DOM for ad slots assuming they all have <div class=adsenseads> around them
var x=document.getElementsByClassName("adsenseads")
for(var i=0;i<x.length;i++){
// See if adsense loaded an ad by checking for an iframe
if(x[i].innerHTML.search(/iframe/i)==-1){
// No ad loaded
x[i].innerHTML="BACKUP AD CONTENT HERE";
}
}
},3000); // 3000ms or 3 seconds
});
]]>
</script> alert(document.getElementById("adsenseads").innerHTML);
</script> Simplifying "If no ads available"
We're continuously working to increase the quality and safety of our ad network and reduce the number of malicious ads that enter the AdSense network. As a result, we're removing the "If no ads available" option and we'll be defaulting to collapsing the ad space or showing a blank space instead. If your current setting is a color or another URL, it will be updated in the near future.
we'll be defaulting to collapsing the ad space or showing a blank space instead.
<data:post.body/> in the teplate. To have an ad appear below a post's main content and above the footer one places the ad code below each of those tags. Placing ad code above each of those tags makes it appear between the post's title and main content. <b:if cond='data:view.isPost'>
<div class='adsense-ads' id='adsenseads'>
<script async='async' src='https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js'/>
<ins class='adsbygoogle' data-ad-client='ca-pub-XXXXXXXXXXXXXXXX' data-ad-format='fluid' data-ad-layout='in-article' data-ad-slot='XXXXXXXXXX' style='display:block; text-align:center;'/>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</b:if> 'data:view' is defined in the Blogger template but unless your use is also defined the same way, then just using the <b:if cond='data:view.isPost'> element without its definitions and functions may not trigger the script as expected. I hope this is helpful.