Traffic Desk UI: trust the bridge's served figure — remove the count-up banner branch here too
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+17
-18
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user