!function(){let e=e=>new URLSearchParams(window.location.search).get(e)||"",t=(e,t,n=30)=>{let o=new Date(Date.now()+864e5*n).toUTCString();document.cookie=`${e}=${encodeURIComponent(t)}; expires=${o}; path=/`},n=e=>{let t=document.cookie.split("; ").find(t=>t.startsWith(`${e}=`));return t?decodeURIComponent(t.split("=")[1]):null},o=async(t,o={})=>{let i=e("clickId")||n("clickId");if(!i)return void console.warn("[FortuneJS] ClickId not found. Event not sent.");let r=n("_fbp"),c={event:t,clickId:i,url:window.location.href,timestamp:new Date().toISOString(),fbp:r||null,...o};console.log(`[FortuneJS] Sending event: ${t}`,c);try{let a=await fetch("https://api.adfortune.net/api/MetaConversion/track-event",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c),keepalive:!0});if(!a.ok)throw Error(`HTTP Error ${a.status}`)}catch(s){console.error("[FortuneJS] Failed to send event:",s)}};!function(){let n=e("clickId");n&&t("clickId",n,30),console.log("[FortuneJS] Initialized."),o("Pageview")}(),window.trackEvent=(e,t={})=>{o(e,t)}}();