(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; const path=location.pathname.replace(/\/$/,'')||'/'; const page=path==='/'?'bridge':(path==='/start'?'start':null); if(page)fetch('/api/public/track',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({event:page,source:getSource()})}).catch(()=>{}); })();