window.initializeGAnalytics=n=>{function t(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[];const r=n.enableAjaxHeaderConsumer!==!1,u=n.trackPageView!==!1,f={custom_platform:n.platform,whitelabel_id:n.wlbId,site_template_variation:n.variation,site_theme:n.theme,internal:!0};t("js",new Date);t("config",n.gaId,{send_page_view:!1});window._GASetUser=n=>{n&&t("set","user_id",n)};window._GAClearUser=()=>{t("set","user_id",null)};n.userId&&window._GASetUser(n.userId);window._GASendEvent=(i,r={},u)=>{if(!i){typeof u=="function"&&u();return}const e={...f,...(r||{}),send_to:n.gaId};if(typeof u=="function"){let n=!1;e.event_callback=()=>{n||(n=!0,u())};e.event_timeout=1e3}t("event",i,e)};window.dispatchFootmarkEvents=(n,t)=>{const i=Array.isArray(n)?n:[];if(!i.length){typeof t=="function"&&t();return}let f=i.length,e=!1,r=null;const o=()=>{e||(e=!0,r&&window.clearTimeout(r),typeof t=="function"&&t())},u=()=>{f--,f<=0&&o()};typeof t=="function"&&(r=window.setTimeout(o,1500));i.forEach(n=>{if(!n||!n.eventType){u();return}try{window._GASendEvent(n.eventType,n.payload||{},u)}catch(t){console.log("Failed to dispatch footmark event:",t);u()}})};window.consumeFootmarkEventHeader=n=>{if(n)try{const t=JSON.parse(n);window.dispatchFootmarkEvents(t)}catch(t){console.log("Failed to parse footmark event header:",t)}};const i=()=>{if(r&&!window._GAFootmarkAjaxHookRegistered){if(!window.jQuery){window.setTimeout(i,100);return}window._GAFootmarkAjaxHookRegistered=!0;window.jQuery(document).ajaxComplete((n,t)=>{t&&t.getResponseHeader&&window.consumeFootmarkEventHeader(t.getResponseHeader("X-Footmark-Events"))})}};i();window._GATrackPageView=()=>{window._GASendEvent("page_view",{page_title:document.title,page_location:location.href,page_path:location.pathname,page_referrer:document.referrer||""})};u&&window.addEventListener("load",()=>{window._GATrackPageView()})};