[object Object]

← back to Allnewsdaily

Banner zones: auto-fallback house banner while AdSense unit is unfilled

e2504ec7270d57f537c2c511fa11218d54279be1 · 2026-09-09 14:35:45 -0700 · Steve

Site is in AdSense "Getting ready" (authorized Sep 3) so no real ads serve yet —
the zones were rendering as empty "Advertisement" boxes ("NO Ads"). Now each zone
carries the real <ins> AND a hidden house banner (links to /directory); a small
resolve script shows the house banner while data-ad-status is "unfilled"/collapsed
and swaps to the real ad the instant it fills. Verified in-browser: all 3 zones show
750x90 / 726x110 / 726x90 house banners when unfilled. Real slots stay in the DOM,
so the slot-guard canary still passes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PV1DXsyryWT3rLttpPXd4u

Files touched

Diff

commit e2504ec7270d57f537c2c511fa11218d54279be1
Author: Steve <steve@designerwallcoverings.com>
Date:   Wed Sep 9 14:35:45 2026 -0700

    Banner zones: auto-fallback house banner while AdSense unit is unfilled
    
    Site is in AdSense "Getting ready" (authorized Sep 3) so no real ads serve yet —
    the zones were rendering as empty "Advertisement" boxes ("NO Ads"). Now each zone
    carries the real <ins> AND a hidden house banner (links to /directory); a small
    resolve script shows the house banner while data-ad-status is "unfilled"/collapsed
    and swaps to the real ad the instant it fills. Verified in-browser: all 3 zones show
    750x90 / 726x110 / 726x90 house banners when unfilled. Real slots stay in the DOM,
    so the slot-guard canary still passes.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01PV1DXsyryWT3rLttpPXd4u
---
 server.js | 41 +++++++++++++++++++++++++++++++++++------
 1 file changed, 35 insertions(+), 6 deletions(-)

diff --git a/server.js b/server.js
index bbe3cd5..cb736ad 100644
--- a/server.js
+++ b/server.js
@@ -182,6 +182,26 @@ ${bannerAd('top')}
 })();
 </script>
 
+<script>
+// AdSense fallback: while a slot's <ins> is unfilled (e.g. site in "Getting ready"), show the
+// house banner; the instant a real ad fills, show the ad. Polls a few seconds to give AdSense time.
+(function(){
+  function resolveAds(){
+    var zones=document.querySelectorAll('[data-adzone]');
+    for(var i=0;i<zones.length;i++){
+      var z=zones[i], ins=z.querySelector('ins.adsbygoogle'),
+          real=z.querySelector('.ad-real'), fb=z.querySelector('.ad-fallback');
+      if(!ins||!fb) continue;
+      var st=ins.getAttribute('data-ad-status');
+      if(st==='filled'){ fb.hidden=true; if(real) real.hidden=false; }
+      else if(st==='unfilled' || ins.offsetHeight<40){ if(real) real.hidden=true; fb.hidden=false; }
+    }
+  }
+  var n=0, iv=setInterval(function(){ resolveAds(); if(++n>=8) clearInterval(iv); }, 1500);
+  window.addEventListener('load', resolveAds);
+})();
+</script>
+
 <footer class="foot">
   <nav><a href="/directory">Directory</a> · <a href="/guides">Guides</a> · <a href="/about">About</a> · <a href="/contact">Contact</a> · <a href="/privacy">Privacy</a></nav>
   <p>Topic lines are original one-sentence summaries written by All News Daily; every link goes to the source outlet's own reporting. All News Daily does not republish articles. &copy; ${new Date().getFullYear()} All News Daily.</p>
