From 726bc24e0980fb21fce47e107d0572a92e6d6dd0 Mon Sep 17 00:00:00 2001 From: martbost Date: Wed, 2 Sep 2026 06:22:16 -0500 Subject: [PATCH] =?UTF-8?q?Traffic=20Desk=20UI:=20trust=20the=20bridge's?= =?UTF-8?q?=20served=20figure=20=E2=80=94=20remove=20the=20count-up=20bann?= =?UTF-8?q?er=20branch=20here=20too?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- public/suite-traffic.js | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/public/suite-traffic.js b/public/suite-traffic.js index e3bac73..49b591e 100644 --- a/public/suite-traffic.js +++ b/public/suite-traffic.js @@ -174,29 +174,28 @@ campaigns.slice().reverse().forEach(function (c) { var l = byId[c.adId] || {}; var tr = document.createElement('tr'); - var served = l.served != null ? l.served : 0; - // The ad network's own counters sometimes drift ABOVE what we bought — - // its remaining has been observed at 3,521 on a 2,500 purchase. The cause - // is inside the ionCube-encoded ad app, so we cannot fix it at source; we - // can stop it rendering as nonsense. Clamp to what the member actually - // bought so the row always reconciles: served + left = bought. Any genuine - // over-delivery is a bonus to them and needs no explanation on this table. - // The network counts `remaining` DOWN for text ads and UP for banners — - // measured, not documented. Reading both the same way showed every banner - // as 0 served while it was quietly delivering thousands. + // The bridge computes served for us (assigned − remaining; `remaining` + // counts DOWN for BOTH ad kinds — the old "banners count up" theory made + // every fresh banner render as delivered-in-full the moment it launched). + // The network's counters also drift ABOVE what we bought (3,521 observed + // on a 2,500 purchase; cause is inside the ionCube-encoded ad app), so + // clamp to what the member bought: served + left = bought, always. Any + // genuine over-delivery is a bonus to them and needs no explanation here. var bought = Number(c.bought != null ? c.bought : c.impressions) || 0; - var rawRem = l.remaining != null ? Number(l.remaining) : null; var servedShown, left; if (c.completed || c.stopped) { - // Once a campaign is closed, trust what we recorded at the time. - // Deactivating an ad ZEROES `remaining` on the network — and for a - // banner, where that column counts UP, zero reads as "served nothing". - // Re-deriving here would wipe a finished campaign back to 0 served. + // Once a campaign is closed, trust what we recorded at the time — + // deactivating an ad ZEROES `remaining` on the network, so re-deriving + // from live counters would misreport a finished campaign. servedShown = Number(c.served != null ? c.served : bought) || 0; left = Math.max(0, bought - servedShown); - } else if (rawRem == null) { servedShown = Number(served) || 0; left = null; } - else if (c.kind === 'text') { left = Math.max(0, Math.min(rawRem, bought)); servedShown = bought - left; } - else { servedShown = Math.max(0, Math.min(rawRem, bought)); left = bought - servedShown; } + } else if (l.served != null) { + servedShown = Math.max(0, Math.min(Number(l.served) || 0, bought)); + left = bought - servedShown; + } else if (l.remaining != null) { + left = Math.max(0, Math.min(Number(l.remaining) || 0, bought)); + servedShown = bought - left; + } else { servedShown = 0; left = null; } // "running" with 0 left reads as broken. It is not: banners have no cap on // this network — the counter runs past the purchase and the ad keeps // serving until its expiry, so a fully-delivered banner is genuinely