Files
rm-circle-team-router/public/track.js
T
martbost ec2091631e Add /training page with four self-hosted walkthrough videos
- Videos loudness-normalized to -16 LUFS (originals were ~-33 LUFS).
- Static file serving rewritten to stream with HTTP Range support so
  video seeking works; .mp4/.webm MIME types added.
- Training nav links on homepage and /start, plus a first-time callout
  on /start; training page views tracked per source in admin analytics.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-12 07:32:59 -05:00

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