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 e57b078..2c87b97 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'], 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: 'Downline Banners' })), lines: LINES.map(fill), headlines: HEADLINES.slice(), email: { subject: EMAIL.subject, body: fill(EMAIL.body) }, posts: POSTS.map(fill), note: NOTE, promotePage: base() + '/promote' diff --git a/public/assets/common.js b/public/assets/common.js index 71ee3a2..1c550f7 100644 --- a/public/assets/common.js +++ b/public/assets/common.js @@ -51,7 +51,7 @@ window.BL = (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 === 'dlb' || /downlinebanners\.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/board.html b/public/board.html index c676fb6..19ac82d 100644 --- a/public/board.html +++ b/public/board.html @@ -31,7 +31,7 @@

The line so far

- + diff --git a/public/contract.html b/public/contract.html index 5458b76..8e6873f 100644 --- a/public/contract.html +++ b/public/contract.html @@ -35,7 +35,7 @@
  • Open any sale in the live ledger and look at its Logs: one SpotBought event, then one Paid event per payment.
  • - + diff --git a/public/disclaimer.html b/public/disclaimer.html index 482aef5..a8fd5ad 100644 --- a/public/disclaimer.html +++ b/public/disclaimer.html @@ -33,7 +33,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 8fc664f..14ebb6d 100644 --- a/public/how.html +++ b/public/how.html @@ -39,7 +39,7 @@

    The momentum fund

    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.

    The rest of the network

    Open board slots show network sites such as InstantAdPay and LinkSpin. On InstantAdPay, ad credits buy advertising, not income.

    - + diff --git a/public/index.html b/public/index.html index 2cb761b..37cc7be 100644 --- a/public/index.html +++ b/public/index.html @@ -52,7 +52,7 @@ - + diff --git a/public/join.html b/public/join.html index e38b6ba..127b115 100644 --- a/public/join.html +++ b/public/join.html @@ -48,7 +48,7 @@ - + diff --git a/public/ledger.html b/public/ledger.html index 785c63b..4ea4bf1 100644 --- a/public/ledger.html +++ b/public/ledger.html @@ -30,7 +30,7 @@

    Spot sales

    Loading the ledger...

    - + diff --git a/public/my.html b/public/my.html index 7fc3db0..a81a128 100644 --- a/public/my.html +++ b/public/my.html @@ -41,7 +41,7 @@ - + diff --git a/public/privacy.html b/public/privacy.html index 50048a3..5c354f9 100644 --- a/public/privacy.html +++ b/public/privacy.html @@ -34,7 +34,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 2c2be01..f0df55d 100644 --- a/public/promote.html +++ b/public/promote.html @@ -33,8 +33,8 @@

    Loading the kit...

    - - + + diff --git a/public/terms.html b/public/terms.html index 8b2612b..864c24e 100644 --- a/public/terms.html +++ b/public/terms.html @@ -39,7 +39,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 1d2e19e..0cf7090 100644 --- a/qa/smoke.mjs +++ b/qa/smoke.mjs @@ -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=', 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%)');