From 7c79bc7cc05eb35a9a0309e5ef5eed0fa1b133a9 Mon Sep 17 00:00:00 2001 From: martbost Date: Thu, 12 Nov 2026 12:10:47 -0600 Subject: [PATCH] Join page records the ?src= tag in the first-touch source (Marty 2026-11-12: 'we need the source tag so we can know where these things come from'): joinedRef = / or just when the referrer was stripped; a tagged visit replaces an untagged 'direct' first touch; a real earlier source is kept. Co-Authored-By: Claude Opus 5.5 --- server.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server.js b/server.js index 8b8e2b4..6075d17 100644 --- a/server.js +++ b/server.js @@ -1582,7 +1582,13 @@ const server = http.createServer(async (req, res) => { { const lsid = String(u.searchParams.get('lsid') || u.searchParams.get('lsclk') || ''); if (/^[a-z0-9]{6,20}$/i.test(lsid)) set.push('ls.click=' + lsid + cookieTail); } // the rotator click that brought them (postback attribution); lsclk is what the landing tag carries from a bridge page (2026-11-07) const promo = promos.norm(u.searchParams.get('promo')); if (promo) set.push('iap.promo=' + promo + cookieTail); // partner code, redeemed at signup if (ang) set.push('iap.angle=' + angle + cookieTail); - if (!cookies['iap.ref']) set.push('iap.ref=' + encodeURIComponent(coach.refHost(req.headers.referer)) + cookieTail); // first-touch source + // first-touch source. A ?src= tag on the link (every mailer / traffic-source spin link carries one) is recorded with it, + // so a sign-up says "mailer.gold/mailergold" or just "mailergold" when the referrer was stripped (Marty, 2026-11-12: + // "we need the source tag so we can know where these things come from"). A tagged visit also replaces an untagged + // "direct" first touch, since the tag is the better answer. + { const srcTag = String(u.searchParams.get('src') || '').toLowerCase().replace(/[^a-z0-9_.-]/g, '').slice(0, 30); + const host = coach.refHost(req.headers.referer); const prev = decodeURIComponent(cookies['iap.ref'] || ''); + if (!prev || (srcTag && prev === 'direct')) set.push('iap.ref=' + encodeURIComponent(srcTag ? (host && host !== 'direct' ? host + '/' : '') + srcTag : host) + cookieTail); } return serveJoinPage(res, tok, ang ? angle : '', ang, set); } // -- legacy bridge: /from/faucetwave | /from/tieroneads [?seg=advertiser]. Same squeeze page