From 89f79f934bb008495d3ce77fe70850c8151a84aa Mon Sep 17 00:00:00 2001 From: martbost Date: Sat, 14 Nov 2026 11:38:02 -0600 Subject: [PATCH] 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= (linkspin.app/r/, 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/nwvbb?src=vbb&s1=&s2=, lands on the same page with ?ref=), trackedTemplate; /promote shows both. Same netsites.js in all five sites. common.js?v=7, kitpage.js?v=2. Smoke 242/242 Co-Authored-By: Claude Opus 5.5 --- netsites.js | 24 ++++++++++++++++++++++-- promokit.js | 11 +++++++---- public/admin.html | 2 +- public/assets/common.js | 2 +- public/assets/kitpage.js | 4 +++- public/contract.html | 2 +- public/disclaimer.html | 2 +- public/how.html | 2 +- public/index.html | 2 +- public/leaders.html | 2 +- public/ledger.html | 2 +- public/my.html | 2 +- public/packages.html | 2 +- public/privacy.html | 2 +- public/promote.html | 4 ++-- public/terms.html | 2 +- qa/smoke.mjs | 1 + 17 files changed, 47 insertions(+), 21 deletions(-) diff --git a/netsites.js b/netsites.js index 2536f92..e9288b4 100644 --- a/netsites.js +++ b/netsites.js @@ -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=, 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 }; diff --git a/promokit.js b/promokit.js index 3c2cf1f..ef75dcc 100644 --- a/promokit.js +++ b/promokit.js @@ -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= (2026-11-14) const KIT_DIR = path.join(__dirname, 'public', 'art', 'kit'); const SHAPES = { tile: [125, 125, 'Square button (loop size)'], strip: [468, 60, 'Strip'], leader: [728, 90, 'Leaderboard'], box: [300, 250, 'Box'], @@ -75,16 +76,18 @@ 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('vbb', 'vbb', { s1: ref, s2: seg }); const t = copy(); return { v: 1, site: C.site, name: C.siteName, updated: '2026-11-14', username: ref || null, tagline: 'One shared loop of 125x125 banners. Real visitors push it.', links: [ - { key: 'home', label: 'Your link (the loop)', url: link }, - { key: 'how', label: 'How it works', url: base() + '/how' + q }, - { key: 'leaders', label: 'Weekly leaderboards', url: base() + '/leaders' + q } + { key: 'home', label: 'Your link (the loop)', url: link, tracked: track('') }, + { key: 'how', label: 'How it works', url: base() + '/how' + q, tracked: track('how') }, + { key: 'leaders', label: 'Weekly leaderboards', url: base() + '/leaders' + q, tracked: track('leaders') } ], - linkTemplate: base() + '/?ref={username}', + linkTemplate: base() + '/?ref={username}', trackedTemplate: netsites.tracked('vbb', 'vbb') + '&s1={username}', creatives: creatives().map(c => Object.assign({}, c, { html: 'Viral Banner Blitz' })), lines: t.lines.map(fill), headlines: t.headlines, email: { subject: t.email.subject, body: fill(t.email.body) }, posts: t.posts.map(fill), note: NOTE, promotePage: base() + '/promote' diff --git a/public/admin.html b/public/admin.html index f4fa75a..613559c 100644 --- a/public/admin.html +++ b/public/admin.html @@ -36,7 +36,7 @@ - + diff --git a/public/assets/common.js b/public/assets/common.js index 25308c8..61bfb4d 100644 --- a/public/assets/common.js +++ b/public/assets/common.js @@ -61,7 +61,7 @@ window.VBB = (function () { function netLine(el) { if (!el) return; const paint = list => { el.innerHTML = 'Part of the network · One account across the network: ' + list.map(s => (s.id === 'vbb' || /viralbannerblitz\.com/.test(s.url)) - ? '' + esc(s.name) + '' : '' + esc(s.name) + '').join(' · '); }; + ? '' + esc(s.name) + '' : '' + esc(s.name) + '').join(' · '); }; paint(NET); fetch('/api/network-sites').then(r => r.json()).then(l => { if (Array.isArray(l) && l.length) paint(l); }).catch(() => {}); } diff --git a/public/assets/kitpage.js b/public/assets/kitpage.js index cc1aa80..2527710 100644 --- a/public/assets/kitpage.js +++ b/public/assets/kitpage.js @@ -13,13 +13,15 @@ window.KitPage = (function () { const cb = (text, label, cls) => { TXT.push(text); return ''; }; // 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) => '
' + esc(label) + '' + esc(url) + '
' + cb(url, 'Copy link', cls) + '
'; 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 += '

Your links

' + (k.username ? '

Every link, creative and line below carries ' + esc(k.username) + '.

' : '

Add your network username above so these links carry it.

') - + k.links.map(l => '
' + esc(l.label) + '' + esc(l.url) + '
' + cb(l.url, 'Copy link', '') + '
').join('') + '
'; + + 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) ? '

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.

' : '') + ''; h += '

Creatives

Download them, or copy the HTML: it already links to you.

' + angles.map((c, i) => '').join('') + '
'; angles.forEach((a, i) => { diff --git a/public/contract.html b/public/contract.html index 348bf56..602dd79 100644 --- a/public/contract.html +++ b/public/contract.html @@ -50,7 +50,7 @@
- + diff --git a/public/disclaimer.html b/public/disclaimer.html index fe16558..55e2496 100644 --- a/public/disclaimer.html +++ b/public/disclaimer.html @@ -34,7 +34,7 @@

Your decision

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.

Contact

Questions, problems or a request about your data: network support, or write to TrustClickz, 615 Green Valley Drive, Moody, AL 35004.

- + diff --git a/public/how.html b/public/how.html index db8c8e0..6b9e1c3 100644 --- a/public/how.html +++ b/public/how.html @@ -55,7 +55,7 @@ - + diff --git a/public/index.html b/public/index.html index c23dc2f..dac2a2e 100644 --- a/public/index.html +++ b/public/index.html @@ -56,7 +56,7 @@ - + diff --git a/public/leaders.html b/public/leaders.html index 166a109..f43cb05 100644 --- a/public/leaders.html +++ b/public/leaders.html @@ -33,7 +33,7 @@ - + diff --git a/public/ledger.html b/public/ledger.html index a16c7bd..765e52f 100644 --- a/public/ledger.html +++ b/public/ledger.html @@ -35,7 +35,7 @@ - + diff --git a/public/my.html b/public/my.html index 40e1f04..32622d1 100644 --- a/public/my.html +++ b/public/my.html @@ -78,7 +78,7 @@ - + diff --git a/public/packages.html b/public/packages.html index 12c5c4d..3474437 100644 --- a/public/packages.html +++ b/public/packages.html @@ -43,7 +43,7 @@

Every network member (InstantAdPay or LinkSpin) also gets one free post credit each day they sign in.

Use my free credit
- + diff --git a/public/privacy.html b/public/privacy.html index f1bf86d..e2f7a5f 100644 --- a/public/privacy.html +++ b/public/privacy.html @@ -35,7 +35,7 @@

Your choices

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.

Contact

Questions, problems or a request about your data: network support, or write to TrustClickz, 615 Green Valley Drive, Moody, AL 35004.

- + diff --git a/public/promote.html b/public/promote.html index be67b54..36b7f77 100644 --- a/public/promote.html +++ b/public/promote.html @@ -34,8 +34,8 @@

Loading the kit...

- - + + diff --git a/public/terms.html b/public/terms.html index cef12d1..8c9e4fa 100644 --- a/public/terms.html +++ b/public/terms.html @@ -40,7 +40,7 @@

Limits

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.

Contact

Questions, problems or a request about your data: network support, or write to TrustClickz, 615 Green Valley Drive, Moody, AL 35004.

- + diff --git a/qa/smoke.mjs b/qa/smoke.mjs index 86a3bac..95afa8d 100644 --- a/qa/smoke.mjs +++ b/qa/smoke.mjs @@ -186,6 +186,7 @@ async function main() { const kr = await anon.req('/api/promo-kit?u=smokeleader'); 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 === 'smokeleader' && k.links.length === 3 && k.links.every(l => l.url.startsWith('https://viralbannerblitz.com/') && l.url.endsWith('?ref=smokeleader')), 'promo kit: every link carries ?ref=', k.links); + ok(k.links.every(l => /^https:\/\/linkspin\.app\/r\/nwvbb\?src=vbb&s1=smokeleader(&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 nwvbb, source vbb, 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.subject && k.email.body.includes('?ref=smokeleader'), '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) && !/\$50|passive income|guaranteed (income|returns|profit)|earn (cash|money)|make money/i.test(words) && /at least \$20/.test(words), 'promo kit copy: no dashes, no cap, no income promises, pot shown as at least $20');