9dbe7eddcb
- Self-enroll pageviews now tracked as the "joinnow" event (track.js loaded on the page; server whitelist + admin tiles/columns extended) - A confirmed on-chain registration in the wallet-connect flow now auto-posts to the submit-id API, so every self-enroll join records a submission with source + clickid attribution and fires the purchase event and BeMob postback with no manual ID entry - Optional name/handle field on the join page feeds the submission and the team Telegram alert - Admin Traffic panel: Join-now views tile, Join-now -> Confirmed conversion, and a per-source Confirmed column for campaign-level ROI reading Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
25 lines
1.2 KiB
JavaScript
25 lines
1.2 KiB
JavaScript
(function(){
|
|
function getSource(){
|
|
try{
|
|
let s=sessionStorage.getItem('ctb.src');
|
|
if(s)return s;
|
|
const p=new URLSearchParams(location.search);
|
|
s=p.get('utm_source')||p.get('src')||'';
|
|
if(!s&&document.referrer){try{const h=new URL(document.referrer).hostname;if(h&&h!==location.hostname)s=h}catch(e){}}
|
|
s=s||'(direct)';
|
|
sessionStorage.setItem('ctb.src',s);
|
|
return s;
|
|
}catch(e){return '(direct)'}
|
|
}
|
|
window.ctbGetSource=getSource;
|
|
try{
|
|
const p2=new URLSearchParams(location.search);
|
|
const cid=p2.get('clickid')||p2.get('cid');
|
|
if(cid&&!sessionStorage.getItem('ctb.clickid'))sessionStorage.setItem('ctb.clickid',cid.slice(0,80));
|
|
}catch(e){}
|
|
window.ctbGetClickId=function(){try{return sessionStorage.getItem('ctb.clickid')||''}catch(e){return ''}};
|
|
const path=location.pathname.replace(/\/$/,'')||'/';
|
|
const page=path==='/'?'bridge':(path==='/start'?'start':(path==='/training'?'training':(path==='/join-now'?'joinnow':(/^\/join\/\d+$/.test(path)?'join':null))));
|
|
if(page)fetch('/api/public/track',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({event:page,source:getSource()})}).catch(()=>{});
|
|
})();
|