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:
@@ -20,7 +20,10 @@
|
||||
CR.tile({ k: 'Bots dropped', v: fmt(t.bots), series: sb, delta: CR.delta(b1, b0, 'vs prior'), note: t.served ? Math.round(t.bots / (t.served + t.bots) * 100) + '% of hits' : '' }),
|
||||
CR.tile({ k: 'Joins', v: fmt(t.joins), note: t.unique ? (t.joins / t.unique * 100).toFixed(1) + '% of unique' : '' }),
|
||||
CR.tile({ k: 'Buyers', v: fmt(t.purchases), hi: true, note: t.joins ? Math.round(t.purchases / t.joins * 100) + '% of joins' : '' }),
|
||||
CR.tile({ k: 'Partner conversions', v: fmt(t.external) })].join('');
|
||||
CR.tile({ k: 'Partner conversions', v: fmt(t.external) }),
|
||||
// Banner Spin totals beside spin links (2026-10-20)
|
||||
CR.tile({ k: 'Banner views', v: fmt(((s.bannerSpins || {}).totals || {}).imps), note: ((s.bannerSpins || {}).count || 0) + ' Banner Spin' + (((s.bannerSpins || {}).count || 0) === 1 ? '' : 's') }),
|
||||
CR.tile({ k: 'Banner clicks', v: fmt(((s.bannerSpins || {}).totals || {}).clicks), note: ((s.bannerSpins || {}).totals || {}).ctr != null ? s.bannerSpins.totals.ctr + '% CTR' : '' })].join('');
|
||||
const days = s.days || []; const dmax = Math.max(1, ...days.map(d => Math.max(d.u, d.b)));
|
||||
$('dayBars').style.gridTemplateColumns = 'repeat(' + Math.max(1, days.length) + ',minmax(0,1fr))';
|
||||
$('dayBars').innerHTML = days.map(d => '<i class="' + (days.length >= 3 && d.u === dmax && d.u ? 'hi' : d.u ? '' : 'dim') + '" style="height:' + Math.round(d.u / dmax * 100) + '%" title="' + d.day + ' · ' + d.u + ' unique, ' + d.b + ' bots"></i>').join('');
|
||||
@@ -52,6 +55,18 @@
|
||||
const ts = s.sources || [], pl = s.placements || [];
|
||||
$('tsRows').innerHTML = ts.length ? ts.map(x => '<div class="rw"><a href="/sources#' + esc(x.id) + '" style="text-decoration:none;color:var(--ink)"><b>' + esc(x.name) + '</b>' + (x.site ? '<br><span class="mono muted" style="font-size:11px">' + esc(x.site) + '</span>' : '') + '</a><span class="r num">' + fmt(x.hits) + '</span><span class="r num">' + fmt(x.unique) + '</span><span class="r num">' + fmt(x.conv) + (x.unique ? ' <span class="muted" style="font-size:10px">' + (x.conv / x.unique * 100).toFixed(1) + '%</span>' : '') + '</span></div>').join('') : '<div class="rw"><span class="muted">No clicks from a traffic source yet. Point a link at one under <a href="/sources">Sources</a>.</span></div>';
|
||||
$('plRows').innerHTML = pl.length ? pl.map(x => '<div class="rw"><span><b>' + esc(x.source) + '</b><br><span class="mono muted" style="font-size:11px">' + esc(x.key) + ' = ' + esc(x.k) + '</span></span><span class="r num">' + fmt(x.n) + '</span><span class="r num">' + fmt(x.conv) + '</span></div>').join('') : '<div class="rw"><span class="muted">Nothing yet. Placements appear once a source\'s zone or placement macro rides in on clicks.</span></div>';
|
||||
// -- Banner Spins (2026-10-20): views by Central day (bots and servers as the lighter bar), per banner with the winner, per placement with the cache flag
|
||||
const bs = s.bannerSpins || { totals: {}, days: [], banners: [], placements: [], country: [], device: [] }; const bt = bs.totals || {};
|
||||
// outer bar = views + bot / server loads, inner lighter share = the bot / server part
|
||||
dayBars('bsBars', 'bsAxis', bs.days, d => d.imps + (d.bots || 0) + (d.servers || 0), d => (d.bots || 0) + (d.servers || 0), 'no banner views yet');
|
||||
$('bsTiles').innerHTML = mini([['Views', fmt(bt.imps)], ['Clicks', fmt(bt.clicks)], ['CTR', bt.ctr == null ? '-' : bt.ctr + '%'], ['Match rate', bt.matchRate == null ? '-' : bt.matchRate + '%'], ['Unique (daily)', fmt(bt.uniques)], ['Conversions', fmt(bt.conversions)]]);
|
||||
$('bsCountry').innerHTML = kv(bs.country, 0); $('bsDevice').innerHTML = kv(bs.device, 0);
|
||||
$('bsBotNote').textContent = 'Never counted as views or clicks, shown here so you can see them: ' + fmt(bt.bots) + ' bot and prefetch image loads, ' + fmt(bt.serverLoads) + ' loads by servers or mail image proxies, ' + fmt(bt.botClicks) + ' bot clicks.';
|
||||
$('bsRowsB').innerHTML = (bs.banners || []).length ? bs.banners.map(x => '<div class="rw"><a href="/links#b' + x.spinId + '" style="text-decoration:none;color:var(--ink)"><b>' + esc(x.label) + '</b>' + (x.winner ? '<span class="bswin" data-winner="' + x.spinId + ':' + x.id + '">WINNER</span>' : '') + '<br><span class="mono muted" style="font-size:11px">' + esc(x.spin) + ' · ' + esc(x.size) + (x.autoPaused ? ' · <span class="warn">auto-paused</span>' : x.active ? '' : ' · paused') + '</span></a><span class="r num">' + fmt(x.imps) + '</span><span class="r num">' + fmt(x.uniques) + '</span><span class="r num">' + fmt(x.clicks) + '</span><span class="r num">' + (x.ctr == null ? '-' : x.ctr + '%') + '</span><span class="r num">' + fmt(x.conversions) + '</span></div>').join('')
|
||||
: '<div class="rw"><span class="muted">' + (bs.count ? 'No banners yet.' : 'No Banner Spins yet. <a href="/links#b">Make one</a> (opens with your own $25 package).') + '</span></div>';
|
||||
$('bsWinNote').textContent = 'WINNER = the best click rate in its Banner Spin once two or more live banners have ' + fmt(bs.winMin || 1000) + ' views each. Unique viewers are counted per day from a sample.';
|
||||
$('bsRowsP').innerHTML = (bs.placements || []).length ? bs.placements.slice(0, 15).map(x => '<div class="rw"><span style="overflow-wrap:anywhere"><b>' + esc(x.host === '(none)' ? 'No referrer (email, apps)' : x.host) + '</b>' + (x.caches ? ' <span class="tag warn">CACHED</span><span class="bscache" data-caches="' + esc(x.host) + '">' + esc(x.caches) + '</span>' : '') + '</span><span class="r num">' + fmt(x.imps) + '</span><span class="r num">' + fmt(x.clicks) + '</span><span class="r num">' + (x.ctr == null ? '-' : x.ctr + '%') + '</span><span class="r num">' + (x.matchRate == null ? '-' : x.matchRate + '%') + '</span></div>').join('')
|
||||
: '<div class="rw"><span class="muted">No placements yet. Put a Banner Spin\'s code on a page and its host shows here.</span></div>';
|
||||
const zn = s.zones || { byDay: [], byZone: [] };
|
||||
// bar = all views, lighter inner share = the ones that were NOT viewable
|
||||
dayBars('znBars', 'znAxis', zn.byDay, d => d.views, d => d.views - d.viewable, 'no zone views yet');
|
||||
|
||||
Reference in New Issue
Block a user