let send_data_beacon=e=>{try{let t=new FormData;t.append("data",JSON.stringify(e)),navigator.sendBeacon(`${pixel_url_base}pixel-track/${pixel_key}`,t)}catch(r){console.log(`Analytics pixel: ${r}`)}};class AltumCodeEvents{constructor(){window[pixel_exposed_identifier]={goal:e=>{this.event_goal_conversion(e)}};let e=new URLSearchParams(window.location.search),t=new URL(document.location.toString()).searchParams.toString(),r={path:window.location.pathname+(pixel_query_parameters_tracking_is_enabled&&t?"?"+t:""),referrer:document.referrer.includes(`${location.protocol}//${location.host}${location.pathname}`)?null:document.referrer,utm:{source:e.get("utm_source"),medium:e.get("utm_medium"),campaign:e.get("utm_campaign")},resolution:{width:window.screen.width,height:window.screen.height},timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,theme:window?.matchMedia?.("(prefers-color-scheme:dark)")?.matches?"dark":"light"},a=document.createElement("a");a.href=document.referrer;let o=document.createElement("a");o.href=window.location.href;let n=""==document.referrer.trim()||a.hostname!=o.hostname?"landing_page":"pageview";if(send_data_beacon({type:n,url:window.location.href,data:r}),pixel_goals.length){let l=get_current_url_domain_no_www();for(let i of pixel_goals)"pageview"==i.type&&(i.url==l||i.url=="www."+l)&&this.event_goal_conversion(i.key)}}event_goal_conversion(e){for(let t of pixel_goals)if(t.key==e){send_data_beacon({type:"goal_conversion",url:window.location.href,goal_key:t.key});break}}}
