From f226181ac80dfec038355347e2246a0d5ff1d07b Mon Sep 17 00:00:00 2001 From: martbost Date: Sat, 1 Aug 2026 11:17:22 -0500 Subject: [PATCH] CTB sponsor alignment: hub funnel + identity resolution Visitors now funnel to the CTB Rewards hub (ctbrewards.saasy.top/invite/ ) instead of the Telegram sponsor group - every group link and the generated plan's handshake steps now point at the sponsor's hub invite, which keeps referrals aligned in Crypto Team Build. Identity layer: one member, two usernames. Share links may carry ?ctb= (canonical) or legacy ?ref=; the new member-program-link.php endpoint on cryptoteambuild.com (downline-builder program #73) resolves either direction. ?ctb= looks up the sponsor's own ClickBaitPays ref for the signup buttons; ?ref= reverse-resolves the CTB username so the hub invite personalizes. Endpoint down or entry missing -> graceful fallback to cryptoteambuild + a visible sponsor nudge explaining how to fix it (add your CBP username to the downline-builder entry). Share URLs now carry both identities; Sponsor Guide documents the hub + the downline-builder tip. Engine untouched: test_scenarios ALL PASS. Co-Authored-By: Claude Fable 5 --- index.html | 107 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 90 insertions(+), 17 deletions(-) diff --git a/index.html b/index.html index 4cb3fd0..9222c5f 100644 --- a/index.html +++ b/index.html @@ -1093,6 +1093,9 @@ πŸ” Log into ClickBaitPays + - - πŸ’¬ Sponsor Community + + πŸ’¬ Team Hub
@@ -1530,10 +1533,11 @@

- πŸ’¬ Sponsor Community + πŸ’¬ The Team Hub

- Connect with other sponsors, share strategies, and help your referrals in the official Telegram group:
- https://t.me/+mzXTku1wR7pkODBh + The team now runs through the CTB Rewards hub β€” your referrals join through YOUR hub invite link (it keeps them connected to you as their sponsor in Crypto Team Build), and it's where you connect with the team and help your people:
+ ctbrewards.saasy.top
+ Tip: add your ClickBaitPays username to the ClickBaitPays entry in your CryptoTeamBuild Downline Builder β€” then every calculator link you share automatically carries BOTH your ClickBaitPays referral and your hub invite.

@@ -1551,7 +1555,7 @@
@@ -2337,6 +2341,66 @@ function getRefFromURL() { return p.get('ref') || ''; } +// ─── CTB Identity (sponsor alignment) ─────────────────────── +// One member, two usernames: their Crypto Team Build username and their +// ClickBaitPays username (the affiliateid on their CTB downline-builder +// entry for program #73). member-program-link.php resolves either direction. +// Share links may carry ?ctb= (canonical) or the legacy +// ?ref=; both end up fully resolved here. +const CTB_LOOKUP_URL = 'https://cryptoteambuild.com/api/member-program-link.php'; +const HUB_BASE = 'https://ctbrewards.saasy.top'; +const IDENT = { cbp: getRefFromURL() || 'cryptoteambuild', ctb: '', fallback: false }; + +function getCbpUser() { return IDENT.cbp; } + +function hubUrl() { + return IDENT.ctb ? `${HUB_BASE}/invite/${encodeURIComponent(IDENT.ctb)}` : HUB_BASE + '/'; +} + +function updateHubLinks() { + document.querySelectorAll('a.hub-link').forEach(a => { a.href = hubUrl(); }); + const footerRef = document.getElementById('footerRefLink'); + if (footerRef) { + footerRef.href = `https://clickbaitpays.me/?ref=${getCbpUser()}`; + footerRef.textContent = `https://clickbaitpays.me/?ref=${getCbpUser()}`; + } +} + +function showSponsorNudge() { + const el = document.getElementById('sponsorNudge'); + if (el) el.style.display = 'block'; +} + +async function resolveIdentity() { + const p = new URLSearchParams(window.location.search); + const ctbParam = (p.get('ctb') || '').trim(); + try { + if (ctbParam) { + const r = await fetch(`${CTB_LOOKUP_URL}?ctb=${encodeURIComponent(ctbParam)}`).then(x => x.json()); + if (r.found) { + IDENT.cbp = r.cbpUsername; + IDENT.ctb = r.ctbUsername; + } else { + // No ClickBaitPays entry in their downline builder: CBP signups fall + // back to the team account, but the hub link still aligns them in CTB. + IDENT.ctb = ctbParam; + IDENT.fallback = true; + } + } else { + // Legacy/current ?ref= links (or the default): reverse-resolve the CTB + // username so the Team Hub invite personalizes to the same sponsor. + const r = await fetch(`${CTB_LOOKUP_URL}?cbp=${encodeURIComponent(IDENT.cbp)}`).then(x => x.json()); + if (r.found) IDENT.ctb = r.ctbUsername; + } + } catch (e) { + // Lookup unreachable: defaults stand, nothing breaks. + } + updateHeroSignupBtn(); + updateSharedLinkBox(); + updateHubLinks(); + if (IDENT.fallback) showSponsorNudge(); +} + function getBaseUrl() { let url = window.location.href.split('?')[0]; if (url.endsWith('/')) url = url.slice(0, -1); @@ -2344,10 +2408,14 @@ function getBaseUrl() { } function getShareUrl(refUser) { - const u = refUser || getRefFromURL() || 'cryptoteambuild'; + const u = refUser || getCbpUser(); const gift = document.getElementById('giftLevel').value; const self = document.getElementById('selfFundLevel').value; let url = getBaseUrl() + '?ref=' + encodeURIComponent(u); + // Carry the CTB identity when known β€” keeps the hub invite and any future + // lookups aligned even if the CBP entry changes later. ref= stays for + // resilience (works even when the lookup endpoint is unreachable). + if (IDENT.ctb) url += '&ctb=' + encodeURIComponent(IDENT.ctb); if (gift !== '0') url += '&gift=' + gift; if (self !== '0') url += '&self=' + self; const modeSel = document.getElementById('strategyMode'); @@ -2363,7 +2431,7 @@ function getShareUrl(refUser) { } function updateSharedLinkBox() { - const refUser = getRefFromURL() || 'cryptoteambuild'; + const refUser = getCbpUser(); const shareUrl = getShareUrl(refUser); document.getElementById('sharedLink').value = shareUrl; const signupBtn = document.getElementById('calcSignupBtn'); @@ -2388,7 +2456,7 @@ function copySharedLink() { } function copyCalculatorLink() { - const refUser = getRefFromURL() || 'cryptoteambuild'; + const refUser = getCbpUser(); const url = getShareUrl(refUser); navigator.clipboard.writeText(url).then(() => { const btn = document.querySelector('.cta-btn-secondary'); @@ -2434,7 +2502,7 @@ document.getElementById('heroGuideBtn').addEventListener('click', openGuide); function updateHeroSignupBtn() { // #heroSignupBtn was removed in a redesign; unguarded .href crashed init() // on every load (and killed updateSharedLinkBox below it). Guard it. - const refUser = getRefFromURL() || 'cryptoteambuild'; + const refUser = getCbpUser(); const btn = document.getElementById('heroSignupBtn'); if (btn) btn.href = `https://clickbaitpays.me/?ref=${refUser}`; } @@ -2451,6 +2519,10 @@ function updateHeroSignupBtn() { } updateHeroSignupBtn(); updateSharedLinkBox(); + // Async: resolve the CTB↔ClickBaitPays identity pair and personalize the + // hub links + signup refs when the lookup lands. Defaults already painted + // above, so a slow/failed lookup degrades gracefully to cryptoteambuild. + resolveIdentity(); })(); // ─── Shareable Plan Generator ─────────────────────────────── @@ -2475,8 +2547,9 @@ function generatePlan() { const numPeople = parseInt(document.getElementById('numPeople').value) || 0; const giftLevel = parseInt(document.getElementById('giftLevel').value); const selfLevel = parseInt(document.getElementById('selfFundLevel').value); - const refUser = getRefFromURL() || 'cryptoteambuild'; + const refUser = getCbpUser(); const refLink = getShareUrl(refUser); + const hubLink = hubUrl(); const giftCost = getLevelCost(giftLevel); const selfCost = getLevelCost(selfLevel); const effective = getEffectiveStart(giftLevel, selfLevel); @@ -2517,12 +2590,12 @@ function generatePlan() { const firstPhase = phases.filter(k => k !== '3xL7')[0]; const fp = HYBRIDS[firstPhase]; - pifSteps = `\n**Before we start β€” connect with me first:**\n\nHere's how this works. When you're ready to get started:\n\n1. Join the Telegram sponsor group: https://t.me/+mzXTku1wR7pkODBh\n2. Announce in the group that **${refUser} is my sponsor** β€” just say it so I know who you are\n3. I'll find you in the group, confirm you're my referral, and transfer your Level 1 and Level 2 funds right then\n\n**Once the funds hit your account:**\n\n${giftLevel >= 2 ? `\n**Level 1 setup:**\nβ€’ Go to **"Activate Earnings"** β†’ buy the Level 1 activation ($${LEVELS[0].act})\nβ€’ Go to **"Buy Ad Campaigns"** β†’ purchase the Level 1 campaign ($${LEVELS[0].camp})\n\n**Level 2 setup:**\nβ€’ Go to **"Activate Earnings"** β†’ buy the Level 2 activation ($${LEVELS[1].act})\nβ€’ Go to **"Buy Ad Campaigns"** β†’ purchase the Level 2 campaign ($${LEVELS[1].camp})\n\n**Start clicking!** 3 ads per day for each campaign β€” both run together from day one. L1 pays out ~$${LEVELS[0].payout} and L2 pays out ~$${LEVELS[1].payout} after 12 days.` : `\n4. Go to **"Activate Earnings"** β†’ buy the Level 1 activation ($${LEVELS[0].act}) if you don't already have it\n5. Go to **"Buy Ad Campaigns"** β†’ purchase the Level 1 campaign ($${LEVELS[0].camp})\n6. Start clicking! ${LEVELS[0].clicks} ads per day for 12 days β€” the campaign pays out ~$${LEVELS[0].payout} after`}\n\n**What to do with that first payout:**\n\n${firstPayoutGuidance}\n\nFrom there, you follow the roadmap below β€” the system feeds itself, no new money needed.`; + pifSteps = `\n**Before we start β€” connect with me first:**\n\nHere's how this works. When you're ready to get started:\n\n1. Join my team hub: ${hubLink} β€” signing up through that exact link connects you to me as your sponsor\n2. The hub runs on Telegram, so message me once you're in β€” say **${refUser} sent me** so I know who you are\n3. I'll confirm you're my referral and transfer your Level 1 and Level 2 funds right then\n\n**Once the funds hit your account:**\n\n${giftLevel >= 2 ? `\n**Level 1 setup:**\nβ€’ Go to **"Activate Earnings"** β†’ buy the Level 1 activation ($${LEVELS[0].act})\nβ€’ Go to **"Buy Ad Campaigns"** β†’ purchase the Level 1 campaign ($${LEVELS[0].camp})\n\n**Level 2 setup:**\nβ€’ Go to **"Activate Earnings"** β†’ buy the Level 2 activation ($${LEVELS[1].act})\nβ€’ Go to **"Buy Ad Campaigns"** β†’ purchase the Level 2 campaign ($${LEVELS[1].camp})\n\n**Start clicking!** 3 ads per day for each campaign β€” both run together from day one. L1 pays out ~$${LEVELS[0].payout} and L2 pays out ~$${LEVELS[1].payout} after 12 days.` : `\n4. Go to **"Activate Earnings"** β†’ buy the Level 1 activation ($${LEVELS[0].act}) if you don't already have it\n5. Go to **"Buy Ad Campaigns"** β†’ purchase the Level 1 campaign ($${LEVELS[0].camp})\n6. Start clicking! ${LEVELS[0].clicks} ads per day for 12 days β€” the campaign pays out ~$${LEVELS[0].payout} after`}\n\n**What to do with that first payout:**\n\n${firstPayoutGuidance}\n\nFrom there, you follow the roadmap below β€” the system feeds itself, no new money needed.`; } let rawPlan = alreadyJoined - ? `πŸ“‹ Your ClickBaitPays Plan β€” Full Roadmap\n\nSo what's ClickBaitPays? It's an ad platform where you run small ad campaigns, click a few ads each day, and every ~19 days you get paid more than the campaign cost. You reinvest those payouts into bigger campaigns and scale up. It's simple, takes a few minutes a day, and you can do it from your phone.\n\nHere's a calculator I put together so you can play with the numbers yourself: ${refLink}\n\nCome back to that link anytime β€” it'll walk you through what's possible and the best plan forward as you grow.\n\n${giftCost > 0 ? `${pifSteps}` : ''}\n\n${roadmapHeading}\n\n${phases.filter(k => k !== '3xL7').map((k, i) => phasePlanLine(k, i, PI, mode, pocketPct)).join('\n\n')}\n\n${endgameBlock}\n\n${selfCost > 0 ? `**Your total self-fund: $${selfCost}**${selfCost > giftCost ? ` (you cover $${(selfCost - giftCost).toLocaleString()} after sponsor's gift)` : ''}` : ''}\n\nNo new money needed after the start β€” just run the cycles and follow the phases above.\n\nAs a side note β€” I also earn 10% of everything you get paid through this system, so eventually I'll get my gift back. But that's not why I'm doing this. I genuinely just want to pay it forward and help you get started. You win, I win β€” we both win together.\n\nJoin the sponsor community on Telegram to connect with other members and get help: https://t.me/+mzXTku1wR7pkODBh\n\n${timeLine}\n\nQuick Stats\n${quickMonthly}\nβ€’ Each campaign cycle: 19 days\nβ€’ Min daily clicks: 3-20 (depending on level)\nβ€’ Reward per ad click: $0.48 - $13.50\n\nYour Referral Link\n${refLink}\n\nGood luck β€” the system works if you work the system. πŸ’ͺ` - : `πŸ“‹ Your ClickBaitPays Plan\n\nSo what's ClickBaitPays? It's an ad platform where you run small ad campaigns, click a few ads each day, and every ~19 days you get paid more than the campaign cost. You reinvest those payouts into bigger campaigns and scale up. It's simple, takes a few minutes a day, and you can do it from your phone.\n\nHere's a calculator I put together so you can play with the numbers yourself: ${refLink}\n\nAfter you sign up, come back to that link β€” it'll walk you through what's possible and the best plan forward as you grow.\n\n${giftCost > 0 ? `With me as your sponsor, I'm covering **$${giftCost}** to get you started through Level ${giftLevel} (L${giftLevel === 1 ? '1 only' : `1-L${giftLevel}`}). You owe nothing for this β€” it's funded up front, and you keep 100% of your earnings.` : `I haven't pre-funded any levels on my end β€” you'll be building entirely on your own using the link below.`}\n\n${giftCost > 0 ? pifSteps : ''}\n\n${roadmapHeading}\n\n${phases.filter(k => k !== '3xL7').map((k, i) => phasePlanLine(k, i, PI, mode, pocketPct)).join('\n\n')}\n\n${endgameBlock}\n\n${selfCost > 0 ? `**Your total self-fund: $${selfCost}**${selfCost > giftCost ? ` (you cover $${(selfCost - giftCost).toLocaleString()} after sponsor's gift)` : ''}` : ''}\n\nNo new money needed after the start β€” just run the cycles and follow the phases above.\n\nAs a side note β€” I also earn 10% of everything you get paid through this system, so eventually I'll get my gift back. But that's not why I'm doing this. I genuinely just want to pay it forward and help you get started. You win, I win β€” we both win together.\n\nJoin the sponsor community on Telegram to connect with other members and get help: https://t.me/+mzXTku1wR7pkODBh\n\n${timeLine}\n\nQuick Stats\n${quickMonthly}\nβ€’ Each campaign cycle: 19 days\nβ€’ Min daily clicks: 3-20 (depending on level)\nβ€’ Reward per ad click: $0.48 - $13.50\n\nYour Referral Link\n${refLink}\n\nUse this link to sign up β€” it's how your sponsor tracks your progress. If you have questions, reach out to them directly.\n\nGood luck β€” the system works if you work the system. πŸ’ͺ`; + ? `πŸ“‹ Your ClickBaitPays Plan β€” Full Roadmap\n\nSo what's ClickBaitPays? It's an ad platform where you run small ad campaigns, click a few ads each day, and every ~19 days you get paid more than the campaign cost. You reinvest those payouts into bigger campaigns and scale up. It's simple, takes a few minutes a day, and you can do it from your phone.\n\nHere's a calculator I put together so you can play with the numbers yourself: ${refLink}\n\nCome back to that link anytime β€” it'll walk you through what's possible and the best plan forward as you grow.\n\n${giftCost > 0 ? `${pifSteps}` : ''}\n\n${roadmapHeading}\n\n${phases.filter(k => k !== '3xL7').map((k, i) => phasePlanLine(k, i, PI, mode, pocketPct)).join('\n\n')}\n\n${endgameBlock}\n\n${selfCost > 0 ? `**Your total self-fund: $${selfCost}**${selfCost > giftCost ? ` (you cover $${(selfCost - giftCost).toLocaleString()} after sponsor's gift)` : ''}` : ''}\n\nNo new money needed after the start β€” just run the cycles and follow the phases above.\n\nAs a side note β€” I also earn 10% of everything you get paid through this system, so eventually I'll get my gift back. But that's not why I'm doing this. I genuinely just want to pay it forward and help you get started. You win, I win β€” we both win together.\n\nConnect with the team and get help any time in the team hub: ${hubLink}\n\n${timeLine}\n\nQuick Stats\n${quickMonthly}\nβ€’ Each campaign cycle: 19 days\nβ€’ Min daily clicks: 3-20 (depending on level)\nβ€’ Reward per ad click: $0.48 - $13.50\n\nYour Referral Link\n${refLink}\n\nGood luck β€” the system works if you work the system. πŸ’ͺ` + : `πŸ“‹ Your ClickBaitPays Plan\n\nSo what's ClickBaitPays? It's an ad platform where you run small ad campaigns, click a few ads each day, and every ~19 days you get paid more than the campaign cost. You reinvest those payouts into bigger campaigns and scale up. It's simple, takes a few minutes a day, and you can do it from your phone.\n\nHere's a calculator I put together so you can play with the numbers yourself: ${refLink}\n\nAfter you sign up, come back to that link β€” it'll walk you through what's possible and the best plan forward as you grow.\n\n${giftCost > 0 ? `With me as your sponsor, I'm covering **$${giftCost}** to get you started through Level ${giftLevel} (L${giftLevel === 1 ? '1 only' : `1-L${giftLevel}`}). You owe nothing for this β€” it's funded up front, and you keep 100% of your earnings.` : `I haven't pre-funded any levels on my end β€” you'll be building entirely on your own using the link below.`}\n\n${giftCost > 0 ? pifSteps : ''}\n\n${roadmapHeading}\n\n${phases.filter(k => k !== '3xL7').map((k, i) => phasePlanLine(k, i, PI, mode, pocketPct)).join('\n\n')}\n\n${endgameBlock}\n\n${selfCost > 0 ? `**Your total self-fund: $${selfCost}**${selfCost > giftCost ? ` (you cover $${(selfCost - giftCost).toLocaleString()} after sponsor's gift)` : ''}` : ''}\n\nNo new money needed after the start β€” just run the cycles and follow the phases above.\n\nAs a side note β€” I also earn 10% of everything you get paid through this system, so eventually I'll get my gift back. But that's not why I'm doing this. I genuinely just want to pay it forward and help you get started. You win, I win β€” we both win together.\n\nConnect with the team and get help any time in the team hub: ${hubLink}\n\n${timeLine}\n\nQuick Stats\n${quickMonthly}\nβ€’ Each campaign cycle: 19 days\nβ€’ Min daily clicks: 3-20 (depending on level)\nβ€’ Reward per ad click: $0.48 - $13.50\n\nYour Referral Link\n${refLink}\n\nUse this link to sign up β€” it's how your sponsor tracks your progress. If you have questions, reach out to them directly.\n\nGood luck β€” the system works if you work the system. πŸ’ͺ`; document.getElementById('planOutput').innerHTML = rawPlan.replace(/\*\*(.*?)\*\*/g, '$1'); document.getElementById('planOutput').dataset.rawPlan = rawPlan; @@ -2706,7 +2779,7 @@ function updateROI() { // ─── localStorage persistence ────────────────────────── function getROIStorageKey() { - const ref = getRefFromURL() || 'cryptoteambuild'; + const ref = getCbpUser(); return 'cbp_roi_' + ref; }