const acceptedMessageOrigins=["https://d3sf7lrtfnidin.cloudfront.net","https://d3g6ix8apt5w4m.cloudfront.net"];const sessionCookieKeys=["tildasid","_gid"];const userCookieKeys=["tildauid","_ga"];const mktSubmittedEvents={};const mktCompanyId="4ae6ebe7-f6fe-4d68-9220-7a81f1aef854";const mktProjectId="949c8930-6fa3-4951-abd3-2b41778a43e2";(function populateSessionParams(){if("mkt_session_params"in sessionStorage){return;} function parseUrlParams(){const matchKey=(pattern)=>(([key])=>key.match(pattern));const parseParam=([key,value])=>{const[_,stem]=key.split('_',2);return[stem,value];};const parseParams=(params,pattern)=>Object.fromEntries(params.filter(matchKey(pattern)).map(parseParam));const url=new URL(window.location.href);const searchParams=Array.from(url.searchParams.entries());const utmParams=parseParams(searchParams,/^utm_/);const mParams=parseParams(searchParams,/^m_/);return{...utmParams,...mParams};} const cookieParams=Object.fromEntries(document.cookie.split("; ").map((x)=>x.split("=")));const fbp=cookieParams._fbp;const fbc=cookieParams._fbc;let sessionId=null;if(typeof mkt_session_id_field!=="undefined"){sessionId=cookieParams[mkt_session_id_field];} else{sessionCookieKeys.every((key)=>{if(key in cookieParams){sessionId=cookieParams[key];return false;} return true;})} let cookieId=null;if(typeof mkt_cookie_id_field!=="undefined"){cookieId=cookieParams[mkt_cookie_id_field];} else{userCookieKeys.every((key)=>{if(key in cookieParams){cookieId=cookieParams[key];return false;} return true;})} let user_id=null;if(typeof mkt_user_id!=="undefined"){user_id=mkt_user_id;} sessionStorage.setItem("mkt_session_params",JSON.stringify({cookie_id:cookieId,session_id:sessionId,fb_browser_id:fbp,fb_click_id:fbc,user_agent:navigator.userAgent,tracking_parameters:parseUrlParams(),user_id:user_id}));})();async function mktTrack(data){const time=new Date();if(!("property_id"in data)&&typeof mktPropertyId!=="undefined"){data.property_id=mktPropertyId;} if(!("project_id"in data)){data.project_id=mktProjectId;} if(!("company_id"in data)){data.company_id=mktCompanyId;} const hashKey=[data.event_type,data.project_id,data.property_id].join("_") if(hashKey in mktSubmittedEvents&&time-mktSubmittedEvents[hashKey]<2000){return} mktSubmittedEvents[hashKey]=time;const body={session:JSON.parse(sessionStorage.getItem("mkt_session_params")),url:window.location.href,event_time:time.toISOString(),...data};await fetch("https://marketer-analytics-production.herokuapp.com/event",{method:"post",headers:{"Content-Type":"application/json;charset=utf-8"},body:JSON.stringify(body)});} window.addEventListener("message",(e)=>{if(acceptedMessageOrigins.includes(e.origin)){try{const data=JSON.parse(e.data);if("analyticsPayload"in data){mktTrack(data.analyticsPayload);}}catch(error){if(error.name!=="SyntaxError"){throw error}}}}) mktTrack({event_type:"page_view"});