Tracked network links (Marty 2026-11-14: "make sure each of these sites is its own traffic source and link spun so we can track it"). netsites.js: /api/network-sites adds go = the LinkSpin network link for each site with ?src=<this site> (linkspin.app/r/nwiap|nwls|nwdlb|nwvbb|nwsp|nwec, fixed codes on Marty's LinkSpin account), this site found by NETWORK_SITE_ID or the request host; the footer uses go (rel nofollow), plain url as fallback. Promo kit: every link gets a tracked twin (linkspin.app/r/nwdlb?src=dlb&s1=<member>&s2=<page>, lands on the same page with ?ref=<member>), trackedTemplate; /promote shows both with one plain line. Same netsites.js in all five sites. common.js?v=20261114ns, kitpage.js?v=2. Smoke 123/123

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-14 11:38:01 -06:00
parent ae850b1d44
commit e4a7fa64c1
16 changed files with 46 additions and 20 deletions
+22 -2
View File
@@ -32,9 +32,29 @@ function refresh() {
return inflight;
}
function list() { if (Date.now() - cache.at > TTL) refresh(); return cache.list; }
// Tracked links (Marty 2026-11-14: "make sure each of these sites is its own traffic source and link spun so we can track it"): each
// entry also gets go = the LinkSpin network link for that site with ?src=<this site>, so a click shows in LinkSpin Reports under the
// site that sent it (LinkSpin netlinks.js: fixed codes on the admin account). This site = NETWORK_SITE_ID, else the request host.
// No go for this site itself, or when this site cannot be told (a test host): the page then uses the plain url.
const CODES = { iap: 'nwiap', linkspin: 'nwls', dlb: 'nwdlb', vbb: 'nwvbb', stackpol: 'nwsp', earnerscorner: 'nwec' };
const linksBase = () => String(process.env.NETWORK_LINKS_BASE || 'https://linkspin.app').trim().replace(/\/+$/, '');
const hostOf = u => { try { return new URL(u).hostname.toLowerCase().replace(/^www\./, ''); } catch (e) { return ''; } };
function selfId(req, l) {
const env = String(process.env.NETWORK_SITE_ID || '').trim().toLowerCase(); if (env) return env;
const h = String((req && req.headers && (req.headers['x-forwarded-host'] || req.headers.host)) || '').split(',')[0].trim().toLowerCase().replace(/:\d+$/, '').replace(/^www\./, '');
const m = h && (l || list()).find(s => hostOf(s.url) === h); return m ? m.id : '';
}
// the LinkSpin-tracked link to site `id` sent from site `from` (from = id: the site's own promo kit); extra = { s1: member username, s2: one path segment }
function tracked(id, from, extra) {
const code = CODES[id]; if (!code || !from) return '';
const q = new URLSearchParams({ src: from }); for (const [k, v] of Object.entries(extra || {})) if (v) q.set(k, String(v));
return linksBase() + '/r/' + code + '?' + q.toString();
}
function withGo(l, me) { return l.map(s => { const go = me && s.id !== me ? tracked(s.id, me) : ''; return go ? Object.assign({}, s, { go }) : s; }); }
// GET /api/network-sites: public, cacheable, the same answer on every page
function handle(req, res) {
const l = list();
res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'public, max-age=300', 'X-Content-Type-Options': 'nosniff' });
res.end(JSON.stringify(list()));
res.end(JSON.stringify(withGo(l, selfId(req, l))));
}
module.exports = { list, handle, refresh, FALLBACK, _state: () => cache };
module.exports = { list, handle, refresh, tracked, selfId, withGo, CODES, FALLBACK, _state: () => cache };
+7 -4
View File
@@ -9,6 +9,7 @@
const fs = require('fs');
const path = require('path');
const C = require('./config').get();
const netsites = require('./netsites'); // tracked links: LinkSpin network link for this site, ?src=<this site> (2026-11-14)
const KIT_DIR = path.join(__dirname, 'public', 'art', 'kit');
const SHAPES = { tile: [125, 125, 'Square button'], strip: [468, 60, 'Strip (board size)'], leader: [728, 90, 'Leaderboard'], box: [300, 250, 'Box'],
@@ -72,15 +73,17 @@ function kit(u) {
const q = ref ? '?ref=' + encodeURIComponent(ref) : '';
const link = base() + '/' + q;
const fill = s => s.split('{{LINK}}').join(link);
// the same page through LinkSpin (Marty 2026-11-14: each network site its own traffic source): counted under this site, lands with ?ref=
const track = seg => netsites.tracked('dlb', 'dlb', { s1: ref, s2: seg });
return {
v: 1, site: C.site, name: 'Downline Banners', updated: '2026-11-14', username: ref || null,
tagline: 'Banner real estate in one line, paid instantly on-chain.',
links: [
{ key: 'home', label: 'Your link (home page)', url: link },
{ key: 'how', label: 'How it works', url: base() + '/how' + q },
{ key: 'join', label: 'Get a spot', url: base() + '/join' + q }
{ key: 'home', label: 'Your link (home page)', url: link, tracked: track('') },
{ key: 'how', label: 'How it works', url: base() + '/how' + q, tracked: track('how') },
{ key: 'join', label: 'Get a spot', url: base() + '/join' + q, tracked: track('join') }
],
linkTemplate: base() + '/?ref={username}',
linkTemplate: base() + '/?ref={username}', trackedTemplate: netsites.tracked('dlb', 'dlb') + '&s1={username}',
creatives: creatives().map(c => Object.assign({}, c, { html: '<a href="' + link + '" target="_blank" rel="noopener"><img src="' + c.url + '" width="' + c.w + '" height="' + c.h + '" alt="Downline Banners"></a>' })),
lines: LINES.map(fill), headlines: HEADLINES.slice(), email: { subject: EMAIL.subject, body: fill(EMAIL.body) }, posts: POSTS.map(fill),
note: NOTE, promotePage: base() + '/promote'
+1 -1
View File
@@ -51,7 +51,7 @@ window.BL = (function () {
function netLine(el) {
if (!el) return;
const paint = list => { el.innerHTML = '<b>Part of the network</b> &middot; One account across the network: ' + list.map(s => (s.id === 'dlb' || /downlinebanners\.com/.test(s.url))
? '<span class="here" aria-current="page">' + esc(s.name) + '</span>' : '<a href="' + esc(s.url) + '" target="_blank" rel="noopener">' + esc(s.name) + '</a>').join(' &middot; '); };
? '<span class="here" aria-current="page">' + esc(s.name) + '</span>' : '<a href="' + esc(s.go || s.url) + '" target="_blank" rel="noopener nofollow">' + esc(s.name) + '</a>').join(' &middot; '); };
paint(NET);
fetch('/api/network-sites').then(r => r.json()).then(l => { if (Array.isArray(l) && l.length) paint(l); }).catch(() => {});
}
+3 -1
View File
@@ -13,13 +13,15 @@ window.KitPage = (function () {
const cb = (text, label, cls) => { TXT.push(text); return '<button type="button" class="btn small ' + (cls || 'sec') + '" data-kc="' + (TXT.length - 1) + '">' + esc(label || 'Copy') + '</button>'; };
// on the kit's own site, show creatives from this origin (same files; the copied URL stays absolute)
function local(url, k) { try { const u = new URL(url); return u.hostname === k.site && location.hostname !== k.site ? u.pathname : url; } catch (e) { return url; } }
const row = (label, url, cls) => '<div class="kit-row"><div class="kit-l"><span class="kit-lab">' + esc(label) + '</span><code class="kit-url">' + esc(url) + '</code></div>' + cb(url, 'Copy link', cls) + '</div>';
function render(root, k) {
TXT.length = 0;
const angles = []; const by = {};
(k.creatives || []).forEach(c => { if (!by[c.angle]) { by[c.angle] = []; angles.push(c); } by[c.angle].push(c); });
let h = '';
h += '<div class="card"><h3>Your links</h3>' + (k.username ? '<p class="muted small">Every link, creative and line below carries <b>' + esc(k.username) + '</b>.</p>' : '<p class="muted small">Add your network username above so these links carry it.</p>')
+ k.links.map(l => '<div class="kit-row"><div class="kit-l"><span class="kit-lab">' + esc(l.label) + '</span><code class="kit-url">' + esc(l.url) + '</code></div>' + cb(l.url, 'Copy link', '') + '</div>').join('') + '</div>';
+ k.links.map(l => row(l.label, l.url, '') + (l.tracked ? row(l.label + ', tracked', l.tracked, 'sec') : '')).join('')
+ (k.links.some(l => l.tracked) ? '<p class="muted small">A tracked link goes through LinkSpin first, so the network can see which site sent the visit, then opens the same page with your username. Use either one.</p>' : '') + '</div>';
h += '<div class="card"><h3>Creatives</h3><p class="muted small">Download them, or copy the HTML: it already links to you.</p><div class="kit-tabs" role="tablist">'
+ angles.map((c, i) => '<button type="button" class="kit-tab' + (i ? '' : ' on') + '" data-ka="' + esc(c.angle) + '">' + esc(c.angleLabel) + '</button>').join('') + '</div>';
angles.forEach((a, i) => {
+1 -1
View File
@@ -31,7 +31,7 @@
<div class="card"><h3>The line so far</h3><div id="stats" class="grid2"></div></div>
<div id="status" class="note" hidden></div>
</main>
<script src="/assets/common.js?v=20261114t"></script>
<script src="/assets/common.js?v=20261114ns"></script>
<script src="/assets/board.js?v=1"></script>
</body>
</html>
+1 -1
View File
@@ -35,7 +35,7 @@
<li>Open any sale in the <a href="/ledger">live ledger</a> and look at its <b>Logs</b>: one SpotBought event, then one Paid event per payment.</li></ol></div>
<div id="zContract"></div>
</main>
<script src="/assets/common.js?v=20261114t"></script>
<script src="/assets/common.js?v=20261114ns"></script>
<script src="/assets/contract.js?v=z1"></script>
</body>
</html>
+1 -1
View File
@@ -33,7 +33,7 @@
<div class="card"><h2>Your decision</h2><p>Only spend what you can afford to lose completely. This is not financial, legal or tax advice. You are responsible for any taxes on what you receive.</p></div>
<div class="card"><h2>Contact</h2><p>Questions, problems or a request about your data: <a href="https://instantadpay.com/support" target="_blank" rel="noopener">network support</a>, or write to TrustClickz, 615 Green Valley Drive, Moody, AL 35004.</p></div>
</main>
<script src="/assets/common.js?v=20261114t"></script>
<script src="/assets/common.js?v=20261114ns"></script>
<script src="/assets/legal.js?v=1"></script>
</body>
</html>
+1 -1
View File
@@ -39,7 +39,7 @@
<div class="card"><h3>The momentum fund</h3><p>When no spot has sold for 4 hours, the fund buys one (at most 12 a day). It gifts the spot to an active member who owns a paid spot and has not had a gift in 7 days, members who referred someone recently first. If nobody qualifies, the fund keeps the spot and its line money goes back into the fund.</p></div>
<div class="card"><h3>The rest of the network</h3><p>Open board slots show network sites such as InstantAdPay and LinkSpin. On InstantAdPay, ad credits buy advertising, not income.</p></div>
</main>
<script src="/assets/common.js?v=20261114t"></script>
<script src="/assets/common.js?v=20261114ns"></script>
<script src="/assets/how.js?v=z1"></script>
</body>
</html>
+1 -1
View File
@@ -52,7 +52,7 @@
</section>
<div id="status" class="note" hidden></div>
</main>
<script src="/assets/common.js?v=20261114t"></script>
<script src="/assets/common.js?v=20261114ns"></script>
<script src="/assets/gate.js?v=1"></script>
</body>
</html>
+1 -1
View File
@@ -48,7 +48,7 @@
<div id="status" class="note" hidden></div>
<div class="card" id="doneCard" hidden><h3>Your spot is in the line</h3><p>Next: add your image and link in My Spots. One free signature signs you in (it cannot move funds).</p><div class="row"><button class="btn" id="toMyBtn">Open My Spots</button></div><p class="small mono" id="txLink"></p><div id="zBought"></div></div>
</main>
<script src="/assets/common.js?v=20261114t"></script>
<script src="/assets/common.js?v=20261114ns"></script>
<script src="/assets/wallet.js?v=1"></script>
<script src="/assets/join.js?v=20261114h"></script>
</body>
+1 -1
View File
@@ -30,7 +30,7 @@
<div class="card"><div class="row" style="justify-content:space-between"><h3 style="margin:0">Spot sales</h3><span class="muted small" id="upd"></span></div>
<div id="rows"><p class="muted">Loading the ledger...</p></div><div id="zLedger"></div><div id="rows2"></div></div>
</main>
<script src="/assets/common.js?v=20261114t"></script>
<script src="/assets/common.js?v=20261114ns"></script>
<script src="/assets/ledger.js?v=z1"></script>
</body>
</html>
+1 -1
View File
@@ -41,7 +41,7 @@
</div>
<div id="status" class="note" hidden></div>
</main>
<script src="/assets/common.js?v=20261114t"></script>
<script src="/assets/common.js?v=20261114ns"></script>
<script src="/assets/wallet.js?v=1"></script>
<script src="/assets/my.js?v=z1"></script>
</body>
+1 -1
View File
@@ -34,7 +34,7 @@
<div class="card"><h2>Your choices</h2><p>You can ask us to delete your account data on this site or on the network hub. Records on the blockchain cannot be deleted by anyone. You can clear the cookies in your browser at any time; you will need to sign in again.</p></div>
<div class="card"><h2>Contact</h2><p>Questions, problems or a request about your data: <a href="https://instantadpay.com/support" target="_blank" rel="noopener">network support</a>, or write to TrustClickz, 615 Green Valley Drive, Moody, AL 35004.</p></div>
</main>
<script src="/assets/common.js?v=20261114t"></script>
<script src="/assets/common.js?v=20261114ns"></script>
<script src="/assets/legal.js?v=1"></script>
</body>
</html>
+2 -2
View File
@@ -33,8 +33,8 @@
<div id="status" class="note" hidden></div>
<div id="kit"><p class="muted">Loading the kit...</p></div>
</main>
<script src="/assets/common.js?v=20261114t"></script>
<script src="/assets/kitpage.js?v=1"></script>
<script src="/assets/common.js?v=20261114ns"></script>
<script src="/assets/kitpage.js?v=2"></script>
<script src="/assets/promote.js?v=1"></script>
</body>
</html>
+1 -1
View File
@@ -39,7 +39,7 @@
<div class="card"><h2>Limits</h2><p>As far as the law allows, we are not responsible for losses caused by the blockchain, your wallet, the price of POL, third-party websites in banners, or events outside our control, and our total responsibility to you is limited to what you paid for the purchase in question. These terms are governed by the laws of the State of Alabama, USA.</p></div>
<div class="card"><h2>Contact</h2><p>Questions, problems or a request about your data: <a href="https://instantadpay.com/support" target="_blank" rel="noopener">network support</a>, or write to TrustClickz, 615 Green Valley Drive, Moody, AL 35004.</p></div>
</main>
<script src="/assets/common.js?v=20261114t"></script>
<script src="/assets/common.js?v=20261114ns"></script>
<script src="/assets/legal.js?v=1"></script>
</body>
</html>
+1
View File
@@ -147,6 +147,7 @@ async function main() {
const kr = await u.req('/api/promo-kit?u=alpha'); const k = await kr.json();
ok(kr.status === 200 && kr.headers.get('access-control-allow-origin') === '*', 'promo kit: GET /api/promo-kit 200 with CORS open', kr.status);
ok(k.username === 'alpha' && k.links.length === 3 && k.links.every(l => l.url.startsWith('https://downlinebanners.com/') && l.url.endsWith('?ref=alpha')), 'promo kit: every link carries ?ref=<username>', k.links);
ok(k.links.every(l => /^https:\/\/linkspin\.app\/r\/nwdlb\?src=dlb&s1=alpha(&s2=[a-z]+)?$/.test(l.tracked)) && k.links[0].tracked.indexOf('&s2=') < 0 && /&s2=how$/.test(k.links[1].tracked), 'promo kit: every link has a LinkSpin-tracked twin (network link nwdlb, source dlb, the member as s1, the page as s2)', k.links.map(l => l.tracked));
ok(k.lines.length === 5 && k.headlines.length === 3 && k.posts.length === 2 && k.email && k.email.body.includes('?ref=alpha'), 'promo kit: 5 lines, 3 headlines, 1 email, 2 posts, link filled in');
const words = JSON.stringify([k.lines, k.headlines, k.email, k.posts, k.note, k.tagline]);
ok(!/[—–]/.test(words) && !/passive income|guaranteed (income|returns|profit|earnings)|earn (cash|money)|make money/i.test(words) && /300 guaranteed views/.test(words) && /30%/.test(words) && /5\.5%/.test(words), 'promo kit copy: no dashes, no income promises, facts match the contract (300 views, 30%, 5.5%)');