Traffic Desk: stop the network's counter drift showing as nonsense
Marty spotted rows where "left" exceeded "bought" — 3,521 remaining on a 2,500-impression purchase, with "served" reading 0 across those rows. Reproduced against the network: on 11 of 26 campaigns the ad app's own assigned/remaining counters have grown past what we inserted. We write assigned = remaining = the purchased amount; later both sit higher. Actively serving campaigns still reconcile exactly (served + remaining = bought), so our arithmetic is right and the inputs are drifting. The cause is inside the ionCube-encoded ad application, so there is nothing to fix at source. Direction matters: this is OVER-delivery. Members receive more impressions than their allowance and the ledger still only charges what they asked for, so nobody loses anything. The table now clamps both columns to what was actually bought, so a row always reconciles: served + left = bought. Showing a member more impressions remaining than they purchased reads as broken software, which costs more trust than the bonus impressions are worth. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+12
-2
@@ -175,6 +175,16 @@
|
||||
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.
|
||||
var bought = Number(c.bought != null ? c.bought : c.impressions) || 0;
|
||||
var rawLeft = l.remaining != null ? Number(l.remaining) : null;
|
||||
var left = rawLeft == null ? null : Math.max(0, Math.min(rawLeft, bought));
|
||||
var servedShown = left == null ? Number(served) : Math.max(0, bought - left);
|
||||
var statusCell = c.stopped
|
||||
? 'stopped <span style="opacity:.7">(' + Number(c.refunded || 0).toLocaleString() + ' returned)</span>'
|
||||
: (l.live ? '<span style="color:var(--teal)">running</span>' : 'finished');
|
||||
@@ -184,8 +194,8 @@
|
||||
tr.innerHTML = '<td>' + label + '</td>' +
|
||||
'<td>' + (c.target.indexOf('/p/') !== -1 ? 'personal page' : 'invite page') + '</td>' +
|
||||
'<td>' + Number(c.bought != null ? c.bought : c.impressions).toLocaleString() + '</td>' +
|
||||
'<td><b>' + Number(c.stopped ? (c.served || 0) : served).toLocaleString() + '</b></td>' +
|
||||
'<td>' + (c.stopped ? '—' : (l.remaining != null ? Number(l.remaining).toLocaleString() : '—')) + '</td>' +
|
||||
'<td><b>' + Number(c.stopped ? (c.served || 0) : servedShown).toLocaleString() + '</b></td>' +
|
||||
'<td>' + (c.stopped ? '—' : (left != null ? left.toLocaleString() : '—')) + '</td>' +
|
||||
'<td>' + (l.hits != null ? l.hits : '—') + '</td>' +
|
||||
'<td>' + statusCell + '</td>';
|
||||
var act = document.createElement('td');
|
||||
|
||||
Reference in New Issue
Block a user