This domain is a link forwarding service operated by ' + brand + ', a member advertising network. Links on this domain forward visitors in one step to pages published by our members and their partners.
We do not host the pages you land on, and we do not collect payment information here. If a link forwarded you somewhere you did not expect, or to content that looks unsafe, tell us on the report page and we will pull the link.
When a link is followed we record the day, the country, the referring site, the device type and a one-day anonymous visitor token. We do not store your IP address or any personal data. Details are in the privacy policy.
', disclosure: 'Links forwarded through ' + H + ' may be affiliate links or paid advertisements. The member who published a link may earn a commission or advertising credit if you buy something or sign up on the page you land on. This never changes the price you pay.
' + brand + ' itself is an advertising platform. Members buy ad packages and earn commissions when people they referred buy ad packages. No income is guaranteed to anyone; results depend on effort, and any earnings examples on member pages are illustrations, not promises.
The pages you are forwarded to belong to their publishers. We are not responsible for their claims, and we remove links that are reported and found to violate our terms.
', terms: 'By following a link on ' + H + ' you agree to these terms.
' + H + ' forwards visitors to destinations chosen by ' + brand + ' members. We provide the forwarding only. We do not endorse, verify or control the destination pages, and we are not a party to any transaction you make there.
Members may not forward visitors to content that is illegal, deceptive, malicious, adult, or that impersonates another business. Links that violate this are removed and the member\'s account is closed. Automated access to this domain is not permitted except by search engines.
The service is provided as is. We do not guarantee that any link will be available, and we are not liable for the content, availability or conduct of destination sites.
Questions about these terms: linkspin.co.
', - privacy: 'This policy covers ' + H + ' and the link forwarding service on it.
When you follow a link we record the date, your country (derived from your network address and then discarded), the site that referred you, whether you are on a phone or a computer, and an anonymous visitor token that changes every day and cannot be traced back to you. We do not store your IP address, your name, your email address or any account information on this domain.
This domain sets no cookies. The page you are forwarded to has its own privacy policy and may set its own.
So members can see how many people followed their links and from where. Counts are shown to the member who published the link, in aggregate, and to nobody else.
Link statistics are kept for up to thirteen months and then deleted.
Because we hold no personal data on this domain there is nothing to access or delete here. For anything involving a ' + brand + ' member account, contact us through linkspin.co.
', + privacy: 'This policy covers ' + H + ' and the link forwarding service on it.
When you follow a link we record the date, your country (derived from your network address and then discarded), the site that referred you, whether you are on a phone or a computer, and an anonymous visitor token that changes every day and cannot be traced back to you. We do not store your IP address, your name, your email address or any account information on this domain.
If the member who owns the link tracks goals, or you arrived from an ad, the page you are forwarded to gets a random click id in its address (lsclk). The site you land on may keep it for 30 days to count whether the visit led to a sign-up or a sale. It identifies the click, not you.
This domain sets no cookies. The page you are forwarded to has its own privacy policy and may set its own.
So members can see how many people followed their links and from where. Counts are shown to the member who published the link, in aggregate, and to nobody else.
Link statistics are kept for up to thirteen months and then deleted.
Because we hold no personal data on this domain there is nothing to access or delete here. For anything involving a ' + brand + ' member account, contact us through linkspin.co.
', abuse: 'If a link on ' + H + ' forwarded you to a page that is deceptive, unsafe, adult, or impersonates a business, tell us. We review every report and pull the link first, then ask questions.
Send the full link you clicked (it starts with https://' + H + '/r/ or https://' + H + '/c/) and what you saw, or the address of a banner image you want reviewed, to the support contact on linkspin.co. Reports are usually handled the same day.
', gone: 'The link you followed has been removed or has expired. Nothing was recorded. If you were expecting a specific page, ask the person who shared the link for a fresh one.
' }; @@ -1169,7 +1188,7 @@ const server = http.createServer(async (req, res) => { const u = new URL(req.url, 'http://x'); const p = u.pathname; // zone endpoints run on other people's sites and show only ad creatives, so they pass the curtain - const zonePath = p === '/z.js' || p === '/z/nas' || p === '/p.js' || p === '/p.gif' || p.startsWith('/u/pages/') || p.startsWith('/api/zone/') || p.startsWith('/banners/linkspin-') || p.startsWith('/art/house-') || /^\/(i|c|s)\/[a-z0-9]{5,12}(\.gif|\.js)?$/.test(p); // + Banner Spin image / click / script (2026-10-18) + const zonePath = p === '/z.js' || p === '/z/nas' || p === '/p.js' || p === '/p.gif' || p === '/t.js' || p === '/t.gif' || p === '/cv.gif' || p === '/cv.js' || p.startsWith('/u/pages/') || p.startsWith('/api/zone/') || p.startsWith('/banners/linkspin-') || p.startsWith('/art/house-') || /^\/(i|c|s)\/[a-z0-9]{5,12}(\.gif|\.js)?$/.test(p); // + Banner Spin image / click / script (2026-10-18) // support must reach everyone, invited or not (2026-10-16): someone locked out or not yet let in is exactly who needs it if (!zonePath && !supportOpen(p) && curtained(req, res, u)) return; // nothing below this line runs for an uninvited visitor @@ -1213,6 +1232,26 @@ const server = http.createServer(async (req, res) => { if (!am.vid) h['Set-Cookie'] = audiences.cookieHeader(audiences.newVid(), IS_PROD); res.writeHead(200, h); return res.end(JSON.stringify({ ad })); } + // -- conversion pixel (2026-10-23): /t.js the landing tag, /t.gif its beacon, /cv.gif + /cv.js the goal pixel. Any origin, + // never cached, always a 1x1 gif (the member's page never sees an error). X-LS-Result says what happened (tests, debugging). + if ((p === '/t.js' || p === '/cv.js') && (req.method === 'GET' || req.method === 'HEAD')) { + try { const body = fs.readFileSync(path.join(PUBLIC_DIR, p.slice(1))); res.writeHead(200, { 'Content-Type': 'application/javascript; charset=utf-8', 'Cache-Control': 'public, max-age=300', 'Access-Control-Allow-Origin': '*', 'X-Content-Type-Options': 'nosniff' }); return res.end(req.method === 'HEAD' ? '' : body); } catch (e) { res.writeHead(404); return res.end(); } + } + if ((p === '/t.gif' || p === '/cv.gif') && req.method === 'GET') { + const h = { 'Content-Type': 'image/gif', 'Cache-Control': 'no-store, private', 'Content-Length': String(PIXEL_GIF.length), 'Access-Control-Allow-Origin': '*', 'Access-Control-Expose-Headers': 'X-LS-Result', 'X-Robots-Tag': 'noindex' }; + const px = String(u.searchParams.get('px') || ''); + try { + if (p === '/t.gif') { + const id = convtrack.isPx(px) ? convtrack.landing(px, String(u.searchParams.get('c') || ''), req) : null; + if (id) h['Set-Cookie'] = clickCookie(id); h['X-LS-Result'] = id ? 'stored' : 'ignored'; + } else if (convtrack.isPx(px)) { + const r = convtrack.record({ px, goal: u.searchParams.get('goal'), value: u.searchParams.get('value'), c: String(u.searchParams.get('c') || u.searchParams.get('lsclk') || u.searchParams.get('lsid') || u.searchParams.get('clickid') || refClickId(req) || ''), m: u.searchParams.get('m'), test: u.searchParams.get('test') === '1' }, req, parseCookies(req)); + h['X-LS-Result'] = r.result + (r.method ? ';' + r.method : ''); + if (r.result === 'counted' && !r.conv.self) postbacks.fire(r.conv.owner, r.conv.goal, Object.assign(convtrack.postbackCtx(r), { goal: true })).catch(e => console.error('goal postback', e.message)); + } else h['X-LS-Result'] = 'unknown'; + } catch (e) { console.error('conversion pixel', e.message); h['X-LS-Result'] = 'error'; } + res.writeHead(200, h); return res.end(PIXEL_GIF); + } // audience pixel: 1x1 gif, sets/refreshes the visitor cookie, records the hit (30-day membership) if (p === '/p.gif' && req.method === 'GET') { const a = String(u.searchParams.get('a') || ''); const vid = audiences.cookieVid(req); const h = { 'Content-Type': 'image/gif', 'Cache-Control': 'no-store, private', 'Content-Length': String(PIXEL_GIF.length) }; @@ -1229,7 +1268,7 @@ const server = http.createServer(async (req, res) => { res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8', 'Cache-Control': 'no-store', 'Content-Security-Policy': "default-src 'none'; script-src https://www.networkadspace.com https://networkadspace.com 'unsafe-inline'; img-src https: http: data:; style-src 'unsafe-inline'; frame-src https: http:; frame-ancestors *; base-uri 'none'", 'Referrer-Policy': 'no-referrer' }); return res.end(html); } if (p === '/api/zone/seen' && (req.method === 'GET' || req.method === 'POST')) { await zones.seen(u.searchParams.get('i'), req); res.writeHead(204, corsCreds(req)); return res.end(); } - { const zm = /^\/api\/zone\/click\/([a-f0-9]{12})$/.exec(p); if (zm && req.method === 'GET') { const target = await zones.click(zm[1]); res.writeHead(302, { Location: target || '/', 'Cache-Control': 'no-store', 'Referrer-Policy': 'no-referrer-when-downgrade' }); return res.end(); } } + { const zm = /^\/api\/zone\/click\/([a-f0-9]{12})$/.exec(p); if (zm && req.method === 'GET') { let ck = null; const target = await zones.click(zm[1], async (camp, url) => { const t = await adClickTarget(camp, url, req, { placement: 'zone' }); ck = t.cookie; return t.url; }); const zh = { Location: target || '/', 'Cache-Control': 'no-store', 'Referrer-Policy': 'no-referrer-when-downgrade' }; if (ck) zh['Set-Cookie'] = ck; res.writeHead(302, zh); return res.end(); } } // -- publisher program (2026-10-10): the public offer for site owners who carry zones, and its live "Network right now" // strip (7-day totals from zones.js, cached a minute). App host only; the link and pages domains stay single-purpose. // Today's POL price in US dollars for the member pages (Marty, 2026-10-22, same as InstantAdPay): the contract's own package @@ -2556,6 +2595,29 @@ const server = http.createServer(async (req, res) => { let bsum = null; try { bsum = await bannerspin.summary(s.email, days); } catch (e) { console.error('bannerspin summary', e.message); } return json(res, 200, Object.assign({}, spins, { spins, pages: pg, zones: zn, bannerSpins: bsum, days: spins.days, range: days }), { 'Cache-Control': 'no-store' }); } + // -- conversion pixel (2026-10-23): goals, per-goal reports, CSV, test. GET and POST (the shell's api() always POSTs). + if (p === '/api/my/conversions' && (req.method === 'GET' || req.method === 'POST')) { + const s = await auth.fromRequest(req); if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' }); + const b = req.method === 'POST' ? await readBody(req).catch(() => ({})) : {}; + const days = Math.max(1, Math.min(365, Number(b.days || u.searchParams.get('days')) || 30)); + const r = await convtrack.report(s.email, days, { sourceMeta: sources.meta ? sources.meta(s.email) : {} }); + return json(res, 200, Object.assign(r, { host: SITE_HOST, base: (IS_PROD ? 'https' : 'http') + '://' + SITE_HOST, limits: convtrack.LIMITS, windowDays: 30, softHours: 24 }), { 'Cache-Control': 'no-store' }); + } + if (p === '/api/my/conversions/goals' && req.method === 'POST') { + const s = await auth.fromRequest(req); if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' }); + const b = await readBody(req).catch(() => ({})); const r = convtrack.createGoal(s.email, b); return json(res, r.error ? 400 : 200, r); + } + m = /^\/api\/my\/conversions\/goals\/(px[a-f0-9]{10})$/.exec(p); + if (m && req.method === 'POST') { + const s = await auth.fromRequest(req); if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' }); + const b = await readBody(req).catch(() => ({})); const r = b.test ? convtrack.testGoal(s.email, m[1]) : convtrack.updateGoal(s.email, m[1], b); return json(res, r.error ? 400 : 200, r); + } + if (p === '/api/my/conversions.csv' && req.method === 'GET') { + const s = await auth.fromRequest(req); if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' }); + const days = Math.max(1, Math.min(365, Number(u.searchParams.get('days')) || 30)); + res.writeHead(200, baseHeaders({ 'Content-Type': 'text/csv; charset=utf-8', 'Content-Disposition': 'attachment; filename="linkspin-conversions-' + days + 'd.csv"', 'Cache-Control': 'no-store' })); + return res.end(convtrack.csv(s.email, days)); + } // -- traffic sources (2026-10-12). Every route takes GET and POST: the shell's api() helper always POSTs. if (p === '/api/sources/catalog' && (req.method === 'GET' || req.method === 'POST')) return json(res, 200, { catalog: sources.catalog(), keys: sources.KEYS }, { 'Cache-Control': 'public, max-age=300' }); if (p === '/api/my/sources' && (req.method === 'GET' || req.method === 'POST')) { @@ -2655,6 +2717,25 @@ const server = http.createServer(async (req, res) => { return json(res, 200, { ok: true, proto: SF.PROTO, rows: rows.length, imported: n, shells, updated, followed, followKept: kept, registry: await registry.count() }); } finally { carry.unhold(held); } } + // -- conversion pixel, InstantAdPay side (2026-10-23): its ad clicks arrive here (signed, upsert by id), and its members' + // goals live on their LinkSpin account (same email): summary for the Campaigns rows, create / update / remove / test. + if (p === '/api/partner/clicks' && req.method === 'POST') { + const sg = await readPartnerSigned(req, 2e6); if (!sg.body) return json(res, sg.status, { error: sg.error }); + return json(res, 200, { ok: true, n: convtrack.importClicks(sg.body.clicks) }); + } + if (p === '/api/partner/conv' && req.method === 'POST') { + const sg = await readPartnerSigned(req, 64000); if (!sg.body) return json(res, sg.status, { error: sg.error }); + const b = sg.body; const email = String(b.email || '').trim().toLowerCase(); + if (!/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(email) || email.length > 190) return json(res, 400, { error: 'Which member?' }); + let r; + if (b.op === 'summary') r = Object.assign(convtrack.partnerSummary(email, b.days), { host: SITE_HOST }); + else if (b.op === 'create') r = convtrack.createGoal(email, { name: b.name, value: b.value }); + else if (b.op === 'update') r = convtrack.updateGoal(email, b.px, { name: b.name, value: b.value === null ? 0 : b.value }); // null = clear the default (InstantAdPay sends it for an empty box) + else if (b.op === 'remove') r = convtrack.updateGoal(email, b.px, { remove: true }); + else if (b.op === 'test') r = convtrack.testGoal(email, b.px); + else return json(res, 400, { error: 'op must be summary, create, update, remove or test' }); + return json(res, r.error ? 400 : 200, r); + } // -- sponsor check between LinkSpin and InstantAdPay (2026-10-22, sponsorfollow.js). Partner side: InstantAdPay reads our // facts and, on an admin's pick in ITS Sponsor check, asks us to apply a sponsor (refused when the member is bound here). if (p === '/api/partner/sponsor-facts' && req.method === 'POST') { @@ -3388,7 +3469,8 @@ const server = http.createServer(async (req, res) => { const target = await ads.click(m[1]); if (!target) { res.writeHead(404, baseHeaders()); return res.end(); } coach.recordClick(m[1], req.headers.referer); // where the click happened - res.writeHead(302, baseHeaders({ Location: target })); + const t = await adClickTarget(m[1], target, req); // conversion pixel: click id recorded + ?lsclk= on the target (2026-10-23) + res.writeHead(302, baseHeaders(Object.assign({ Location: t.url }, t.cookie ? { 'Set-Cookie': t.cookie } : {}))); return res.end(); } if (p === '/api/my/audiences' && req.method === 'GET') { @@ -3779,6 +3861,7 @@ const server = http.createServer(async (req, res) => { } if (p === '/links') return sendFile(res, path.join(PUBLIC_DIR, 'links.html')); // Control Room: the links workspace, first screen of the new front end (2026-09-29) if (p === '/reports') return sendFile(res, path.join(PUBLIC_DIR, 'reports.html')); + if (p === '/conversions') return sendFile(res, path.join(PUBLIC_DIR, 'conversions.html')); // Control Room: conversion pixel goals + per-goal reports (2026-10-23) if (p === '/pages') return sendFile(res, path.join(PUBLIC_DIR, 'pages.html')); if (p === '/zones') return sendFile(res, path.join(PUBLIC_DIR, 'zones.html')); if (p === '/sources') return sendFile(res, path.join(PUBLIC_DIR, 'sources.html')); // Control Room: traffic sources, network macros + postbacks (2026-10-12) diff --git a/zones.js b/zones.js index 5d05e95..5668276 100644 --- a/zones.js +++ b/zones.js @@ -116,11 +116,11 @@ async function seen(impId, req) { } J.save(); return { ok: true }; } -async function click(impId) { +async function click(impId, decorate) { // decorate(campaignId, url) -> url: the conversion pixel's click id (2026-10-23) const imp = J.db.imps.find(i => i.id === String(impId)); if (!imp) return null; imp.k = 1; J.save(); if (imp.house || !imp.camp) return 'https://' + siteHost + '/'; - try { return (await ads.click(imp.camp)) || ('https://' + siteHost + '/'); } catch (e) { return 'https://' + siteHost + '/'; } + try { const url = await ads.click(imp.camp); if (!url) return 'https://' + siteHost + '/'; return decorate ? ((await decorate(imp.camp, url).catch(() => url)) || url) : url; } catch (e) { return 'https://' + siteHost + '/'; } } // -- admin: every zone with its owner, site, mix and status; pause/resume async function adminList() { return J.db.zones.map(z => Object.assign(pubZone(z), { owner: z.owner, note: z.adminNote || '' })).sort((a, b) => b.views30 - a.views30); }