Banner Spin phase 3: reports, health checks, postbacks verified, admin switch button
- bannerspin.js: every image load also counted raw per placement (bots/prefetch and servers/mail image proxies kept apart from views); one aggregation for the Stats tab and a new summary() for Reports: per banner (views, uniques, clicks, CTR, match rate, conversions), per placement with a "caches banners" flag, by Central day, country and device, bots shown separately; WINNER badge once two live banners have 1,000 views each and one leads on CTR. Click params now keep the banner macro (same list as spin links). Owner pause/resume clears an auto-pause; a new image or target resets health. - health.js: the 30-minute pass also checks each live banner: image must load as an image (magic bytes) at the Banner Spin size, target must pass the spin-link checks (a spin-link target only has to exist). 3 failures pause, 2 clean passes resume, the last live banner is never auto-paused; owner gets an inbox notice. checkBannerSpins() for admin. - server.js (own blocks): health.init gets bannerspin; /api/my/reports adds bannerSpins; POST /api/admin/bannerspins/health runs the checks now. - Builder: health line + AUTO-PAUSED tag on every banner row; Stats tab adds uniques, WINNER, CACHED placements, loads, country/device, bots line. - Reports screen: Banner Spin section + Banner views/clicks tiles beside spin links. - Admin > Member content: real Banner Spin on/off button (with confirm) and "Run banner checks". - Traffic-source postbacks on Banner Spin clicks verified end to end (network click id, event, payout, lsid reach the source postback). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -611,7 +611,24 @@
|
||||
if ($('ctFrom').value) sp.set('from', $('ctFrom').value); if ($('ctTo').value) sp.set('to', $('ctTo').value);
|
||||
if ($('ctFlagged').checked) sp.set('flagged', '1'); if (fresh === true) sp.set('fresh', '1');
|
||||
CT.data = await api('/api/admin/content?' + sp.toString()); drawContent();
|
||||
loadBsSwitch().catch(e => { $('bsSwitchState').textContent = 'could not load'; });
|
||||
}
|
||||
// ── Banner Spin feature switch (2026-10-20): the button for POST /api/admin/bannerspins { off }, plus "run the checks now" ──
|
||||
async function loadBsSwitch() {
|
||||
const r = await api('/api/admin/bannerspins'); const off = !!(r.settings && r.settings.off); const t = r.totals || {};
|
||||
$('bsSwitchState').className = 'st ' + (off ? 'rejected' : 'active'); $('bsSwitchState').textContent = off ? 'switched off' : 'live';
|
||||
const b = $('bsSwitchBtn'); b.textContent = off ? 'Switch Banner Spin back on' : 'Switch Banner Spin off'; b.dataset.off = off ? '1' : '0'; b.className = 'btn small' + (off ? '' : ' sec'); b.disabled = false;
|
||||
$('bsSwitchNote').textContent = (off ? 'Off: every placement shows a neutral blank image and clicks go to each fallback. ' : 'Live. Switching it off blanks every member\'s Banner Spin at once (a neutral blank image, clicks to each fallback). ')
|
||||
+ ctN(t.spins) + ' Banner Spin' + (t.spins === 1 ? '' : 's') + ', ' + ctN(t.banners) + ' banners. Members keep everything; it comes back exactly as it was.';
|
||||
}
|
||||
$('bsSwitchBtn').addEventListener('click', busy($('bsSwitchBtn'), async () => {
|
||||
const turnOff = $('bsSwitchBtn').dataset.off !== '1';
|
||||
if (turnOff && !await IAP.confirmBox('Switch Banner Spin off for every member? Every placement shows a blank image until you switch it back on.', { title: 'Switch Banner Spin off', ok: 'Switch it off', cancel: 'Keep it on' })) return;
|
||||
await api('/api/admin/bannerspins', { off: turnOff }, 'POST'); IAP.status(turnOff ? 'Banner Spin is switched off.' : 'Banner Spin is live again.', 'ok'); await loadBsSwitch();
|
||||
}));
|
||||
$('bsHealthBtn').addEventListener('click', busy($('bsHealthBtn'), async () => {
|
||||
const r = await api('/api/admin/bannerspins/health', {}, 'POST'); IAP.status('Checked ' + ctN(r.checked) + ' banner' + (r.checked === 1 ? '' : 's') + '.', 'ok'); await loadContent(true);
|
||||
}));
|
||||
const ctReload = (fresh) => loadContent(fresh).catch(e => IAP.status(e.message, 'bad'));
|
||||
$('ctQ').addEventListener('input', () => { clearTimeout(CT.timer); CT.timer = setTimeout(() => { CT.page = 1; ctReload(); }, 250); });
|
||||
['ctFrom', 'ctTo', 'ctFlagged'].forEach(id => $(id).addEventListener('change', () => { CT.page = 1; ctReload(); }));
|
||||
|
||||
Reference in New Issue
Block a user