@@ -220,14 +240,21 @@ const ADSENSE = '<script async src="https://pagead2.googlesyndication.com/pagead
 // zone is visibly present without a wired slot. Wiring real slots needs an AdSense-portal step (gated).
 function bannerAd(pos) {
   const slot = pos === 'top' ? AD_SLOT_TOP : pos === 'mid' ? AD_SLOT_MID : AD_SLOT_BOTTOM;
+  // House banner — a real self-promo (links to the directory), shown as a fallback whenever the
+  // AdSense unit is unfilled (e.g. while the site is in AdSense "Getting ready"). It is NOT labeled
+  // "Advertisement" because it isn't a paid ad; the ad-resolve script (below the zones) swaps it out
+  // the instant a real ad fills the <ins>.
+  const house = `<a class="ad-house ad-fallback" href="/directory"${slot ? ' hidden' : ''}>`
+    + `<span class="ad-house-brand">ALL NEWS DAILY</span>`
+    + `<span class="ad-house-sub">The world's newsrooms on one page — explore the live directory →</span></a>`;
   if (slot) {
-    return `<div class="adzone adzone-${pos}"><div class="ad-label">Advertisement</div>`
-      + `<ins class="adsbygoogle" style="display:block" data-ad-client="${esc(AD_CLIENT)}" data-ad-slot="${esc(slot)}" data-ad-format="auto" data-full-width-responsive="true"></ins>`
+    return `<div class="adzone adzone-${pos}" data-adzone>`
+      + `<div class="ad-real"><div class="ad-label">Advertisement</div>`
+      + `<ins class="adsbygoogle" style="display:block" data-ad-client="${esc(AD_CLIENT)}" data-ad-slot="${esc(slot)}" data-ad-format="auto" data-full-width-responsive="true"></ins></div>`
+      + house
       + `<script>(adsbygoogle=window.adsbygoogle||[]).push({});</script></div>`;
   }
-  return `<div class="adzone adzone-${pos} adzone-house"><div class="ad-label">Advertisement</div>`
-    + `<div class="ad-house"><span class="ad-house-brand">ALL NEWS DAILY</span>`
-    + `<span class="ad-house-sub">Premium banner placement — 970×90 · 728×90 · responsive</span></div></div>`;
+  return `<div class="adzone adzone-${pos} adzone-house">${house}</div>`;
 }
 const FRONT_CSS = `
 :root{--ink:#111;--link:#0000cc;--vis:#551a8b;--red:#c00;--rule:#000;--bg:#f8f7f2;--src:#6a6a6a}
@@ -272,7 +299,9 @@ main{max-width:1180px;margin:0 auto;padding:0 12px 60px}
 .adzone{max-width:1180px;margin:14px auto;padding:9px 12px 12px;border:1px dashed #cbc9bf;background:#efeee7}
 .adzone-top{margin-top:8px}
 .ad-label{font:11px/1 Arial,Helvetica,sans-serif;text-transform:uppercase;letter-spacing:1.6px;color:#9a978c;text-align:center;margin-bottom:8px}
-.ad-house{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;min-height:90px;background:repeating-linear-gradient(45deg,#f7f6f0,#f7f6f0 12px,#f1efe6 12px,#f1efe6 24px);border:1px solid #dddacd}
+.ad-house{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;min-height:90px;background:repeating-linear-gradient(45deg,#f7f6f0,#f7f6f0 12px,#f1efe6 12px,#f1efe6 24px);border:1px solid #dddacd;text-decoration:none;color:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}
+.ad-house:hover{border-color:#c9b79a;background:repeating-linear-gradient(45deg,#f4f2e9,#f4f2e9 12px,#eceadf 12px,#eceadf 24px)}
+.ad-house .ad-house-sub{text-decoration:none}
 .adzone-mid .ad-house{min-height:110px}
 .ad-house-brand{font:800 22px/1 'Times New Roman',Times,serif;letter-spacing:1.5px;color:#111;text-transform:uppercase}
 .ad-house-sub{font:12px/1 Arial,Helvetica,sans-serif;color:#8a8779}

← 0de1cad Re-instate portal-VERIFIED AdSense slots (revert of 345ef9e'  ·  back to Allnewsdaily  ·  /directory UX pass: fix dead logos, tool-first layout, live- 60e002d →