Viral links: any public page + ?ref=<username|code|id> sets the same last-touch sponsor cookie as /join, counts under a 'page' hook in link stats, then redirects to the clean URL; Promo tools > Viral links builder (pages list + paste any address, copy + share); blog posts show a signed-in member's own link; chatbot answer; QA walk proves redirect + cookie
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -1,2 +1,19 @@
|
||||
// public blog pages: the shared nav (with wallet status) and footer, nothing else
|
||||
(function () { try { IAP.renderNav(location.pathname.indexOf('/leaderboard') === 0 ? 'leaderboard' : 'blog'); } catch (e) {} })();
|
||||
// Viral links (2026-09-21): a signed-in member sees this article's address with their own ?ref= on the
|
||||
// end, and the share buttons carry it too. Whoever opens it is tagged to them like an invite link.
|
||||
(async function () {
|
||||
try {
|
||||
const share = document.querySelector('p.share'); if (!share) return;
|
||||
const me = await (await fetch('/api/me')).json();
|
||||
const tok = me && me.signedIn && (me.username || me.refCode); if (!tok) return;
|
||||
const link = 'https://instantadpay.com' + location.pathname + '?ref=' + encodeURIComponent(tok);
|
||||
share.querySelectorAll('a').forEach(a => { a.href = a.href.replace(encodeURIComponent('https://instantadpay.com' + location.pathname), encodeURIComponent(link)); });
|
||||
const bar = document.createElement('div');
|
||||
bar.id = 'viralBar';
|
||||
bar.style.cssText = 'margin-top:18px;padding:12px 14px;border:1px solid var(--line);border-radius:12px;background:var(--card, rgba(255,255,255,.03));display:flex;gap:10px;align-items:center;flex-wrap:wrap';
|
||||
bar.innerHTML = '<div style="flex:1;min-width:220px"><div class="eyebrow" style="margin:0 0 4px">Your link for this article</div><div class="mono small" style="overflow-wrap:anywhere">' + link.replace(/[&<>]/g, '') + '</div><div class="muted small" style="margin-top:4px">Share this and anyone who joins from it is yours, same as your invite link.</div></div><button class="btn small" type="button">Copy link</button>';
|
||||
bar.querySelector('button').onclick = async () => { try { await navigator.clipboard.writeText(link); IAP.status('Link copied.', 'ok'); } catch (e) { IAP.status('Copy failed.', 'bad'); } };
|
||||
share.parentNode.insertBefore(bar, share);
|
||||
} catch (e) {}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user