Banner Spin phase 4: chatbot, training lesson, promo tools, release note draft, QA

- chatbot.js: canned Banner Spin answer (ahead of the ad-edit and spin-link answers) + FACTS (what it is, tiers, embeds, matching, Gmail and paid-network limits, reports, health); KNOWLEDGE_DATE 2026-10-20.
- Training: catalog/training.json ships a written Banner Spin lesson, appended to /api/training unless the volume list has the same id; lesson text keeps its paragraphs (pre-line).
- Promo tools: "What is Banner Spin?" in the objection bank + an X post.
- docs/release-drafts/2026-10-20-banner-spin.json: release note in the releases store shape, NOT published.
- qa/bannerspin.mjs: health auto-pause/resume with a corrupted upload, a dead target and the last-live rule; winner; bots/servers apart; caches flag; source postback; Reports API + screen; admin switch button; chatbot; training; promo; draft. 75/75.
- Cache tags bumped: banner-spin.js, reports.js, admin.js, my.js, promo.js (20261020bs3).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-20 05:39:52 -05:00
parent f93bca81a7
commit d9342d8141
7 changed files with 1188 additions and 1023 deletions
+9
View File
@@ -0,0 +1,9 @@
[
{
"id": "banner-spin",
"group": "Banner Spin",
"title": "Banner Spin: one banner slot, a whole campaign",
"desc": "Banner Spin gives you one image address and one click address that rotate up to 25 banners, each with its own target page or spin link. Put it in one banner slot on a traffic exchange, a safelist, a forum signature or your own site once, then change the banners from your Control Room whenever you like. Nobody has to update anything on their side.\n\nWho gets it. It is a free add-on that opens with your own package of $25 or more. Starter holds 2 Banner Spins with 5 banners each. Builder (level 2 open, 2 qualifying buyers) holds 5 with 15 each. Leader (level 3 open, 5 qualifying buyers) holds 10 with 25 each. If you drop below a tier, everything you built keeps serving; you just cannot add more until you are back.\n\nStep 1, name and size. Open Links, switch to Banner Spins and press New Banner Spin. Pick one size: a slot on an exchange has one size, so every banner in a Banner Spin should be that exact size (468x60, 728x90, 300x250, 125x125, 160x600, 120x600, 336x280, 250x250 or 320x50). Set a fallback page: that is where a click goes when we cannot tell which banner the visitor saw.\n\nStep 2, add banners. Upload a JPG, PNG or GIF (animated is fine, 150 KB at most) or paste an https image address. The builder previews it at real size and warns you when it is the wrong size. Pick where a click goes: any page, or one of your own spin links, so a banner can rotate pages behind it too.\n\nStep 3, weights and mode. A banner with weight 20 shows twice as often as one with 10. Random by weight picks again on every view. One per visitor shows the same person the same banner all day, which keeps a split test clean on exchanges that reload pages. You can also give the whole Banner Spin, or one banner, its own hours.\n\nStep 4, get the code. Open Get the code and copy the embed that fits the place: the image address plus click address for exchanges, safelists and downline builders; the HTML snippet for your own site or blog; the script tag wherever scripts are allowed (it writes the banner and its own link together, so every click lands on the right target); the forum code for signatures. Every link domain answers every code, so if one domain ever has trouble you swap only the domain.\n\nWhere it will not rotate. Paid ad networks copy your image to their own servers when you upload a creative, so it freezes on one banner there: upload real banners to them instead. Gmail and some mail apps fetch images once through their own proxy, so most email readers see one banner and their clicks go to the fallback. For email, use a Banner Spin with a single banner (still tracked) and swap it when you want a change.\n\nReading the numbers. The Stats tab and the Reports screen show views, unique viewers, clicks, click rate, match rate and conversions for every banner and every placement (the page your banner sits on), by day, country and device. Bots, link previews and servers are never counted as views; they are shown on their own line. A WINNER badge appears once two or more live banners have 1,000 views each and one leads on click rate. LinkSpin never changes your weights for you: raise the winner or pause the rest when you are ready. A placement marked CACHED copies banners to its own server, so the rotation is frozen there; spend your credits elsewhere.\n\nHealth checks. Every 30 minutes LinkSpin checks each live banner: the image must load as an image of the right size, and its target must not be dead or parked. Three failures in a row pause that banner and it comes back on its own after two clean checks. The last live banner in a Banner Spin is never paused. You see the status on every banner row.\n\nTeach it forward. When someone in your line buys their first $25 package, show them this lesson and help them build their first Banner Spin with two banners for the same offer. Two weeks of numbers tell them which banner to keep.",
"docUrl": "/links#b"
}
]
+5 -1
View File
@@ -16,7 +16,7 @@ let DATA_DIR = null;
let chain = null;
const MODEL = process.env.OPENROUTER_MODEL || 'deepseek/deepseek-v4-flash:nitro';
const CONTRACT = '0x26Bdc556b94399bEdd69ae3ACA5aA6c54D946e8b';
const KNOWLEDGE_DATE = '2026-10-18'; // the day the CANNED answers and FACTS below were last checked against the site
const KNOWLEDGE_DATE = '2026-10-20'; // the day the CANNED answers and FACTS below were last checked against the site
function init(opts) { DATA_DIR = opts.dataDir; chain = opts.chain; }
function key() {
@@ -31,6 +31,9 @@ const SUPPORT_RE = /(contact|reach|email|e-mail|message|talk to|speak (to|with)|
const CANNED = [
{ re: SUPPORT_RE, handoff: true,
a: 'Open Help in your Control Room (' + SITE_URL + '/help) to send Marty a ticket, and his replies land right there and in your email. Not signed in or locked out? Use ' + SITE_URL + '/support. You can also tap "Send this to support" below and I will pass this chat along.' },
// Banner Spin (2026-10-20), ahead of the ad-editing and spin-link answers, which also match "banner" and "rotate"
{ re: /banner ?spins?\b|rotat\w* (my |several |multiple |many |a few |\d+ )?banners|banners? rotat|(one|single) (image|banner) (url|address|link)/i,
a: 'Banner Spin gives you one image address and one click address that rotate up to 25 banners, each with its own target page or spin link, so one banner slot on a traffic exchange, safelist, forum or your own site carries a whole campaign. It is a free add-on that opens with your own package of $25 or more: Starter holds 2 Banner Spins of 5 banners, Builder (level 2 open, 2 qualifying buyers) 5 of 15, Leader (level 3 open, 5 qualifying buyers) 10 of 25. Build it under Links, Banner Spins (' + SITE_URL + '/links#b) and copy one of four embeds: the image + click pair for exchanges and safelists, the HTML snippet for your site, the script tag (it writes the banner and its own link, so every click matches exactly) or the forum code. A click goes to the banner that visitor saw; one we cannot match goes to your fallback. It will not rotate inside paid ad networks (they copy the image when you upload a creative) or in Gmail (its image proxy keeps one copy), so use a single-banner Banner Spin for email. The Stats tab and Reports show views, clicks, CTR, match rate and conversions per banner and per placement, a WINNER badge once two banners have 1,000 views each, and a CACHED flag on sites that copy banners. Every live banner is checked every 30 minutes and paused after three failed checks, never the last live one.' },
{ re: /\b(fix|change|edit|update|correct|replace|wrong|broken|typo)\b.{0,40}\b(link|url|image|banner|picture|headline|text|name)\b.{0,30}\b(ad|ads|campaign|campaigns|banner)\b|\b(edit|fix|change|update) (my |an |the |this )?(ad|ads|campaign|banner|login ad|text ad)\b/i,
a: 'Open Ads in your Control Room (' + SITE_URL + '/ads) and press Edit on the ad. You can change where the click goes, the banner image (upload a new one or paste a link), the headline and line of a text ad, and the ad name. A login ad shows your page itself, so its link is the whole ad. The first edit of every ad is free, your one correction; each edit after that costs a small credit fee (100 credits at the moment, shown before you save), taken from earned credits first. The type, size, budget, countries, schedule and audience stay as they are; for those, start a new ad. A new link is checked the same way as a new ad, so it has to load and, for banner and text ads, allow framing.' },
{ re: /(log ?-?in|sign ?-?in) (ad|ads|spot|sponsor|slot|slots)|(ad|sponsor) (on|at) (the )?(log ?-?in|sign ?-?in)/i,
@@ -97,6 +100,7 @@ function systemPrompt() {
FACTS:
- PRODUCT, all free with an email account: SPIN LINKS (the rotator: one short link, /r/<code>, rotates between destinations by weight; pause any destination; a fallback for when all are off; one-hop redirect; every click recorded with day, country, source, device and a daily-salted visitor hash; bots filtered on the server; click ids and sub ids such as clickid, subid, s1 to s4 pass through to the destination; split tests by tagging the same link with different sub ids; a demo spin on the home page needs no account; DAYPARTING is live: a 7x24 hours grid per spin and per destination, time zone by name or the local time of the visitor, presets, and 'my best hours' from the clicks of the member after 200 clicks; automatic HEALTH CHECKS are live: every destination is checked every 30 minutes, a dead or parked one is paused after three failing checks and resumed when it passes twice, the owner is told once, and Check now runs it on demand). PAGES (page builder: scan any offer URL, get a bridge, review or squeeze page; designs, palettes, layouts and niche presets with hero images; leads to the member's own list, CSV or webhook; published on the pages domain lookfirst.page; sales, advertorial and press-release layouts are coming). ZONES (an ad slot on the member's own site: one async script tag, nine sizes 728x90, 468x60, 300x250, 336x280, 250x250, 125x125, 160x600, 120x600, 320x50; waterfall = LinkSpin member campaign, then a network ad for 728x90 and 468x60, then the LinkSpin house banner; pays ad credits per VIEWABLE impression, half the banner on screen for one second, bots never, 50 credited views per visitor per zone per day; rates 1 credit per 5 viewable member-ad views and 1 per 10 network-ad views, 1 per 8 on a Verified zone; warm-up: a zone earns after its first 100 on-site views with at least 40 percent viewable and goes on hold below that; origin lock: paid ads serve only on the declared site and its subdomains, elsewhere the house banner shows and nothing is earned; up to 50 zones per account; PUBLISHER PROGRAM at /publishers for site owners, tiers Standard (default) and Verified (admin-reviewed site, better network rate)). AUDIENCES (first-party retargeting: "My visitors" collects everyone who viewed the member's pages and zones for 30 days; a pixel tag /p.js for other sites; campaigns can "show only to" or "never show to" an audience; nothing personal stored). PROMO TOOLS at /tools#promo (social posts, text-a-friend, email swipes, banners, objection bank, hook videos; five hook angles with videos: links, pages, zones, audiences, stack; angle links are the invite link plus ?v=). REPORTS (every link in one view, plus Pages, Zones, and since 2026-10-12 Traffic sources and Placements). BLOG at /blog with RSS at /blog/feed.xml. TRAFFIC SOURCES at /sources (2026-10-12): a source is a record of a network the member buys traffic on, created from a catalog of networks (PropellerAds, Zeropark, Adsterra, ExoClick, HilltopAds, TrafficStars, PopAds and more, with each network's macro tokens and conversion postback URL; account-specific slots such as a goal id are filled in at creation) or defined by hand; a spin link is pointed at one source (Share kit on the Links screen, or the Sources screen), and then the Share kit's first row is the exact campaign URL for that network with its macros already in place; when a click that came through that source converts (join, lead, wallet, purchase, or a partner-reported conversion; the member picks which) LinkSpin fires that network's own postback with the network's click id and the payout, server to server, and only the network that sent the click is told; Reports show clicks, uniques and conversions by source and by placement (the value the network's zone, placement, site, campaign, creative, banner or keyword macro carried); up to 30 sources per account, 20 params each; a source with no postback still builds the campaign URL and shows in Reports; the account-level Postbacks list on the Links screen (for the member's own tracker) still works alongside. Knowledge checked on ${KNOWLEDGE_DATE}.
- BANNER SPIN (LIVE 2026-10-18, reports and health checks 2026-10-20): one image address (/i/<code>.gif on a link domain) and one click address (/c/<code>) that rotate up to 25 banners, each with its own target (any https page or one of the member's spin links), weights 1 to 100, random by weight on every view or one banner per visitor per day, the dayparting grid per Banner Spin and per banner, pause, a fallback page and an optional fallback banner image, and a traffic source so its conversions fire that network's postback. Built on the Links screen (${SITE_URL}/links#b). WHO GETS IT: a free add-on for members with their own package of $25 or more; tiers: Starter 2 Banner Spins x 5 banners, Builder (level 2 open, 2 qualifying buyers) 5 x 15, Leader (level 3 open, 5 qualifying buyers) 10 x 25; dropping below a tier keeps everything serving, it only stops new ones. One size per Banner Spin (468x60, 728x90, 300x250, 125x125, 160x600, 120x600, 336x280, 250x250, 320x50); JPG, PNG or GIF (animated is fine), 150 KB at most, uploads count toward the 10 files a day. EMBEDS: the image + click pair (traffic exchanges, safelists, downline builders), an HTML snippet (own sites, blogs, HTML email), a script tag (writes the banner and its own link, so every click matches exactly) and forum BBCode; every link domain answers every code. MATCHING: with the pair, the server remembers which banner a visitor saw on which page for 15 minutes and sends the click there; an unmatched click goes to the fallback. LIMITS: paid ad networks (Froggy, PropellerAds and the like) copy the image at upload, so it freezes on one banner there; Gmail and some mail apps fetch images through a caching proxy, so email readers mostly see one banner and clicks fall back: use a single-banner Banner Spin for email. REPORTS: per banner and per placement views, unique viewers (daily sample), clicks, CTR, match rate and conversions, by Central day, country and device, bots and server loads shown separately and never counted; a WINNER badge once two or more live banners have 1,000 views each and one leads on click rate (LinkSpin never changes weights by itself); a CACHED flag on a placement that copies banners to its own server; totals also on the Reports screen. HEALTH: every 30 minutes each live banner's image must load as an image of the right size and its target must pass the spin-link checks (dead, parked, slow); three failures in a row pause that banner, two clean passes resume it, the last live banner is never auto-paused, and the status shows on each banner row.
- PACKAGES (priced in dollars, settled in POL at the live rate, 1 credit = 1 cent of ad delivery): $10 door = 1,000 credits, for trying the ads, does NOT count toward qualification; $25 Starter = 2,500; $50 Builder = 5,000; $100 Growth = 10,000; $250 Leader = 25,000; $500 Network = 50,000. Any package of $25 or more makes the buyer a qualifying buyer for their sponsor.
- THE SPLIT, same transaction on Polygon, fixed in the contract: 50 percent direct sponsor, 20 percent level 2, 10 percent level 3, 10 percent + 10 percent to the two admin wallets. Level 1 pays from a referral's first qualifying purchase once the sponsor's payouts are on. Level 2 opens after two of the member's people buy a qualifying ($25 or larger) package, level 3 after five. An unfilled tier passes up the line to the next qualified member, then to the platform. Nothing is held, there are no withdrawals, no pending balances. Contract ${CONTRACT} on Polygon, verified on Polygonscan; plain-language review at ${SITE_URL}/contract; live ledger at ${SITE_URL}/ledger with a verify link on every row.
- CREDITS VS POL: every member, free ones included, earns CREDITS (zones, the daily ad set with a claim streak, watch-to-earn videos, verified visits, a daily sign-in bonus). Credits buy the member's own banner and text ads (a login-ad slot takes purchased credits only) and NEVER cash out or convert to crypto. POL only reaches a wallet through the contract split when a package sells in the member's line. Never promise or estimate income.
@@ -0,0 +1,7 @@
{
"_draft": "NOT PUBLISHED. Release note in the releases.json note shape (releases.saveNote: date, title, body, tags). To publish: Admin > Releases > New note, paste title + body, tags new. Saving a note there publishes it on /whats-new at once, and Releases > Email an update can mail members, so Marty decides when.",
"date": "2026-10-20",
"title": "Banner Spin: one banner slot, up to 25 banners",
"tags": "new",
"body": "Banner Spin is live on the Links screen. It gives you one image address and one click address that rotate up to 25 banners, each with its own target page or spin link. Paste it once into a banner slot on a traffic exchange, a safelist, a forum signature or your own site, and change the banners from your Control Room whenever you like.\n\n- Four embeds: the image + click pair, an HTML snippet, a script tag that matches every click exactly, and forum code\n- A click goes to the page of the banner that visitor saw; one we cannot match goes to your fallback\n- Weights, one banner per visitor per day, hours, pause and a fallback banner\n- Stats per banner and per placement: views, unique viewers, clicks, click rate, match rate and conversions, by day, country and device, on the Stats tab and on Reports\n- A WINNER badge once two banners have 1,000 views each, and a CACHED flag on sites that copy banners to their own server\n- Health checks every 30 minutes: a banner whose image or target breaks three times in a row is paused, and comes back after two clean checks. Your last live banner is never paused\n- Conversions from a traffic source fire that network's postback, same as spin links\n\nWho gets it: a free add-on with your own package of $25 or more. Starter holds 2 Banner Spins with 5 banners each, Builder (2 qualifying buyers) 5 with 15, Leader (5 qualifying buyers) 10 with 25.\n\nGood to know: paid ad networks copy your image when you upload a creative, and Gmail keeps its own copy of email images, so the rotation does not run there. For email, use a Banner Spin with a single banner.\n\nThe new Training lesson walks through it step by step."
}
+1 -1
View File
@@ -418,7 +418,7 @@
if (it.videoUrl && !isVid) links.push('<a class="btn small sec" href="' + esc(it.videoUrl) + '" target="_blank" rel="noopener">Watch</a>');
if (it.docUrl) links.push('<a class="btn small sec" href="' + esc(it.docUrl) + '" target="_blank" rel="noopener">Open material</a>');
return head + '<div class="card"><h3>' + esc(it.title || 'Lesson') + '</h3>'
+ (it.desc ? '<p class="muted small">' + esc(it.desc) + '</p>' : '')
+ (it.desc ? '<p class="muted small" style="white-space:pre-line">' + esc(it.desc) + '</p>' : '') // pre-line: a written lesson keeps its paragraphs (Banner Spin, 2026-10-20)
+ (media ? '<p style="margin:10px 0">' + media + '</p>' : '')
+ (links.length ? '<p>' + links.join(' ') + '</p>' : '') + '</div>';
}).join('');
+3
View File
@@ -13,6 +13,7 @@ window.IAPPromo = (function () {
// ── social posts ──
const POSTS = [
{ net: 'X', label: 'X · Banner Spin', text: 'One banner slot on a traffic exchange, up to 25 banners rotating in it. LinkSpin Banner Spin: one image address, one click address, every click lands on the page of the banner that was shown, and the report tells you which banner wins. Free with your first $25 package: {{LINK:links}}' },
{ net: 'X', label: 'X · one link', text: 'I stopped juggling six affiliate links. One LinkSpin link now rotates every page I promote, with weights, hours and a fallback, and a report by source, country and device. Free, no account needed to try the spin: {{LINK}}' },
{ net: 'X', label: 'X · instant payout', text: 'No withdraw button. A verified contract on Polygon splits every ad package the second it sells: 50% to the sponsor, 20% to level 2, 10% to level 3, straight to wallets. Watch the ledger move: {{LINK}}' },
{ net: 'X', label: 'X · advertiser', text: 'Marketers: you were buying traffic anyway. Here the ad spend in your line pays you, in the same transaction, on a public ledger. Packages from $10. Join free: {{LINK:zones}}' },
@@ -43,6 +44,8 @@ window.IAPPromo = (function () {
// ── objection bank (truth + say this) ──
const OBJECTIONS = [
// Banner Spin (2026-10-20): the add-on that opens with the member's own $25 package
{ q: 'What is Banner Spin?', truth: 'One image address and one click address that rotate up to 25 banners, each with its own target page or spin link. The member pastes it once into a banner slot (traffic exchange, safelist, forum signature, their own site) and changes the banners from the Control Room. A click goes to the banner that visitor saw, unmatched clicks go to a fallback, and reports show views, clicks, click rate and conversions per banner and per placement, with a WINNER badge once two banners have 1,000 views each. It is a free add-on with the member\'s own package of $25 or more: Starter 2 Banner Spins x 5 banners, Builder (2 qualifying buyers) 5 x 15, Leader (5 qualifying buyers) 10 x 25. It does not rotate inside paid ad networks or Gmail, which keep their own copy of the image.', say: 'You know how every exchange gives you one banner slot? Banner Spin turns that slot into a rotation of up to 25 banners, each going to its own page, and tells you which one gets the clicks. Set it once, swap banners any time from your dashboard. It comes free with your first $25 package: {{LINK}}' },
{ q: 'What is a spin link?', truth: 'One short link on a LinkSpin link domain that rotates visitors through a list of destination pages by weight. Each destination can be paused, limited to hours of the day, capped per day, or pointed at a fallback. Clicks are reported by source, country and device, and tracker macros are filled on the way through. The rotator is free and needs no package.', say: 'It is one link that stands in for all of yours. You give it the pages you promote and how often each should show, and it rotates visitors through them. Pause a page, cap it, give it hours. Free, and you can try a spin before you even sign up: {{LINK}}' },
{ q: 'Which crypto do I get paid in?', truth: 'One coin, one network: POL, the native coin of Polygon. Packages are dollar-priced and settled in POL at the live Chainlink rate; every payout is sent as POL to the recipient\'s own Polygon wallet in the same transaction. No tokens, no other chains, no stablecoins.', say: 'You get paid in POL, which is Polygon\'s own coin, straight into your wallet the moment a package in your line sells. Any Polygon wallet works, SafePal, MetaMask, Phantom, and if you have never held crypto there is a card on-ramp inside the control room. {{LINK}}' },
{ q: 'Is this a pyramid scheme?', truth: 'There is a real product with no referral needed: the rotator, the page builder and the zone script are free tools, and the paid product is ad delivery at one cent per credit across seven live formats that members can watch serving. Sponsor payments are referral commissions written as constants in a verified contract, paid only when a real package sells. Nobody has to recruit, and joining costs nothing.', say: 'Fair question. Here is the test I use: is there something people would use with no referral involved? Here there is, and most of it is free: a link rotator, a page builder, an ad slot for your site. The paid product is advertising you can watch run. The sponsor split is a referral commission on those sales, fixed in a public contract. Join free and never refer anyone if you like. {{LINK:stack}}' },
+1018 -1018
View File
File diff suppressed because it is too large Load Diff
+145 -3
View File
@@ -2,6 +2,9 @@
// no DB, no mail key, devCode sign-in, no chain-writing keys), builds a Banner Spin with 3 banners through the Links
// screen UI, then plays simulated visitors against /i/, /c/ and /s/ on a link domain and checks matching, fallback,
// counters, headers, tier limits, URL tokens, conversions, the admin kill switch and the admin Member content pane.
// Phase 3 + 4 (2026-10-20): image health auto-pause / resume (a corrupted upload, a dead target, the last live banner),
// the winner badge, bots and servers kept apart, the "caches banners" flag, the traffic-source postback, the Reports
// screen, the admin Banner Spin switch button, the chatbot answer, the Training lesson, Promo tools and the release draft.
// node qa/bannerspin.mjs (from the site dir)
// Env: PORT (default 8961), PW (playwright package dir), SHOTS (screenshot dir, default D:/tmp/banner-spin)
import { pathToFileURL } from 'node:url';
@@ -98,6 +101,56 @@ try {
const lockedUp = await req('POST', '/api/my/bannerspins/upload?size=468x60', { cookie: cL, body: IMG.a, headers: { 'Content-Type': 'image/png' } });
check(lockedUp.status === 403, 'locked member cannot upload', String(lockedUp.status));
// ════ phase 3 (2026-10-20): image health checks + the winner badge, on the builder's own Banner Spin ════
// Runs first, before the scheduled health pass (2 minutes after boot), so only the admin "run checks" passes below count.
const AUTH = { Authorization: 'Bearer ' + ADMIN_PW };
const rotB = await req('POST', '/api/my/rotations', { cookie: cB, body: { name: 'Builder invite' } });
await req('POST', '/api/my/rotations/' + rotB.json.rotation.id + '/dest', { cookie: cB, body: { url: 'https://spin-dest.example/b', weight: 10 } });
const hsp = await req('POST', '/api/my/bannerspins', { cookie: cB, body: { name: 'Health test', size: '468x60', fallback: 'https://fallback.example/b' } });
const HID = hsp.json.spin.id, HCODE = hsp.json.spin.code;
const hImg = [png(468, 60, [250, 120, 0]), png(468, 60, [0, 200, 200]), png(468, 60, [120, 0, 200])]; const hByHash = {}; hImg.forEach((b, i) => { hByHash[sha(b)] = i + 1; });
const hUp = []; for (const b of hImg) hUp.push((await req('POST', '/api/my/bannerspins/upload?size=468x60', { cookie: cB, body: b, headers: { 'Content-Type': 'image/png' } })).json);
for (const [i, u] of hUp.entries()) await req('POST', '/api/my/bannerspins/' + HID + '/banner', { cookie: cB, body: i < 2 ? { image: u.url, link: rotB.json.rotation.id, label: 'H' + (i + 1), weight: 10 } : { image: u.url, target: 'https://nowhere.invalid/offer', label: 'H3 dead target', weight: 10 } });
const hFile = i => path.join(DATA, 'uploads', hUp[i].url.split('/').pop());
const hRun = async () => (await req('POST', '/api/admin/bannerspins/health', { headers: AUTH, body: { id: HID } })).json;
const hGet = async () => (await req('GET', '/api/my/bannerspins', { cookie: cB })).json.spins.find(x => x.id === HID);
const bOf = (sp, id) => sp.banners.find(b => b.id === id);
const hDesc = sp => sp.banners.map(b => b.id + ':' + (b.health ? b.health.state + '/' + b.health.fails : '-') + (b.active ? ' live' : ' off') + (b.autoPaused ? ' auto' : '')).join(', ');
const hr1 = await hRun(); let H = await hGet();
check(hr1 && hr1.checked === 3 && bOf(H, 1).health.state === 'ok' && bOf(H, 2).health.state === 'ok' && bOf(H, 3).health.state === 'dead' && bOf(H, 3).active, 'health: one pass checks image + target of every live banner (spin-link target ok, dead target failing, nothing paused yet)', (hr1 && hr1.checked) + ' checked; ' + hDesc(H));
const good1 = fs.readFileSync(hFile(0)), good2 = fs.readFileSync(hFile(1));
fs.writeFileSync(hFile(0), Buffer.from('this is not an image at all')); // simulate a broken image
await hRun(); await hRun(); H = await hGet();
check(!bOf(H, 3).active && bOf(H, 3).autoPaused && bOf(H, 1).active && bOf(H, 1).health.state === 'image' && bOf(H, 1).health.fails === 2, 'health: 3 failing checks in a row pause a banner (dead target), 2 do not (broken image so far)', hDesc(H));
await hRun(); H = await hGet();
check(!bOf(H, 1).active && bOf(H, 1).autoPaused && /not a readable image/.test(bOf(H, 1).health.note), 'health: a broken image is auto-paused on its 3rd failing check', hDesc(H) + ' · ' + bOf(H, 1).health.note);
let hSeenOff = 0; for (let i = 0; i < 30; i++) { const r = await req('GET', '/i/' + HCODE + '.gif', { host: LINK, ip: '10.20.0.' + i, referer: 'https://h.example/' }); const id = hByHash[sha(r.buf)]; if (id !== 2) hSeenOff++; }
check(hSeenOff === 0, 'auto-paused banners never serve (30 loads, all the one live banner)', hSeenOff + ' of 30 were not banner 2');
fs.writeFileSync(hFile(1), Buffer.from('broken too'));
await hRun(); await hRun(); await hRun(); H = await hGet();
check(bOf(H, 2).active && !bOf(H, 2).autoPaused && bOf(H, 2).health.fails >= 3 && /Kept live/.test(bOf(H, 2).health.note), 'health: the last live banner is never auto-paused', hDesc(H) + ' · ' + bOf(H, 2).health.note);
fs.writeFileSync(hFile(0), good1); fs.writeFileSync(hFile(1), good2); // the images are fixed
await hRun(); H = await hGet(); const oneClean = !bOf(H, 1).active;
await hRun(); H = await hGet();
check(oneClean && bOf(H, 1).active && !bOf(H, 1).autoPaused && bOf(H, 2).active && bOf(H, 2).health.state === 'ok' && !bOf(H, 3).active, 'health: 2 clean passes resume the auto-paused banner (1 is not enough); the dead target stays paused', hDesc(H));
const hLog = await req('GET', '/api/admin/bannerspins', { headers: AUTH });
check(hLog.status === 200 && hLog.json.spins.some(x => x.id === HID), 'admin Banner Spin list still answers after the checks');
// winner badge: no badge until two live banners have 1,000 views each and one leads on CTR
let wst = (await req('GET', '/api/my/bannerspins/' + HID + '/stats', { cookie: cB })).json;
check(!wst.winner && wst.banners.every(b => !b.winner), 'no winner badge before 1,000 views each', JSON.stringify(wst.banners.map(b => [b.id, b.imps, b.clicks])));
for (let i = 0; i < 40; i++) await req('GET', '/c/' + HCODE + '?x=' + (i < 30 ? 1 : 2), { host: LINK, ip: '10.21.0.' + i, ua: 'Mozilla/5.0 Clicker' + i, referer: 'https://h.example/' });
// 1,500 views each, added straight to the counters file the way a second app copy's flush would (read, add, write)
await sleep(6000);
const cFile = path.join(DATA, 'bannerspin-counts.json'); const cj = JSON.parse(fs.readFileSync(cFile, 'utf8'));
const ctToday = new Intl.DateTimeFormat('en-CA', { timeZone: 'America/Chicago', year: 'numeric', month: '2-digit', day: '2-digit' }).format(new Date());
const hd = cj.d[String(HID)] = cj.d[String(HID)] || {}; const hdd = hd[ctToday] = hd[ctToday] || { b: {}, h: {}, u: {} };
hdd.b['1'] = (hdd.b['1'] || 0) + 1500; hdd.b['2'] = (hdd.b['2'] || 0) + 1500; fs.writeFileSync(cFile, JSON.stringify(cj));
await req('GET', '/i/' + HCODE + '.gif', { host: LINK, ip: '10.22.0.1', referer: 'https://h.example/' }); // marks the counters dirty, so the next flush reads the file back
await sleep(6500);
wst = (await req('GET', '/api/my/bannerspins/' + HID + '/stats', { cookie: cB })).json;
check(wst.winner === 1 && wst.banners.find(b => b.id === 1).winner && !wst.banners.find(b => b.id === 2).winner, 'winner badge: banner 1 leads on CTR with 1,000+ views on both', JSON.stringify(wst.banners.map(b => [b.id, b.imps, b.clicks, b.ctr, b.winner])));
// a spin link of the starter's own, used as one banner's target
const rot = await req('POST', '/api/my/rotations', { cookie: cS, body: { name: 'Main invite' } });
await req('POST', '/api/my/rotations/' + rot.json.rotation.id + '/dest', { cookie: cS, body: { url: 'https://spin-dest.example/landing', weight: 10 } });
@@ -243,7 +296,8 @@ try {
check(saw1 === 0, 'one banner taken offline by admin never serves', saw1 + ' of 40');
await req('POST', '/api/admin/bannerspins/' + S.id, { headers: auth, body: { bannerId: 1, off: false } });
const adm = await req('GET', '/api/admin/content?type=bannerspin&fresh=1', { headers: auth });
check(adm.json && adm.json.items && adm.json.items.length === 1 && adm.json.items[0].detail.banners.length === 3 && adm.json.items[0].actions.length === 4, 'admin Member content lists the Banner Spin with its banners + actions', adm.json && JSON.stringify(adm.json.totals.bannerspin));
const admS = adm.json && adm.json.items && adm.json.items.find(x => x.id === String(S.id)); // the builder's health-test Banner Spin is listed too since phase 3
check(admS && adm.json.items.length === 2 && admS.detail.banners.length === 3 && admS.actions.length === 4, 'admin Member content lists the Banner Spin with its banners + actions', adm.json && JSON.stringify(adm.json.totals.bannerspin));
// ── one-per-visitor mode: the same banner all day ──
await req('POST', '/api/my/bannerspins/' + S.id, { cookie: cS, body: { mode: 'visitor' } });
@@ -267,6 +321,89 @@ try {
const bigUp = await req('POST', '/api/my/bannerspins/upload?size=468x60', { cookie: cS, body: IMG.big, headers: { 'Content-Type': 'image/png' } }).catch(e => ({ status: 'reset' }));
check(bigUp.status === 400 || bigUp.status === 'reset', 'server refuses an image over 150 KB', String(bigUp.status) + ' (' + IMG.big.length + ' bytes)');
// ════ phase 3: traffic-source postback end to end on a Banner Spin click ════
const srcR = await req('POST', '/api/my/sources', { cookie: cS, body: { name: 'QA Network', template: 'custom', params: [{ key: 'clickid', token: '{clickid}' }], postbackUrl: 'https://example.com/pb?cid={clickid}&ev={event}&pay={payout}&ls={lsid}', events: ['join', 'lead', 'purchase', 'external'] } });
const SRC = srcR.json && srcR.json.source;
const attach = SRC ? await req('POST', '/api/my/bannerspins/' + S.id, { cookie: cS, body: { sourceId: SRC.id } }) : null;
check(!!SRC && attach && attach.status === 200 && attach.json.spin.sourceId === SRC.id, 'a traffic source attaches to the Banner Spin', srcR.buf.toString().slice(0, 120));
const pc = await req('GET', clickPath + '?x=1&clickid=NET-777', { host: LINK, ip: '10.12.0.1', ua: 'Mozilla/5.0 Buyer', referer: 'https://forum-a.example/' });
const pls = /sub=(k[0-9a-f]{11})/.exec(pc.headers.location || '');
const convBefore = (await req('GET', '/api/my/bannerspins/' + S.id + '/stats', { cookie: cS })).json.totals.conversions;
const pin = pls ? await req('GET', '/pb/in?key=' + pb.key + '&lsid=' + pls[1] + '&event=sale&value=2.50') : null; // waits for the outbound postback (real network, example.com)
let slog = null; for (let i = 0; i < 20 && SRC; i++) { const g = await req('GET', '/api/my/sources/' + SRC.id, { cookie: cS }); slog = ((g.json && g.json.log) || [])[0] || null; if (slog) break; await sleep(500); }
check(pin && pin.status === 200 && slog && /cid=NET-777/.test(slog.url) && /ev=external/.test(slog.url) && /pay=2\.5/.test(slog.url) && slog.url.includes('ls=' + pls[1]), 'Banner Spin conversion fires the traffic source postback with the network click id, event, payout and lsid', slog ? slog.url + ' -> ' + (slog.ok ? 'delivered HTTP ' + slog.status : 'not delivered: ' + (slog.status || '') + ' ' + slog.note) : pin && pin.buf.toString().slice(0, 120));
const convAfter = (await req('GET', '/api/my/bannerspins/' + S.id + '/stats', { cookie: cS })).json.totals.conversions;
check(convAfter === convBefore + 1, 'that conversion is credited to the Banner Spin', convBefore + ' -> ' + convAfter);
// ════ phase 3: bots and servers kept apart, the "caches banners" flag ════
await sleep(6000); const stA = (await req('GET', '/api/my/bannerspins/' + S.id + '/stats', { cookie: cS })).json;
for (let i = 0; i < 8; i++) await req('GET', imgPath, { host: LINK, ip: '10.13.0.1', ua: 'Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)' }); // a mail image proxy, no referrer
for (let i = 0; i < 12; i++) await req('GET', clickPath, { host: LINK, ip: '10.14.0.' + i, ua: 'Mozilla/5.0 Exchange' + i, referer: 'https://cachex.example/surf' }); // an exchange showing its own copy: clicks, no views
await sleep(6500); const stB = (await req('GET', '/api/my/bannerspins/' + S.id + '/stats', { cookie: cS })).json;
check(stB.totals.imps === stA.totals.imps && stB.totals.serverLoads >= stA.totals.serverLoads + 8 && stB.totals.botLoads >= 10, 'image-proxy and bot loads are shown separately, never as views', 'views ' + stA.totals.imps + ' -> ' + stB.totals.imps + ', server loads ' + stB.totals.serverLoads + ', bot loads ' + stB.totals.botLoads);
const pCache = stB.placements.find(p => p.host === 'cachex.example'), pNone = stB.placements.find(p => p.host === '(none)'), pForum = stB.placements.find(p => p.host === 'forum-a.example');
const pSafe = stB.placements.find(p => p.host === 'safelist-c.example'); // more clicks than views in this test (clicks are not deduped) but every one matched: no flag
check(pCache && /frozen/.test(pCache.caches) && pNone && /server/.test(pNone.caches) && pForum && !pForum.caches && pSafe && !pSafe.caches, '"caches banners" flag on the copying exchange and the image proxy, not on a normal placement', JSON.stringify([pCache && pCache.caches, pNone && pNone.caches, pForum && pForum.caches]).slice(0, 300));
check(Array.isArray(stB.country) && stB.device.some(d => d.k === 'mobile') && stB.device.some(d => d.k === 'desktop') && stB.days.length >= 1 && stB.days[stB.days.length - 1].day === ctToday, 'stats break clicks down by country and device, days are Central time', JSON.stringify(stB.device) + ' last day ' + (stB.days.slice(-1)[0] || {}).day);
// ════ phase 3: the Reports screen (totals beside spin links, per banner, per placement) ════
const repS = (await req('GET', '/api/my/reports?days=30', { cookie: cS })).json;
const rb = repS && repS.bannerSpins;
check(rb && rb.count === 2 && rb.totals.imps === stB.totals.imps && rb.totals.clicks === stB.totals.clicks && rb.banners.some(b => b.spinId === S.id) && rb.placements.some(p => p.host === 'cachex.example' && p.caches) && repS.totals && repS.top, 'Reports API: Banner Spin totals match the Stats tab and sit beside the spin-link report', rb && JSON.stringify(rb.totals));
const repB = (await req('GET', '/api/my/reports?days=7', { cookie: cB })).json;
check(repB.bannerSpins && repB.bannerSpins.banners.some(b => b.spinId === HID && b.id === 1 && b.winner), 'Reports API: the winner badge shows on Reports too', repB.bannerSpins && JSON.stringify(repB.bannerSpins.banners.map(b => [b.id, b.imps, b.ctr, b.winner])));
await page.goto(BASE + '/reports', { waitUntil: 'domcontentloaded' }); await page.waitForSelector('#bsRowsB .rw', { timeout: 15000 }); await page.waitForTimeout(600);
check(await page.locator('#bsRowsP [data-caches="cachex.example"]').count() === 1 && /Banner views/.test(await page.textContent('#tiles')), 'Reports screen: Banner Spin section with the CACHED placement and the totals tiles');
await page.locator('#bsSect').scrollIntoViewIfNeeded(); await page.screenshot({ path: path.join(SHOTS, 'reports-desktop.png'), fullPage: true });
const ctxB = await browser.newContext({ viewport: { width: 1360, height: 950 } });
await ctxB.addCookies(cB.split('; ').map(kv => { const i = kv.indexOf('='); return { name: kv.slice(0, i), value: kv.slice(i + 1), domain: '127.0.0.1', path: '/' }; }));
const pB = await ctxB.newPage(); pB.on('pageerror', e => pageErrors.push('builder: ' + e.message));
await pB.goto(BASE + '/reports', { waitUntil: 'domcontentloaded' }); await pB.waitForSelector('#bsRowsB [data-winner]', { timeout: 15000 });
await pB.locator('#bsSect').scrollIntoViewIfNeeded(); await pB.screenshot({ path: path.join(SHOTS, 'reports-winner.png'), fullPage: true });
check(true, 'Reports screen shows the WINNER badge');
// the builder: health status on every banner row, the winner on the Stats tab
await pB.goto(BASE + '/links#b' + HID, { waitUntil: 'domcontentloaded' }); await pB.waitForSelector('#bsRows [data-bhealth]', { timeout: 15000 });
const rowsTxt = await pB.textContent('#bsRows');
check(await pB.locator('#bsRows [data-bhealth="ok"]').count() === 2 && await pB.locator('#bsRows [data-bhealth="paused"]').count() === 1 && /AUTO-PAUSED/.test(rowsTxt) && /Target page is down/.test(rowsTxt), 'builder shows each banner\'s health (2 OK, 1 auto-paused with the reason)', rowsTxt.replace(/\s+/g, ' ').slice(0, 300));
await pB.screenshot({ path: path.join(SHOTS, 'builder-health.png'), fullPage: true });
await pB.click('#bsTabs button[data-tab="stats"]'); await pB.waitForSelector('#bsStB [data-winner="1"]', { timeout: 10000 }); await pB.screenshot({ path: path.join(SHOTS, 'builder-stats-winner.png'), fullPage: true });
check(true, 'builder Stats tab shows the WINNER badge');
// ════ phase 4: the admin switch is a real button (Admin > Member content) ════
const ctxA = await browser.newContext({ viewport: { width: 1360, height: 950 } }); const pA = await ctxA.newPage(); pA.on('pageerror', e => pageErrors.push('admin: ' + e.message));
await pA.goto(BASE + '/admin#content', { waitUntil: 'domcontentloaded' });
await pA.fill('#adEmail', 'admin@bs.test'); await pA.click('#adSend'); await pA.waitForSelector('#adVerify:not([hidden])', { timeout: 10000 }); await pA.waitForFunction(() => document.getElementById('adCode').value.length > 0, null, { timeout: 10000 });
await pA.click('#adVerify'); await pA.waitForSelector('#pane-content:not([hidden])', { timeout: 15000 }).catch(async () => { await pA.click('.bo-menu [data-pane="content"]'); await pA.waitForSelector('#pane-content:not([hidden])', { timeout: 10000 }); });
await pA.waitForFunction(() => /Switch Banner Spin off/.test(document.getElementById('bsSwitchBtn').textContent) && !document.getElementById('bsSwitchBtn').disabled, null, { timeout: 15000 });
check(/live/.test(await pA.textContent('#bsSwitchState')), 'admin shows the Banner Spin switch, live', await pA.textContent('#bsSwitchState'));
await pA.click('#bsSwitchBtn'); await pA.waitForSelector('#dlgOk', { timeout: 5000 }); await pA.screenshot({ path: path.join(SHOTS, 'admin-switch-confirm.png') }); await pA.click('#dlgOk');
await pA.waitForFunction(() => /switched off/.test(document.getElementById('bsSwitchState').textContent), null, { timeout: 10000 });
await pA.screenshot({ path: path.join(SHOTS, 'admin-switch-off.png') });
const gOff = (await req('GET', '/api/admin/bannerspins', { headers: AUTH })).json.settings.off;
const offImg = await req('GET', imgPath, { host: LINK, ip: '10.15.0.1', referer: 'https://forum-a.example/' }); const offClk = await req('GET', clickPath, { host: LINK, ip: '10.15.0.1', referer: 'https://forum-a.example/' });
const memberSees = (await req('GET', '/api/my/bannerspins', { cookie: cS })).json.off;
check(gOff === true && blankOf(offImg) && expectTarget[0].test(offClk.headers.location || '') && memberSees === true, 'admin button switches Banner Spin off: blank image, fallback click, members see the notice', 'off=' + gOff + ' member off=' + memberSees + ' click ' + offClk.headers.location);
await pA.click('#bsSwitchBtn'); await pA.waitForFunction(() => /live/.test(document.getElementById('bsSwitchState').textContent), null, { timeout: 10000 });
const onImg = await req('GET', imgPath, { host: LINK, ip: '10.15.0.2', referer: 'https://forum-a.example/' });
const gOn = (await req('GET', '/api/admin/bannerspins', { headers: AUTH })).json.settings.off;
check(gOn === false && onImg.status === 200 && !blankOf(onImg), 'admin button switches it back on and banners serve again', 'off=' + gOn + ', image ' + onImg.status + ' ' + onImg.buf.length + ' bytes');
await pA.click('#bsHealthBtn'); await pA.waitForTimeout(1500); // the "run banner checks" button answers (it checks every Banner Spin)
await ctxA.close();
// ════ phase 4: chatbot, training, promo tools, release draft ════
const chat = await req('POST', '/api/chat', { body: { message: 'What is Banner Spin and how do I embed it?' } });
const ans = (chat.json && chat.json.reply) || '';
check(chat.json && chat.json.canned && /Banner Spin/.test(ans) && /\$25/.test(ans) && /Gmail/.test(ans) && /paid ad networks/.test(ans) && /25 banners/.test(ans) && !/—/.test(ans), 'chatbot: canned Banner Spin answer (tiers, embeds, Gmail + paid-network limits, no em dash)', ans.slice(0, 160));
const chat2 = await req('POST', '/api/chat', { body: { message: 'how do I edit my banner ad' } });
check(chat2.json && /Ads in your Control Room/.test(chat2.json.reply || ''), 'chatbot: the ad-editing answer still wins for "edit my banner ad"', (chat2.json.reply || '').slice(0, 80));
const tr = (await req('GET', '/api/training', { cookie: cS })).json;
const trB = (tr.items || []).find(x => x.id === 'banner-spin');
check(trB && /Gmail/.test(trB.desc) && /1,000 views/.test(trB.desc) && !/—/.test(trB.desc), 'Training lists the Banner Spin lesson', trB && trB.title);
const promoJs = (await req('GET', '/assets/promo.js')).buf.toString();
check(/What is Banner Spin\?/.test(promoJs) && /X · Banner Spin/.test(promoJs), 'Promo tools carry a Banner Spin entry (objection bank + social post)');
const rel = (await req('GET', '/api/releases')).json; const draft = JSON.parse(fs.readFileSync(path.join(site, 'docs', 'release-drafts', '2026-10-20-banner-spin.json'), 'utf8'));
check(draft.title && draft.body && !/—/.test(draft.body) && !(rel.notes || []).some(n => /Banner Spin/.test(n.title)), 'release note is a draft file only, not published', draft.title);
// ── phone width screenshots ──
const ph = await browser.newContext({ viewport: { width: 390, height: 844 }, deviceScaleFactor: 2, isMobile: true, hasTouch: true });
await ph.addCookies(cS.split('; ').map(kv => { const i = kv.indexOf('='); return { name: kv.slice(0, i), value: kv.slice(i + 1), domain: '127.0.0.1', path: '/' }; }));
@@ -277,8 +414,13 @@ try {
check(overflow <= 2, 'no horizontal page scroll at phone width', overflow + ' px');
await pp.click('#bsTabs button[data-tab="code"]'); await pp.screenshot({ path: path.join(SHOTS, 'builder-phone-code.png'), fullPage: true });
await pp.click('#bsTabs button[data-tab="stats"]'); await pp.waitForTimeout(800); await pp.screenshot({ path: path.join(SHOTS, 'builder-phone-stats.png'), fullPage: true });
await page.reload({ waitUntil: 'domcontentloaded' }); await page.waitForSelector('#bsSel:not([hidden])', { timeout: 15000 });
await page.click('#bsTabs button[data-tab="stats"]'); await page.waitForTimeout(1000); await page.screenshot({ path: path.join(SHOTS, 'builder-desktop-stats.png'), fullPage: true });
await page.goto(BASE + '/links#b' + S.id, { waitUntil: 'domcontentloaded' }); await page.waitForSelector('#bsSel:not([hidden])', { timeout: 15000 }); // the Reports step moved this page off /links
await page.click('#bsTabs button[data-tab="stats"]'); await page.waitForSelector('#bsStP [data-caches]', { timeout: 10000 }); await page.screenshot({ path: path.join(SHOTS, 'builder-desktop-stats.png'), fullPage: true });
check(await page.locator('#bsStP [data-caches="cachex.example"]').count() === 1 && /mobile/.test(await page.textContent('#bsStD')) && /server/.test(await page.textContent('#bsStBots')), 'builder Stats tab: CACHED placement, device breakdown, bots and servers line');
await pp.goto(BASE + '/reports', { waitUntil: 'domcontentloaded' }); await pp.waitForSelector('#bsRowsB .rw', { timeout: 15000 }); await pp.waitForTimeout(600);
await pp.screenshot({ path: path.join(SHOTS, 'reports-phone.png'), fullPage: true });
const rOverflow = await pp.evaluate(() => document.documentElement.scrollWidth - window.innerWidth);
check(rOverflow <= 2, 'Reports: no horizontal page scroll at phone width', rOverflow + ' px');
await page.click('#vsw button[data-v="links"]'); await page.waitForTimeout(800);
check(!(await page.isHidden('#ws')) && await page.isHidden('#bsWs'), 'switching back to Spin links works');
check(pageErrors.length === 0, 'no page errors in the builder', pageErrors.slice(0, 3).join(' | '));