1!function(){const e=document.currentScript||function(){const e=document.getElementsByTagName("script");return e[e.length-1]}(),t="magic-link"===function(){try{if(e&&e.src)return new URL(e.src).searchParams.get("mode")||""}catch(e){}return""}(),n=function(){if(!t)return null;const e=document.querySelector("script[data-magic-link-id]");return e?{utmSource:e.getAttribute("data-utm-source")||null,utmMedium:e.getAttribute("data-utm-medium")||null,utmCampaign:e.getAttribute("data-utm-campaign")||null,utmTerm:e.getAttribute("data-utm-term")||null,utmContent:e.getAttribute("data-utm-content")||null}:null}();function o(e,n,o){if(t)try{window.dispatchEvent(new CustomEvent(e,{detail:{success:!1!==n,reason:o||null}}))}catch(e){}}let i=null;if(e&&(i=e.getAttribute("data-site-id")),!i&&e&&e.src){const t=new URL(e.src);i=t.searchParams.get("site-id")||t.searchParams.get("siteId")}if(!i&&window.avelorSiteId&&(i=window.avelorSiteId),!i&&e&&e.innerHTML){const t=e.innerHTML.match(/["'](avl_[a-zA-Z0-9_-]+|AVELOR-[a-zA-Z0-9_-]+|VT-[a-zA-Z0-9_-]+)["']/);t&&(i=t[1])}if(!i){const e=document.getElementsByTagName("script");for(let t=0;t<e.length;t++){const n=e[t].getAttribute("data-site-id");if(n&&(n.startsWith("avl_")||n.startsWith("AVELOR-")||n.startsWith("VT-"))){i=n;break}}}if(!i)return console.error("Missing site ID. For GTM installation, use one of these methods:"),console.error('1. Set window.avelorSiteId = "YOUR_SITE_ID" before loading tracker.js'),console.error("2. Add ?site-id=YOUR_SITE_ID to the tracker.js URL"),console.error("3. Use data-site-id attribute (may be stripped by GTM)"),void console.error("4. Include site ID in script content for custom HTML tags");if(window.vtTrackerInitialized||window.avelorTrackerInitialized){const e=window.vtSiteId||window.avelorSiteId||null;if(e&&e!==i&&"function"==typeof window.vtTrackerSwitchSiteId){try{window.vtTrackerSwitchSiteId(i)}catch(e){}return}console.warn("Tracker already initialized, skipping duplicate initialization");try{"function"==typeof window.vtTrackerReinitializePage?window.vtTrackerReinitializePage():"function"==typeof window.avelorTrackerReinitializePage&&window.avelorTrackerReinitializePage()}catch(e){}return}window.avelorUpdateCurrentConversionWithPixels=Ht,window.vtTrackerInitialized=!0,window.avelorTrackerInitialized=!0,(window.vtDebugMode||window.avelorDebugMode||new URLSearchParams(window.location.search).get("vt_debug"))&&console.log(`Site ID detected: ${i}`),window.vtSiteId=i,window.avelorSiteId=i,t&&(window.vtTrackerMode="magic-link");let r=null,a="/",c="";const s="vt_google_click",l=7776e6,d=["gclid","gbraid","wbraid"],u=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],m=["vt_campaign","vt_adset","vt_ad"];function g(){try{window.vtExternalPlatformMode=r}catch{}try{window.vtCookiePathOverride=a}catch{}try{window.vtScopedStorageSuffix=c}catch{}}function f(){return{mode:r,path:a||"/",suffix:c||""}}function p(e){let t=2166136261;const n=String(e||"");for(let e=0;e<n.length;e++)t^=n.charCodeAt(e),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function w(e){try{if(!e||"trustmarkt"!==e.externalPlatform||!e.externalScope)return r=null,a="/",c="",void g();const n=e.externalScope||{},o=(t=n.host||window.location.hostname||"external",String(t||"").toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"").substring(0,80)),s=function(e){const t=String(e||"").trim();if(!t||"/"===t)return"/";const n=t.split("?")[0].split("#")[0],o="/"===n.charAt(0)?n:"/"+n;return(o.length>1?o.replace(/\/+$/,""):o)||"/"}(n.pathPrefix||"/");r="trustmarkt",a=s,c="__tm_"+p(i+"|"+o+"|"+s),g()}catch{}var t}function h(){return"trustmarkt"===r}function v(e){return h()?!e||0!==String(e).indexOf("vt_")&&0!==String(e).indexOf("avelor_")&&0!==String(e).indexOf("_vt_")?e:String(e)+c:e}function y(e,t){try{const n="expires=Thu, 01 Jan 1970 00:00:01 GMT",o={};o[t||"/"]=!0,o["/"]=!0;const i=window.location.hostname||"",r=i.split("."),a=r.length>=2?"."+r.slice(-2).join("."):null;Object.keys(o).forEach(function(t){try{document.cookie=e+"=; "+n+"; path="+t+"; SameSite=Lax"}catch(e){}if(a)try{document.cookie=e+"=; "+n+"; path="+t+"; domain="+a+"; SameSite=Lax"}catch(e){}if(i)try{document.cookie=e+"=; "+n+"; path="+t+"; domain=."+i+"; SameSite=Lax"}catch(e){}})}catch(e){}}function _(e){try{window.__vtBlockAll=!0}catch(e){}try{ct=!1}catch(e){}try{st=null}catch(e){}try{it=null}catch(e){}try{rt=null}catch(e){}try{Oe()}catch(e){}try{Ae.clear()}catch(e){}try{if(window._paq&&"function"==typeof window._paq.push){try{window._paq.push(["forgetCookieConsentGiven"])}catch(e){}try{window._paq.push(["disableCookies"])}catch(e){}}}catch(e){}!function(){try{if(["avelor-cookie-banner","avelor-cookie-details-dialog","avelor-cookie-sett
1ings-icon"].forEach(function(e){try{const t=document.getElementById(e);t&&t.parentNode&&t.parentNode.removeChild(t)}catch(e){}}),window.avelorCookie&&"function"==typeof window.avelorCookie.removeUi)try{window.avelorCookie.removeUi()}catch(e){}}catch(e){}}(),function(e){try{if(!e||"trustmarkt"!==e.mode)return;["vt_consent_prefs","_vt_consent_pref","vt_consent_id","vt_session_id","avelor_session_id","vt_user_hash","avelor_user_hash","vt_cookies_accepted","vt_cookies_functionality","vt_cookies_experience","vt_cookies_performance","vt_cookies_marketing","vt_cookies_other","avelor_cookies_accepted","avelor_cookies_functionality","avelor_cookies_experience","avelor_cookies_performance","avelor_cookies_marketing","avelor_cookies_other","vt_google_click","vt_ttclid","vt_li_fat_id","li_fat_id"].forEach(function(t){y(function(e,t){const n=String(e||"");return t&&"trustmarkt"===t.mode&&t.suffix?0!==n.indexOf("vt_")&&0!==n.indexOf("avelor_")&&0!==n.indexOf("_vt_")?n:n+t.suffix:n}(t,e),e.path||"/"),y(t,e.path||"/")});const t="_vt_tm_"+p(i+"|"+window.location.hostname+"|"+(e.path||"/"))+"_",n=document.cookie?document.cookie.split(";"):[];for(let o=0;o<n.length;o++){const i=n[o].trim(),r=i.indexOf("="),a=r>=0?i.substring(0,r):i;a&&0===a.indexOf(t)&&y(a,e.path||"/")}["vt_session_id","vt_user_hash","wf_lead"].forEach(function(t){try{e.suffix&&localStorage.removeItem(t+e.suffix)}catch(e){}}),["vt_matomo_vid","vt_click_gclid","vt_click_gbraid","vt_click_wbraid","vt_click_fbp","vt_click_fbc","vt_click_ttclid","vt_click_li_fat_id","vt_click_oppref","vt_click_obref"].forEach(function(e){try{sessionStorage.removeItem(e)}catch(e){}})}catch(e){}}(e)}function k(){try{if(!h())return;_(f())}catch(e){}}function b(e){return h()?String(e)+c:e}function I(e){return localStorage.getItem(b(e))}function S(e,t){localStorage.setItem(b(e),t)}function C(e){localStorage.removeItem(b(e))}function x(){return"vt_matomo_campaign_context_v1_"+String(i||"")}function $(){try{sessionStorage.removeItem(x())}catch(e){Ye(e,"campaign-context-clear")}}function T(e){const t={},n=u.concat(m);for(let o=0;o<n.length;o++){const i=n[o],r=e.searchParams.get(i);null!==r&&""!==r&&(t[i]=r.substring(0,500))}const o=function(e){const t="string"==typeof e?e.trim():"";if(!t||t.length>2500)return null;const n=t.split("_").map(function(e){return e.trim()});if(!n[0]||!n[1])return null;const o=n.length>5;return{utm_source:n[0],utm_medium:n[1],utm_campaign:o?null:n[2]||null,utm_content:o?null:n[3]||null,utm_term:o?null:n[4]||null}}(e.searchParams.get("perspective_source"));if(o)for(let e=0;e<u.length;e++){const n=u[e];!t[n]&&o[n]&&(t[n]=o[n].substring(0,500))}return t}function N(e,t,n){if(!t)return e;for(let o=0;o<n.length;o++){const i=n[o];!e[i]&&t[i]&&(e[i]=t[i])}return e}function A(e,t){for(let n=0;n<t.length;n++)if(e[t[n]])return!0;return!1}function M(e,t){if(!t||!A(e,u))return!1;for(let n=0;n<u.length;n++){const o=u[n];if((e[o]||"")!==(t[o]||""))return!1}return!0}function E(){if(!document.referrer)return!1;try{const e=new URL(document.referrer),t=new URL(window.location.href);if(e.origin===t.origin)return!0;if(e.protocol!==t.protocol||e.port!==t.port)return!1;const n=e.hostname.toLowerCase(),o=t.hostname.toLowerCase();return n==="www."+o||o==="www."+n}catch(e){return!1}}function D(e,t){return m.some(function(n){return e[n]&&e[n]!==t[n]})}function P(){if(!X())return{};const e=T(new URL(window.location.href));if(!E())return e;const t=u.concat(m),n=T(new URL(document.referrer));A(e,t)?M(e,n)&&!D(e,n)&&N(e,n,m):N(e,n,t);const o=function(){if(!X())return null;let e=null;try{e=sessionStorage.getItem(x())}catch(e){return Ye(e,"campaign-context-read"),null}if(!e)return null;try{const t=JSON.parse(e);if(!t||"object"!=typeof t||Array.isArray(t))return $(),null;const n={},o=u.concat(m);for(let e=0;e<o.length;e++){const i=o[e];"string"==typeof t[i]&&t[i]&&(n[i]=t[i].substring(0,500))}return Object.keys(n).length>0?n:null}catch(e){return Ye(e,"campaign-context-parse"),$(),null}}();return M(e,o)&&!D(e,o)&&N(e,o,m),e}function L(){const e=new URL(window.location.href);if(!X())return e.toString();const t=P(),n=u.concat(m);if(!A(t,n))return e.toString();for(let o=0;o<n.length;o++){const i=n[o];!e.searchParams.get(i)&&t[i]&&e.searchParams.set(i,t[i])}if(A(t,m))try{sessionStorage.setItem(x(),JSON.stringify(t))}catch(e){Ye(e,"campaign-context-write")}else $();return e.toString()}let U=null;function q(e,t){if(!U||U.errors.length>=8)return;if(!/^(diagnostic-|visitor-cookie-read$|visitor-id-read$|visitor-id-write$|visitor-session-write$|campaign-context-)/.test(t))return;const n=["SecurityError","QuotaExceededError","SyntaxError","TypeError","Error"].indexOf(e&&e.name)>=0?e.name:"Other";U.errors.some(function(e){return e.operation===t&&e.name===n})||U.errors.push({operation:t,name:n})}function O(e,t){try{const n="cookie"===e?te(U.matomoSiteId):("local"===e?localStorage:sessionStorage).getItem(t);return{state:n?"present":"missing",value:n||null}}catch(t){return Ye(t,"diagnostic-"+e+"-read"),{state:"unreadable",value:null}}}function R(){const e=U,t=O("cookie");try{document.cookie}catch(e){t.state="unreadable",q(e,"diagnostic-cookie-read")}const n=O("local",K(e.matomoSiteId)),o=O("session","vt_matomo_vid");
1[n,o].forEach(function(e){"present"!==e.state||V(e.value)||(e.state="invalid")});const i=O("session",x());let r=null;if(i.value)try{r=JSON.parse(i.value),r&&"object"==typeof r&&!Array.isArray(r)||(i.state="invalid",r=null,Ye(new Error("Invalid campaign context"),"campaign-context-invalid"))}catch(e){i.state="invalid",Ye(e,"campaign-context-parse")}const a=T(new URL(window.location.href)),c=E()?T(new URL(document.referrer)):{},s=function(t){return"present"===t.state&&e.selected?t.value===e.selected:null},l=window.performance&&window.performance.getEntriesByType?window.performance.getEntriesByType("navigation")[0]:null;return{source:e.source,elapsedMs:Math.min(864e5,Math.max(0,Date.now()-e.started)),cookie:t.state,local:n.state,session:o.state,campaign:i.state,cookieMatchesSelected:s(t),localMatchesSelected:s(n),sessionMatchesSelected:s(o),campaignMatchesReferrer:r?M(c,r)&&!D(c,r):null,urlVt:A(a,m),referrerVt:A(c,m),storedVt:!!r&&A(r,m),navigation:l&&["navigate","reload","back_forward","prerender"].indexOf(l.type)>=0?l.type:"unknown",cookieId:t.value,localId:n.value,sessionId:o.value,selectedId:e.selected,confirmedId:e.confirmed}}async function z(e){if(!e)return null;const t=(new TextEncoder).encode("vt-funnel-diagnostic-v1|"+i+"|"+e),n=await window.crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(function(e){return e.toString(16).padStart(2,"0")}).join("")}function j(){const e=U;return e&&i===e.trackingCode&&Date.now()<e.expiresAt&&!window.__vtBlockAll&&!h()&&(!window.vtBannerMode||"disabled"===window.vtBannerMode)&&e.paths.indexOf(window.location.pathname)>=0}function B(e,t,n){if(!j())return;const o=U;if(o.sequence>=12||o.sent.has(e)&&"pageshow"!==e)return;o.sent.add(e);const r=n||R(),a={version:1,trackingCode:i,path:window.location.pathname,pageId:o.pageId,clickHash:o.clickHash,selectedIdHash:o.hashes.get(r.selectedId)||null,confirmedIdHash:o.hashes.get(r.confirmedId)||null,cookieIdHash:o.hashes.get(r.cookieId)||null,localIdHash:o.hashes.get(r.localId)||null,sessionIdHash:o.hashes.get(r.sessionId)||null,event:e,sequence:++o.sequence,elapsedMs:Math.min(864e5,Math.max(0,Date.now()-o.started)),source:o.source,persisted:!0===t,...r,errors:o.errors.splice(0,8)};delete a.cookieId,delete a.localId,delete a.sessionId,delete a.selectedId,delete a.confirmedId,fetch(Et+"/api/tracker/funnel-diagnostics",{method:"POST",mode:"cors",credentials:"omit",keepalive:!0,headers:{"Content-Type":"text/plain;charset=UTF-8"},body:JSON.stringify(a)}).then(function(e){if(!e.ok)throw new Error("Diagnostic request failed: "+e.status)}).catch(function(e){Ye(e,"diagnostic-send")})}function F(e,t,n){if(!j())return t;const o=U;return n?o.confirmed=t:(o.source=e,o.selected=t),z(t).then(function(e){e&&o.hashes.set(t,e),B(n?"identity-confirmed":"identity-selected")}).catch(function(e){Ye(e,"diagnostic-hash")}),t}function V(e){return"string"==typeof e&&/^[a-f0-9]{16}$/i.test(e)}let W=null,G=null;function H(){return h()||X()}function J(e,t){if(!e||!V(t)||!H())return null;const n=String(e),o=window.__vtMatomoSiteId?String(window.__vtMatomoSiteId):null;if(o&&o!==n)return null;const i=t.toLowerCase();G=n,W=i;try{sessionStorage.setItem("vt_matomo_vid",i)}catch(e){Ye(e,"visitor-session-write")}try{ne(e,i)}catch(e){}return F(null,i,!0),i}function Q(e){if(!e||G===String(e)){G=null,W=null;try{sessionStorage.removeItem("vt_matomo_vid")}catch(e){}}}function K(e){return"_vt_id."+String(e||"")}function Y(e){return"vt_matomo_visitor_id_v1_"+String(e||"")}function Z(){return!0===it&&"active"===window.vtBannerMode}function X(){return!h()&&("true"===Wt("vt_cookies_performance")||!1===it||"disabled"===window.vtBannerMode||"visual"===window.vtBannerMode||"partial"===window.vtBannerMode)}function ee(){return"true"===Wt("vt_cookies_marketing")||"true"===Wt("avelor_cookies_marketing")||!1===it||"disabled"===window.vtBannerMode||"visual"===window.vtBannerMode||"partial"===window.vtBannerMode}function te(e){try{const t=document.cookie||"",n=String(e||""),o=["_vt_id."+n+".","_pk_id."+n+"."],i=t.split(";");for(let e=0;e<o.length;e++){const t=o[e];for(let e=0;e<i.length;e++){const n=i[e].trim(),o=n.indexOf("=");if(0!==(o>=0?n.substring(0,o):n).indexOf(t))continue;const r=o>=0?n.substring(o+1):"",a=r?r.split(".")[0]:null;if(V(a))return a.toLowerCase()}}}catch(e){Ye(e,"visitor-cookie-read")}return null}function ne(e,t){if(!e||!X()||!V(t))return!1;try{S(K(e),t.toLowerCase())}catch(e){return Ye(e,"visitor-id-write"),!1}try{C(Y(e))}catch(e){}return!0}function oe(e){if(e){Q(e);try{C(K(e))}catch(e){}try{C(Y(e))}catch(e){}}}function ie(){if(!window.crypto||"function"!=typeof window.crypto.getRandomValues)return null;try{const e=new Uint8Array(8);return window.crypto.getRandomValues(e),Array.from(e).map(function(e){return e.toString(16).padStart(2,"0")}).join("")}catch(e){return null}}window.vtPageStartTime=Date.now(),window.avelorPageStartTime=window.vtPageStartTime;try{window.__vtLastReinitPathkey=window.location.origin+window.location.pathname}catch(e){}try{if("true"===Wt("vt_cookies_marketing")){Ln(),Mn(),En(),On();try{ae()}catch(e){}}else Dn(),Pn(),ce()}catch(e){}function re(e){try{const t=document.cookie?document.cookie.match(new RegExp("(?:^|; )"+e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"=([^;]*)")):null;return t&&t[1]?decodeURIComponent(t[1]):null}catch(e){return null}}function ae(){try{const e=new URLSearchParams(window.location.search).get("oppref")||re("__oppref"),t=re("__obref");e&&sessionStorage.setItem("vt_click_oppref",e),t&&sessionStorage.setItem("vt_click_obref",t)}catch(e){}}function ce(){try{sessionStorage.removeItem("vt_click_oppref")}catch(e){}try{sessionStorage.removeItem("vt_click_obref")}catch(e){}}function se(){try{return ae(),{oppref:sessionStorage.getItem("vt_click_oppref")||null,obref:re("__obref")||sessionStorage.getItem("vt_click_obref")||null}}catch(e){return{oppref:null,obref:null}}}const le={facebook:new Set,linkedin:new Set,googleads:new Set,tiktok:new Set,openai:new Set},de=function(){try{return window.__vtGoogleAdsPageViewSent&&"function"==typeof window.__vtGoogleAdsPageViewSent.has||(window.__vtGoogleAdsPageViewSent=new Set),window.__vtGoogleAdsPageViewSent}catch(e){return new Set}}();function ue(e){try{if(!e)return;const t=`${e}__${function(){try{return window.location.origin+window.location.pathname}catch(e){return""}}()}`;if(de.has(t))return;de.add(t);try{"function"==typeof window.gtag&&window.gtag("event","page_view",{send_to:e})}catch(e){}}catch(e){}}let me=!1;const ge=new Set(["AddPaymentInfo","AddToCart","AddToWishlist","CompleteRegistration","Contact","CustomizeProduct","Donate","FindLocation","InitiateCheckout","Lead","PageView","Purchase","Sc
1hedule","Search","StartTrial","SubmitApplication","Subscribe","ViewContent"]);function fe(e,t,n,o,i){const r=ge.has(t)?"trackSingle":"trackSingleCustom";window.fbq(r,e,t,n,{eventID:o}),"function"==typeof i&&i(o)}window.vtUpdateMatomoConsent=function(e){try{if(window._paq=window._paq||[],e){try{window._paq.push(["setCookieConsentGiven"])}catch(e){}try{window._paq.push(["trackEvent","vt_consent","performance","granted"])}catch(e){}L();try{window._paq.push([function(){try{var e=this.getVisitorId&&this.getVisitorId();e&&J(window.__vtMatomoSiteId,e)}catch(e){}}])}catch(e){}}else{if(!Z())return;try{window._paq.push(["forgetCookieConsentGiven"])}catch(e){}try{window._paq.push(["disableCookies"])}catch(e){}try{const e=document.cookie?document.cookie.split(";"):[],t=window.location.hostname||"",n=t.split("."),o=n.length>=2?"."+n.slice(-2).join("."):null;for(let n=0;n<e.length;n++){const i=e[n].trim(),r=i.indexOf("="),a=r>=0?i.substring(0,r):i;if(/^_(pk|vt)_(id|ses|ref)\./.test(a)){const e="expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/";try{document.cookie=`${a}=; ${e}`}catch(e){}if(o)try{document.cookie=`${a}=; ${e}; domain=${o}`}catch(e){}try{document.cookie=`${a}=; ${e}; domain=.${t}`}catch(e){}}}}catch(e){}try{Q(window.__vtMatomoSiteId)}catch(e){}$();try{oe(window.__vtMatomoSiteId)}catch(e){}}}catch(e){}};const pe=new Map,we=new Map,he=new Map,ve=new Map,ye=new Set,_e=new Set;let ke=null,be=!1,Ie=null,Se=null,Ce=null,xe=null,$e=null;const Te=function(){try{return window.__vtExecutedCustomCodeIntegrations&&"function"==typeof window.__vtExecutedCustomCodeIntegrations.has||(window.__vtExecutedCustomCodeIntegrations=new Set),window.__vtExecutedCustomCodeIntegrations}catch(e){return new Set}}(),Ne=function(){try{return window.__vtExecutedCustomCodeEvents&&"function"==typeof window.__vtExecutedCustomCodeEvents.has||(window.__vtExecutedCustomCodeEvents=new Set),window.__vtExecutedCustomCodeEvents}catch(e){return new Set}}(),Ae=new Set,Me=(new Set,new Set),Ee=new Set,De=new Map;function Pe(){try{return Array.from(De.get(String(window.location.href))||[])}catch(e){return[]}}const Le=new Map,Ue=new Map;let qe={key:null,expiresAt:0,data:null};function Oe(){qe={key:null,expiresAt:0,data:null}}function Re(){if(window.__vtBlockAll)return Promise.resolve(null);const e=window.location.href,t=`${Et}|${i}|${e}`,n=Date.now();if(qe.key===t&&qe.expiresAt>n)return Promise.resolve(qe.data);const o=Ue.get(t);if(o)return o;const r=fetch(`${Et}/api/triggers/check?trackingCode=${i}&url=${encodeURIComponent(e)}`,{method:"GET",mode:"cors",headers:{"Content-Type":"application/json"}}).then(e=>e.ok?e.json():null).then(e=>{const n=e&&Array.isArray(e.triggers)?e:{triggers:[]};return qe={key:t,expiresAt:Date.now()+3e3,data:n},n}).catch(e=>(console.warn("Error fetching triggers",e),null)).finally(()=>{Ue.delete(t)});return Ue.set(t,r),r}window.vtTrackerReinitializePage=function(){try{if(window.__vtArchivedSite)return}catch(e){}try{const e=window.location.origin+window.location.pathname;if(window.__vtLastReinitPathkey===e)return;window.__vtLastReinitPathkey=e}catch(e){}try{window.vtPageStartTime=Date.now(),window.avelorPageStartTime=window.vtPageStartTime}catch(e){}(async()=>{try{const e=f();if(!await Xe())return _(e),void Be("Trustmarkt scope left - tracking blocked for current URL");try{window.__vtBlockAll=!1}catch(e){}try{Ae.clear()}catch(e){}try{Oe()}catch(e){}try{ct=null}catch(e){}try{it=null}catch(e){}try{if(window._paq&&"function"==typeof window._paq.push){let e=window.location.origin+window.location.pathname;try{window._paq.push(["setCustomUrl",e])}catch(e){}try{window._paq.push(["setDocumentTitle",document.title])}catch(e){}try{window._paq.push(["trackPageView",void 0,{dimension1:e}])}catch(e){}try{window._paq.push(["enableLinkTracking"])}catch(e){}}}catch(e){}if(await lt())await Bt(()=>{try{en()}catch(e){}});else try{en()}catch(e){}}catch(e){}})()};try{window.avelorTrackerReinitializePage=window.vtTrackerReinitializePage}catch(e){}if(!window.__vtHistoryHooksInstalled){window.__vtHistoryHooksInstalled=!0;const e=function(){try{"function"==typeof window.vtTrackerReinitializePage?window.vtTrackerReinitializePage():"function"==typeof window.avelorTrackerReinitializePage&&window.avelorTrackerReinitializePage()}catch(e){}};try{window.addEventListener("popstate",e,!0)}catch(e){}try{window.addEventListener("pagehide",k,!0)}catch(e){}try{window.addEventListener("beforeunload",k,!0)}catch(e){}try{window.addEventListener("pageshow",function(t){try{t&&t.persisted&&e()}catch(e){}},!0)}catch(e){}try{if(!window.__vtHistoryWrapped&&window.history){window.__vtHistoryWrapped=!0;const t=function(t){return function(){const n=t.apply(this,arguments);try{e()}catch(e){}return n}};"function"==typeof window.history.pushState&&(window.history.pushState=t(window.history.pushState)),"function"==typeof window.history.replaceState&&(window.history.replaceState=t(window.history.replaceState))}}catch(e){}}window.__vtBlockAll=!0;const ze="true"===new URLSearchParams(window.location.search).get("vt_debug")||"true"===localStorage.getItem("vt_debug");function je(){try{return!(!window.vtDebugMode&&!window.avelorDebugMode)}catch(e){return!1}}function Be(){try{if(!je())return;console.log.apply(console,arguments)}catch(e){}}function Fe(){try{if(!je())return;console.warn.apply(console,arguments)}catch(e){}}function Ve(e){try{if(!e||"string"!=typeof e)return String(e);if(e.startsWith("integration_")){const t=e.replace(/^integration_/,""),n=ve.get(t),o=n&&n.name?n.name:null;return o?`Custom Code Integration: ${o} (${t})`:`Custom Code Integration: ${t}`}const t=he.get(e),n=t&&t.name?t.name:null;return n?`Custom Code Event: ${n} (${e})`:`Custom Code Event: ${e}`}catch(t){return String(e)}}function We(){try{if(Ie)return Ie}catch(e){}return Promise.resolve()}function Ge(){try{Se&&(Se(),Se=null),Ie=null}catch(e){}}function He(){try{if(xe)return xe}catch(e){}return Promise.resolve()}
1function Je(){try{$e&&($e(),$e=null),xe=null}catch(e){}}ze&&(console.log("ð Debug mode enabled - detailed logs will be shown"),console.log('ð To disable: remove ?vt_debug=true from URL or run localStorage.removeItem("vt_debug")')),window.vtDebugMode=ze,window.avelorDebugMode=ze,window.__vtBlockAll=!0;const Qe=function(){try{if(e&&e.src){const t=new URL(e.src);return`${t.protocol}//${t.host}`}}catch(e){}return"https://app.vibetrack.com"}();let Ke=null;function Ye(e,t){q(e,t);try{window.Sentry&&"function"==typeof window.Sentry.captureException&&window.Sentry.captureException(e,{tags:{area:"vibetrack-public-tracker",operation:t}})}catch(e){}try{console.error("[VibeTrack Tracker] "+t,e)}catch(e){}}function Ze(e){return new Promise(function(t){setTimeout(t,e)})}async function Xe(){try{const e=window.location.href,t=i,n=`${Qe}/api/collect/id?trackingCode=${t}&url=${encodeURIComponent(e)}`,o=await async function(e){let t=null;for(let n=0;n<2;n++){try{const n=await fetch(e,{method:"GET",mode:"cors"});if(n.ok||429!==n.status&&n.status<500)return n;t=new Error("Preflight failed with status "+n.status)}catch(e){t=e}0===n&&await Ze(150)}throw t||new Error("Preflight failed")}(n);if(!o.ok)return!1;const r=await o.json();try{w(r)}catch{}try{r&&r.websiteId&&(window.vtWebsiteId=r.websiteId)}catch(e){}try{window.__vtTrackingLockAt=r&&r.trackingLockAt?String(r.trackingLockAt):null}catch(e){}const a=!(!r||!r.websiteId&&!r.matomoSiteId);return a&&(Ke={trackingCode:t,currentUrl:e,data:r}),a}catch(e){return Ye(e,"preflight-validation"),!1}}async function et(){try{const e=Ke&&Ke.trackingCode===i&&Ke.currentUrl===window.location.href?Ke.data:null;if(e&&"boolean"==typeof e.archived&&"boolean"==typeof e.trackingBlocked){try{window.__vtTrackingLockAt=e.trackingLockAt?String(e.trackingLockAt):null}catch(e){}return!0===e.archived||!0===e.trackingBlocked}const t=`${Qe}/api/tracker/site-status?trackingCode=${encodeURIComponent(i)}`,n=await fetch(t,{method:"GET",mode:"cors"});if(!n.ok)return!1;const o=await n.json();try{window.__vtTrackingLockAt=o&&o.trackingLockAt?String(o.trackingLockAt):null}catch(e){}return!(!o||!0!==o.archived&&!0!==o.trackingBlocked)}catch(e){return Ye(e,"site-status-check"),!1}}let tt=null;function nt(){try{tt&&(clearTimeout(tt),tt=null);const e=window.__vtTrackingLockAt;if(!e)return;const t=new Date(e).getTime();if(!Number.isFinite(t))return;const n=864e5,o=Math.max(0,Math.min(n,t-Date.now()));tt=setTimeout(async()=>{try{if(await et())return window.__vtBlockAll=!0,void(window.avelorDebugMode&&console.log("ð« Billing enforcement active - blocking all tracking for siteId:",i));nt()}catch(e){nt()}},o)}catch(e){}}function ot(){!function(e){if(U||!e||!e.funnelDiagnostics||"disabled"!==e.cookieBannerMode||e.archived||e.trackingBlocked||!e.matomoSiteId)return;const t=e.funnelDiagnostics;if(Date.now()>=Date.parse(t.expiresAt)||!Array.isArray(t.paths)||t.paths.indexOf(window.location.pathname)<0)return;const n=ie();if(!n)return void Ye(new Error("Diagnostic page ID unavailable"),"diagnostic-init");const o=U={trackingCode:i,matomoSiteId:e.matomoSiteId,paths:t.paths,expiresAt:Date.parse(t.expiresAt),started:Date.now(),pageId:n,clickHash:null,selected:null,confirmed:null,source:"pending",hashes:new Map,errors:[],sent:new Set,sequence:0};try{const e=R(),t=new URL(window.location.href),n=E()?new URL(document.referrer):null,i=t.searchParams.get("fbclid")||t.searchParams.get("vt_diagnose")||n&&(n.searchParams.get("fbclid")||n.searchParams.get("vt_diagnose"));Promise.all([z(i),...[e.cookieId,e.localId,e.sessionId].map(async function(e){const t=await z(e);t&&o.hashes.set(e,t)})]).then(function(t){o.clickHash=t[0],B("preflight-ready",!1,e)}).catch(function(e){Ye(e,"diagnostic-hash")}),document.addEventListener("submit",function(){B("submit")},!0),window.addEventListener("pagehide",function(e){B("pagehide",e.persisted)},!0),window.addEventListener("pageshow",function(e){B("pageshow",e.persisted)},!0),document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState&&B("hidden")})}catch(e){Ye(e,"diagnostic-init")}}(Ke&&Ke.data);try{jt()}catch(e){}try{_n()}catch(e){}try{kn()}catch(e){}if((async()=>{try{if(h()){if(await lt())Ln(),On(),En(),Mn(),ae(),await Bt(()=>{try{en()}catch(e){}});else{$n(),Dn(),Pn();try{en()}catch(e){}}return}
1const e=Wt("vt_cookies_accepted"),n="true"===Wt("vt_cookies_marketing");if(await lt())Ln(),On(),En(),Mn(),ae(),await Bt(()=>{try{en()}catch(e){}});else{"partial"===window.vtBannerMode?(Ln(),On(),En(),Mn(),ae()):($n(),Dn(),Pn(),ce()),(window.vtDebugMode||window.avelorDebugMode)&&console.log("Marketing pixels not allowed, skipping tracking pixels");try{en()}catch(e){}}const o=await at();!t&&o&&("visual"===window.vtBannerMode?Rt(i):e?n||zt(i):Rt(i))}catch(e){}})(),!t){try{Tt()}catch(e){}try{Nt()}catch(e){}try{At()}catch(e){}}if(!t&&!h()&&"visual"!==window.vtBannerMode&&Wt("vt_cookies_accepted"))try{zt(i)}catch(e){}}window.vtTrackerSwitchSiteId=function(e){try{const t=String(e||"").trim();if(!t||t===i)return void("function"==typeof window.vtTrackerReinitializePage&&window.vtTrackerReinitializePage());_(f());try{Q(window.__vtMatomoSiteId)}catch(e){}try{window.__vtMatomoSiteId=null}catch(e){}try{window.__vtUtmEnrichRan=!1}catch(e){}i=t;try{window.vtSiteId=i}catch(e){}try{window.avelorSiteId=i}catch(e){}try{window.__vtLastReinitPathkey=window.location.origin+window.location.pathname}catch(e){}r=null,a="/",c="",g();try{Ae.clear()}catch(e){}try{Oe()}catch(e){}try{ct=null}catch(e){}try{st=null}catch(e){}try{it=null}catch(e){}try{rt=null}catch(e){}try{Object.keys(le).forEach(function(e){try{le[e].clear()}catch(e){}})}catch(e){}(async()=>{try{if(!await Xe())return void _(f());if(await et()){try{window.__vtArchivedSite=!0}catch(e){}return}try{window.__vtArchivedSite=!1}catch(e){}try{window.__vtBlockAll=!1}catch(e){}nt(),ot()}catch(e){try{window.__vtBlockAll=!0}catch(e){}}})()}catch(e){}};try{window.avelorTrackerSwitchSiteId=window.vtTrackerSwitchSiteId}catch(e){}(async()=>{if(await Xe())if(await et()){try{window.__vtArchivedSite=!0}catch(e){}window.avelorDebugMode&&console.log("ð« Site archived - blocking all tracking for siteId:",i)}else window.__vtBlockAll=!1,nt(),window.avelorDebugMode&&console.log("â
Preflight passed & site active - enabling tracker"),ot();else window.avelorDebugMode&&console.log("ð« Preflight failed - blocking all tracking for siteId:",i)})();let it=null,rt=null;async function at(){if(null!==it)return console.log("ð Using cached banner configuration:",it),it;if(rt)return console.log("ð Banner configuration check already in progress, waiting..."),await rt;const e=(async()=>{try{const e=Ke&&Ke.trackingCode===i&&Ke.currentUrl===window.location.href?Ke.data:null;if(e&&"boolean"==typeof e.cookieBannerConfigured&&["disabled","visual","partial","active"].indexOf(e.cookieBannerMode)>=0){it=e.cookieBannerConfigured;try{window.vtBannerMode=e.cookieBannerMode}catch(e){}return it}const t=`${Et}/api/cookie-banner/status?trackingCode=${i}&url=${encodeURIComponent(window.location.href)}`,n=await fetch(t,{method:"GET",mode:"cors"});if(!n.ok)return console.log("â ï¸ Could not check cookie banner status, defaulting to allow pixels"),it=!1,!1;const o=await n.json();it=o&&!0===o.configured;try{window.vtBannerMode=o&&o.mode?o.mode:it?"active":"disabled"}catch(e){}return it}catch(e){return Ye(e,"cookie-banner-status-check"),console.log("â ï¸ Error checking cookie banner status:",e),console.log("â ï¸ Defaulting to allow pixels"),it=!1,!1}})();rt=e;try{return await e}finally{rt===e&&(rt=null)}}let ct=null,st=null;async function lt(){if(t)return ct=!0,!0;if(null!==ct)return window.avelorDebugMode&&console.log("ð Using cached marketing pixels decision:",ct),ct;if(st)return(window.vtDebugMode||window.avelorDebugMode)&&console.log("ð Marketing pixels check already in progress, waiting..."),await st;st=(async()=>{if((window.vtDebugMode||window.avelorDebugMode)&&console.log("ð Checking if marketing pixels should fire..."),h())return(window.vtDebugMode||window.avelorDebugMode)&&console.log("â
Trustmarkt scope active, treating external consent as accepted"),ct=!0,!0;const e=await at();if((window.vtDebugMode||window.avelorDebugMode)&&console.log("ð Cookie banner configured:",e,"mode:",window.vtBannerMode),!e)return(window.vtDebugMode||window.avelorDebugMode)&&console.log("â
No cookie banner configured, allowing all marketing pixels"),ct=!0,!0;try{if("visual"===window.vtBannerMode)return(window.vtDebugMode||window.avelorDebugMode)&&console.log("â
Cookie banner in visual-only mode, allowing marketing pixels"),ct=!0,!0}catch(e){}try{!function(){try{if(me)return;
1try{if("disabled"===window.vtBannerMode||"visual"===window.vtBannerMode)return}catch(e){}const e=!!Ft("vt_consent_prefs"),t=e?function(){try{const e="true"===Wt("vt_cookies_performance"),t="true"===Wt("vt_cookies_marketing");return{analytics_storage:e?"granted":"denied",ad_storage:t?"granted":"denied",ad_user_data:t?"granted":"denied",ad_personalization:t?"granted":"denied",functionality_storage:"true"===Wt("vt_cookies_functionality")?"granted":"denied"}}catch(e){return{analytics_storage:"denied",ad_storage:"denied",ad_user_data:"denied",ad_personalization:"denied",functionality_storage:"denied"}}}():{analytics_storage:"denied",ad_storage:"denied",ad_user_data:"denied",ad_personalization:"denied",functionality_storage:"denied",wait_for_update:500};if(function(){try{window.dataLayer=window.dataLayer||[],"function"!=typeof window.gtag&&(window.gtag=function(){window.dataLayer.push(arguments)})}catch(e){}}(),"function"!=typeof window.gtag)return;try{window.gtag("consent","default",t)}catch(e){}if(e)try{window.gtag("consent","update",t)}catch(e){}me=!0}catch(e){}}()}catch(e){}const t="true"===Wt("vt_cookies_marketing");return(window.vtDebugMode||window.avelorDebugMode)&&console.log("ð Marketing cookies accepted:",t),t?((window.vtDebugMode||window.avelorDebugMode)&&console.log("â
Marketing cookies accepted, allowing marketing pixels"),ct=!0):((window.vtDebugMode||window.avelorDebugMode)&&console.log("â Marketing cookies not accepted, blocking marketing pixels"),ct=!1),ct})();const e=await st;return st=null,e}if(!window.__avelorConsoleWrapped){window.__avelorConsoleWrapped=!0;const e=console.log.bind(console),t=console.info?console.info.bind(console):null,n=console.debug?console.debug.bind(console):null,o=console.warn?console.warn.bind(console):null,i=console.trace?console.trace.bind(console):null;console.log=function(...t){const n=t[0];if("string"==typeof n&&(n.includes("analyticsQueue started")||n.includes("marketingQueue started")))return;const o="string"==typeof n&&/(?:Avelor Analytics|^[\s\u2713\u26A0\u1F512\u2705\uD83D\uDCCA]|Event ID:|Enhanced Conversions)/.test(n),i="string"==typeof n&&(n.includes("broker - subscribe consumer to @onepage")||n.includes("hydrateRoot")||n.includes("Hydration hidden section")||n.includes("Progressive Hydration section")||"hydrateRoot"===n||n.startsWith("Progressive Hydration section")||/^Progressive Hydration section \d+( done)?$/.test(n)||n.includes("site-kit/extension/video/api/modal/toggle")),r="string"==typeof n&&(n.includes("t.js")||n.includes("matomo.js")||0===t.length&&void 0===t[0]);i||r?window.avelorDebugMode&&e(...t):!window.avelorDebugMode&&o||e(...t)},t&&(console.info=function(...e){const n=e[0];"string"==typeof n&&(n.includes("analyticsQueue started")||n.includes("marketingQueue started"))||t(...e)}),n&&(console.debug=function(...e){const t=e[0];"string"==typeof t&&(t.includes("analyticsQueue started")||t.includes("marketingQueue started"))||n(...e)}),o&&(console.warn=function(...e){const t=e[0];"string"==typeof t&&(t.includes("analyticsQueue started")||t.includes("marketingQueue started"))||o(...e)}),i&&(console.trace=function(...e){(window.vtDebugMode||window.avelorDebugMode)&&i(...e)})}void 0===window.$&&window.jQuery,Object.keys(sessionStorage).forEach(e=>{e.startsWith("ss_status_")&&sessionStorage.removeItem(e)});const dt=['input[type="email"]','input[autocomplete="email"]','input[name*="email" i]','input[id*="email" i]','input[data-name*="email" i]','input[placeholder*="email" i]','input[name*="mail" i]','input[id*="mail" i]','input[data-name*="mail" i]','input[placeholder*="mail" i]','input[class*="email" i]','input[class*="mail" i]'].join(","),ut=['input[autocomplete="given-name"]','label[class*="type-fname" i] input','input[placeholder*="vorname" i]','input[placeholder*="first" i]','input[name="fname"]','input[name="first"]','input[name="firstname"]','input[name="first-name"]','input[name="first_name"]','input[name="vorname"]','input[name="firstName"]','input[id*="first" i]','input[id*="vorname" i]','input[class*="first" i]','input[class*="vorname" i]'].join(","),mt=['input[autocomplete="family-name"]','label[class*="type-lname" i] input','input[placeholder*="nachname" i]','input[placeholder*="last" i]','input[name="lname"]','input[name="last"]','input[name="lastname"]','input[name="last-name"]','input[name="last_name"]','input[name="nachname"]','input[name="lastName"]','input[id*="last" i]','input[id*="nachname" i]','input[class*="last" i]','input[class*="nachname" i]'].join(","),gt=['input[type="tel"]','input[type="phone_number"]','input[placeholder*="telefon" i]','input[placeholder*="phone" i]','input[placeholder*="mobil" i]','input[name*="phone" i]','input[name*="telefon" i]','input[name*="telephone" i]','input[name*="mobile" i]','input[name*="mobil" i]','input[name*="tel" i]','input[id*="phone" i]','input[id*="telefon" i]','input[id*="telephone" i]','input[id*="mobile" i]','input[id*="mobil" i]','input[id*="tel" i]','input[class*="phone" i]','input[class*="telefon" i]','input[class*="mobile" i]','input[class*="mobil" i]',"input[data-intl-tel-input-id]",".iti input"].join(",");function ft(e,t,n,o){const i=e&&"function"==typeof e.querySelectorAll?e:document,r=Array.from(i.querySelectorAll(t));let a=null,c=-1/0;return r.forEach((e,t)=>{const i=function(e){return e&&"string"==typeof e.value?e.value.trim():""}(e);if(!i||e.disabled||n&&!n(i,e))return;const r=function(e){if(!e||e.disabled||"hidden"===e.type||e.hidden)return!1;let t=e;for(;t&&1===t.nodeType;){if(t.hidden||"true"===t.getAttribute("aria-hidden"))return!1;const e="function"==typeof window.getComputedStyle?window.getComputedStyle(t):null;if(e&&("none"===e.display||"hidden"===e.visibility))return!1;t=t.parentElement}return"function"!=typeof e.getClientRects||e.getClientRects().length>0}(e)?100:0,s=r+(o?o(i,e):0)-t/1e4;s>c&&(a=e,c=s)}),a}function pt(e){return(String(e||"").match(/\d/g)||[]).length>=4}function wt(e){return ft(e,gt,pt,(e,t)=>{let n=0;return e.startsWith("+")&&(n+=200),(t.name||"").toLowerCase().includes("e164")&&(n+=50),"tel"===t.type&&(n+=20),n})}function ht(e){return!(!e||"FORM"!==e.nodeName)&&(e.getAttribute("action")||"").toLowerCase().includes("/op3/v1/optin/submit")}function vt(e){return ft(e,dt,e=>e.includes("@"))}document.addEventListener("submit",function(e){if(window.__vtBlockAll)return;const t=e.target;if(!t||"FORM"!==t.nodeName)return;const n=null!==t.closest(".w-form"),o=function(e){if(e.classList.contains("onepage-form")||e.classList.contains("op-form")||e.hasAttribute("data-onepage")||e.hasAttribute("data-op-form"))return!0;
1if(e.closest('[class*="onepage"], [class*="op-"], [id*="onepage"], [id*="op-"]'))return!0;const t=e.getAttribute("action");if(t&&(t.includes("onepage")||t.includes("op-form")))return!0;if(e.querySelectorAll('input[class*="onepage"], input[class*="op-"], input[id*="onepage"], input[id*="op-"]').length>0)return!0;return!(!e.querySelector('input[type="email"]')||!e.querySelector('input[type="text"]')&&!e.querySelector('input[name*="name"]')||e.closest(".w-form"))&&(!!(document.querySelector('[class*="onepage"], [id*="onepage"], script[src*="onepage"]')||document.title.toLowerCase().includes("onepage")||window.location.hostname.includes("onepage"))||e.querySelectorAll("input").length<=6&&e.querySelector('input[type="email"]')&&(e.querySelector("textarea")||e.querySelector('input[type="text"]')))}(t),i=function(e){if(!e||"FORM"!==e.nodeName)return!1;const t=(e.getAttribute("action")||"").toLowerCase();return e.classList.contains("_form")&&t.includes(".activehosted.com/proc.php")}(t),r=function(e){return!(!e||"FORM"!==e.nodeName||!document.querySelector('script[src*="heyflow.com" i]')&&!e.querySelector('input[name^="country-select-" i], input[id$="-e164" i]'))}(t),a=ht(t);if(!(n||o||i||r||a))return;const c=n?"Webflow":o?"OnePage":i?"ActiveCampaign":r?"Heyflow":"OptimizePress";window.avelorDebugMode&&console.log(`${c} form submit intercepted`,t);const s={firstName:["first","firstName","first-name","first_name","vorname","fname","firstname"],lastName:["last","lastName","last-name","last_name","nachname","lname","lastname"],email:["email","email-address","mail","e-mail","emailaddress"],phone:["phone","phone-number","phone_number","tel","telefon","telephone","telephone_number","mobile","mobile_number"],postalCode:["postal-code","postal_code","postcode","zip","zipcode","plz"],country:["country","country-code","country_code","countryCode"]},l={};if(Object.keys(s).forEach(e=>{s[e].forEach(n=>{if(l[e])return;const o=ft(t,`[name="${n}"]`);o&&o.value&&(l[e]=o.value.trim())})}),!l.email){const e=vt(t);e&&e.value&&(l.email=e.value.trim())}if(!l.phone){const e=wt(t);e&&e.value&&(l.phone=e.value.trim())}if(o){if(!l.firstName){const e=ft(t,ut);e&&e.value&&(l.firstName=e.value.trim())}if(!l.lastName){const e=ft(t,mt);e&&e.value&&(l.lastName=e.value.trim())}if(!l.email){const e=vt(t);e&&e.value&&(l.email=e.value.trim())}if(!l.phone){const e=wt(t);e&&e.value&&(l.phone=e.value.trim())}}const d=$t(t);["firstName","lastName","email","phone","postalCode","country"].forEach(e=>{!l[e]&&d[e]&&(l[e]=d[e])});const u=!!t.querySelector('input[placeholder*="vorname" i], input[placeholder*="first" i], input[autocomplete="given-name"], input[name="fname"], input[name="first"], input[name="firstname"], input[name="first_name"], input[name="vorname"], input[name="firstName"], input[id*="first" i], input[class*="first" i]');if(u&&l.firstName&&!l.lastName){const e=ft(t,'input[name="name"]');if(e&&e.value){const t=e.value.trim();t&&(l.lastName=t)}}if(l.phone){const e=t.querySelector('input[name="country"], input#country');let n=e&&e.value?e.value.trim():"";n&&!n.startsWith("+")&&(n="+"+n);
1let o=l.phone.replace(/[\s\-()]/g,"");n&&!o.startsWith("+")&&(o=n+o.replace(/^0+/,"")),l.phone=o}if(!l.firstName&&!l.lastName||!u&&!l.firstName&&l.lastName){const e=ft(t,'input[name="name"], input[name*="name" i], input[placeholder*="name" i], input[id*="name" i]'),n=e&&e.value?e.value:l.lastName||"",o=String(n||"").trim().replace(/\s+/g," ");if(o){const e=o.split(" ");u?l.lastName=o:1===e.length?l.lastName=e[0]:(l.lastName=e[e.length-1],l.firstName=e.slice(0,-1).join(" "))}}if(window.avelorDebugMode&&console.log(`Extracted lead from ${c} form`,l),Object.keys(l).length){try{let e=!1;try{e=Vt()}catch(t){e=!1}try{e||"visual"!==window.vtBannerMode&&"partial"!==window.vtBannerMode||(e=!0)}catch(e){}e&&S("wf_lead",JSON.stringify(l)),window.avelorDebugMode&&console.log(e?`Saved ${c} lead to localStorage`:`Skipped saving ${c} lead (no marketing consent)`,l)}catch(e){console.warn(`Unable to store ${c} lead in localStorage`,e)}St(l)}},!0),function(){try{if(window.__vtBlockAll)return;"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{try{Tt(),Nt(),At()}catch(e){}}):(Tt(),Nt(),At())}catch(e){}}();const yt="vt_lead_handoff";let _t="",kt=0;function bt(){try{const e=Ft(yt);return e&&/^[a-f0-9]{64}$/i.test(e)?e.toLowerCase():null}catch(e){return console.warn("Unable to read lead handoff token",e),null}}function It(){try{if(Vt())return"accepted";if("visual"===window.vtBannerMode)return"nur_visuell";if("partial"===window.vtBannerMode)return"teilaktiv";if(!1===it)return"deaktiviert"}catch(e){}return"not_set"}function St(e){try{let t=!1;try{t=Vt()}catch(e){t=!1}try{t||"visual"!==window.vtBannerMode&&"partial"!==window.vtBannerMode&&!1!==it||(t=!0)}catch(e){}if(!t)return;let n={};try{const e=I("wf_lead");n=e?JSON.parse(e):{}}catch(e){n={}}const o={...n};["firstName","lastName","email","phone"].forEach(t=>{e&&e[t]&&(o[t]=String(e[t]).trim())});const r="string"==typeof o.email&&/^\S+@\S+\.\S+$/.test(o.email),c="string"==typeof o.phone&&(o.phone.match(/\d/g)||[]).length>=4;if(!r&&!c)return;const s=JSON.stringify([o.firstName||"",o.lastName||"",o.email||"",o.phone||"",window.location.origin,window.location.pathname]),l=Date.now();if(s===_t&&l-kt<1500)return;const d=function(){try{const e=bt();if(e)return e;const t=function(){try{if(!window.crypto||"function"!=typeof window.crypto.getRandomValues)return null;const e=new Uint8Array(32);return window.crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,"0")).join("")}catch(e){return console.warn("Unable to create lead handoff token",e),null}}();return t?(function(e){try{const t=Gt(),n=h()&&a||"/",o=t?`; Domain=${t}`:"",i="https:"===window.location.protocol?"; Secure":"";document.cookie=`${v(yt)}=${encodeURIComponent(e)}; Max-Age=3600; Path=${n}${o}; SameSite=Lax${i}`}catch(e){console.warn("Unable to store lead handoff token",e)}}(t),t):null}catch(e){return console.warn("Unable to resolve lead handoff token",e),null}}();if(!d)return;_t=s,kt=l,fetch(`${Et}/api/collect/lead-handoff`,{method:"POST",mode:"cors",keepalive:!0,headers:{"Content-Type":"application/json"},body:JSON.stringify({trackingCode:i,currentUrl:window.location.href,handoffToken:d,cookieConsent:It(),contact:{firstName:o.firstName||null,lastName:o.lastName||null,email:r?o.email:null,phone:c?o.phone:null}})}).then(e=>{e.ok||console.warn(`Lead handoff could not be stored (${e.status})`)}).catch(e=>{console.warn("Lead handoff request failed",e)})}catch(e){console.warn("Unable to stage lead handoff",e)}}function Ct(e){try{let t=!1;try{t=Vt()}catch(e){t=!1}try{t||"visual"!==window.vtBannerMode&&"partial"!==window.vtBannerMode||(t=!0)}catch(e){}if(!t)return void(window.avelorDebugMode&&e&&(e.firstName||e.lastName||e.email||e.phone)&&console.log("Skipped saving lead (input-capture, storage not allowed)",{lead:e,vtBannerMode:window.vtBannerMode||null}));const n=I("wf_lead"),o={...n?JSON.parse(n):{}};["firstName","lastName","email","phone","postalCode","country"].forEach(t=>{e&&e[t]&&(o[t]=e[t])}),Object.keys(o).length&&(S("wf_lead",JSON.stringify(o)),window.avelorDebugMode&&console.log("ð Saved lead (input-capture) to localStorage",o))}catch(e){}}const xt=function(e){let t;return function(...n){clearTimeout(t),t=setTimeout(()=>e.apply(this,n),800)}}(Ct);function $t(e){const t={},n=e=>{const t=(e=>{try{return[e&&e.getAttribute?e.getAttribute("name"):"",e&&e.getAttribute?e.getAttribute("id"):"",e&&e.getAttribute?e.getAttribute("placeholder"):"",e&&e.getAttribute?e.getAttribute("aria-label"):""].join(" ").toLowerCase()}catch(e){return""}})(e);return t.includes("vorname")&&t.includes("nachname")||t.includes("first")&&t.includes("last")||t.includes("full_name")||t.includes("fullname")||t.includes("full name")},o=e=>{const n=String(e||"").trim().replace(/\s+/g," ");
1if(!n)return;const o=n.split(" ");1!==o.length?(t.firstName=o[0],t.lastName=o.slice(1).join(" ")):t.firstName=o[0]},i=ft(e,ut),r=ft(e,mt);i&&i.value&&(n(i)?o(i.value):t.firstName=i.value.trim()),r&&r.value&&r!==i&&!n(r)&&(t.lastName=r.value.trim());const a=!(!i||n(i));if(a&&t.firstName&&!t.lastName){const n=ft(e,'input[name="name"]');if(n&&n.value){const e=n.value.trim();e&&(t.lastName=e)}}if(!a&&t.lastName&&!t.firstName){const e=String(t.lastName||"").trim().replace(/\s+/g," ");if(e){const n=e.split(" ");1===n.length?t.lastName=n[0]:(t.lastName=n[n.length-1],t.firstName=n.slice(0,-1).join(" "))}}if(!t.lastName){const n=ft(e,'input[name*="name" i]:not([type="email"]):not([type="tel"]), input[placeholder*="name" i]:not([type="email"]):not([type="tel"]), input[id*="name" i]:not([type="email"]):not([type="tel"])');if(n&&n.value){const e=n.value.trim().replace(/\s+/g," ");if(e){const c=e.split(" ");n===i||n===r?t.firstName||t.lastName||o(e):a?t.lastName=e:1===c.length?t.lastName=c[0]:(t.lastName=c[c.length-1],t.firstName=c.slice(0,-1).join(" "))}}}const c=vt(e);c&&c.value&&c.value.includes("@")&&(t.email=c.value.trim());const s=wt(e);s&&s.value&&(t.phone=s.value.trim());const l=ft(e,'input[autocomplete="postal-code"], input[name*="postal" i], input[name*="postcode" i], input[name*="zip" i], input[name="plz" i], input[id*="postal" i], input[id*="postcode" i], input[id*="zip" i], input[id*="plz" i]');l&&l.value&&(t.postalCode=l.value.trim());const d=ft(e,'select[autocomplete="country"], select[autocomplete="country-name"], select[name="country" i], select[name="country_code" i], input[autocomplete="country"], input[autocomplete="country-name"], input[name="country" i], input[name="country_code" i]');if(d&&d.value&&(t.country=d.value.trim()),t.phone&&!t.phone.startsWith("+"))try{const e=Vn&&Vn(),n=Wn&&Wn(t.phone,e);n&&(t.phone=n)}catch(e){}return t}function Tt(){if(window.__vtInputCaptureInitialized)return;window.__vtInputCaptureInitialized=!0;const e=[dt,gt,'input[type="tel"]','input[type="phone_number"]','input[placeholder*="telefon" i]','input[placeholder*="phone" i]','input[placeholder*="vorname" i]','input[placeholder*="nachname" i]','input[placeholder*="first" i]','input[placeholder*="last" i]','input[name="first"]','input[name="last"]','input[name="firstname"]','input[name="lastname"]','input[name="firstName"]','input[name="lastName"]','input[name="vorname"]','input[name="nachname"]','input[name*="phone" i]','input[name*="telefon" i]','input[name*="name" i]','input[id*="first" i]','input[id*="last" i]','input[id*="phone" i]','input[id*="telefon" i]','input[class*="first" i]','input[class*="last" i]','input[class*="phone" i]','input[class*="telefon" i]',"input[data-intl-tel-input-id]",".iti input",'input[name="fname"]','input[name="lname"]','input[name="name"]','input[autocomplete="given-name"]','input[autocomplete="family-name"]','input[autocomplete="postal-code"]','input[name*="postal" i]','input[name*="postcode" i]','input[name*="zip" i]','input[name="plz" i]','input[autocomplete="country"]','input[autocomplete="country-name"]','input[name="country" i]','input[name="country_code" i]','select[autocomplete="country"]','select[autocomplete="country-name"]','select[name="country" i]','select[name="country_code" i]'].join(","),t=t=>{const n=(e=>{try{const t="function"==typeof e.composedPath?e.composedPath():[];for(let e=0;e<t.length;e++){const n=t[e];if(n&&("INPUT"===n.nodeName||"SELECT"===n.nodeName))return n}}catch(e){}return!e.target||"INPUT"!==e.target.nodeName&&"SELECT"!==e.target.nodeName?null:e.target})(t);if(!n)return;if(!n.matches(e))return;const o=$t((e=>{try{const t=e.closest('[data-atom^="form-"]')||e.closest(".one-kit-form-item")||e.closest("form");if(t)return t;const n="function"==typeof e.getRootNode?e.getRootNode():null;if(n&&n.querySelector)return n}catch(e){}return document})(n));xt(o)};document.addEventListener("input",t,!0),document.addEventListener("change",t,!0),document.addEventListener("blur",t,!0),window.avelorDebugMode&&console.log("ð¯ OnePage input capture initialized")}function Nt(){if(window.__vtClickInterceptInitialized)return;window.__vtClickInterceptInitialized=!0;const e=e=>{if(!e)return!1;const t=e.tagName;return"BUTTON"===t||"INPUT"===t&&("submit"===e.type||"button"===e.type)||!(!e.getAttribute||"button"!==e.getAttribute("role"))||!!function(e){return!!e&&"A"===e.tagName&&e.hasAttribute("data-op-action")&&ht(e.closest("form"))}(e)||!(!e.closest||!e.closest('[data-atom="form-submit"]')&&!e.closest(".one-kit-form-submit"))};document.addEventListener("click",t=>{const n=(()=>{try{const n="function"==typeof t.composedPath?t.composedPath():[];for(let t=0;t<n.length;t++){const o=n[t];if(o instanceof Element&&e(o))return o}}catch(e){}return t.target instanceof Element?t.target:null})();if(!n)return;if(n.closest&&(n.closest("#avelor-cookie-banner")||n.closest("#avelor-cookie-details-dialog")))return;if(!e(n))return;const o=$t(n.closest("form")||n.closest('[data-atom^="form-"]')||n.closest(".one-kit-form-item")||("function"==typeof n.getRootNode&&n.getRootNode().querySelector?n.getRootNode():document));Ct(o),St(o)},!0),window.avelorDebugMode&&console.log("ð±ï¸ OnePage click interceptor initialized")}
1function At(){if(window.__vtAutofillCaptureInitialized)return;window.__vtAutofillCaptureInitialized=!0;let e=0,t="";const n=setInterval(()=>{try{e++;const n=$t(document),o=JSON.stringify({e:n.email||"",p:n.phone||"",f:n.firstName||"",l:n.lastName||""});o!==t&&(n.email||n.phone||n.firstName||n.lastName)&&(t=o,Ct(n))}catch(e){}e>=15&&clearInterval(n)},1e3);document.addEventListener("focusin",e=>{const t=(()=>{try{const t="function"==typeof e.composedPath?e.composedPath():[];for(let e=0;e<t.length;e++){const n=t[e];if(n&&"INPUT"===n.nodeName)return n}}catch(e){}return e.target instanceof Element&&"INPUT"===e.target.nodeName?e.target:null})();t&&setTimeout(()=>{try{const e=$t(t.closest('[data-atom^="form-"]')||t.closest(".one-kit-form-item")||t.closest("form")||("function"==typeof t.getRootNode&&t.getRootNode().querySelector?t.getRootNode():document));(e.email||e.phone||e.firstName||e.lastName)&&Ct(e)}catch(e){}},250)},!0),window.avelorDebugMode&&console.log("â¡ OnePage autofill capture initialized")}const Mt=document.currentScript||function(){const e=document.getElementsByTagName("script");for(let t=e.length-1;t>=0;t--)if(e[t].src&&e[t].src.includes("tracker.js"))return e[t];return e[e.length-1]}();let Et="https://app.vibetrack.com";if(Mt&&Mt.src)try{const e=new URL(Mt.src);Et=`${e.protocol}//${e.host}`}catch(e){console.warn("Could not determine script domain, using fallback")}"localhost"!==window.location.hostname&&"127.0.0.1"!==window.location.hostname||(Et=window.location.origin);try{window.vtMatomoFirstPartyUrl||(window.vtMatomoFirstPartyUrl=Et+"/api/collect/")}catch(e){}let Dt=null;function Pt(e){if(Dt)return Dt;const t=String(e||"").replace(/\/?$/,"/");return Dt=new Promise(function(e,n){const o=document.createElement("script"),i=document.getElementsByTagName("script")[0];o.async=!0,o.src=t+"t.js",o.addEventListener("load",function(){e()},{once:!0}),o.addEventListener("error",function(){Dt=null;try{o.parentNode&&o.parentNode.removeChild(o)}catch(e){}n(new Error("Matomo script failed to load"))},{once:!0}),i&&i.parentNode?i.parentNode.insertBefore(o,i):(document.head||document.body||document.documentElement).appendChild(o)}),Dt}window._paq=window._paq||[];try{window._paq.push(["requireCookieConsent"])}catch(e){}Pt(window.vtMatomoFirstPartyUrl).catch(function(e){Ye(e,"matomo-script-preload")});
1const Lt=Wt("vt_cookies_accepted"),Ut="true"===Wt("vt_cookies_performance"),qt="true"===Wt("vt_cookies_marketing");let Ot=!("true"===Lt);function Rt(e){if(t)return;if(window.avelorCookie)return void window.avelorCookie.fetchAndRender(e);const n=document.createElement("script");n.src="localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname?"/cookie.js":"https://app.vibetrack.com/cookie.js",n.async=!0,n.onload=function(){setTimeout(()=>{window.avelorCookie&&window.avelorCookie.fetchAndRender?window.avelorCookie.fetchAndRender(e):console.warn("Cookie banner script loaded but functions not available")},100)},n.onerror=function(){console.warn("Failed to load cookie banner script")},(document.head||document.body||document.documentElement).appendChild(n)}function zt(e){if(t)return;if(window.avelorCookie&&window.avelorCookie.showIconOnly)return void window.avelorCookie.showIconOnly(e);const n=document.createElement("script");n.src="localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname?"/cookie.js":"https://app.vibetrack.com/cookie.js",n.async=!0,n.onload=function(){setTimeout(()=>{window.avelorCookie&&window.avelorCookie.showIconOnly?window.avelorCookie.showIconOnly(e):window.avelorCookie&&window.avelorCookie.fetchAndRender?window.avelorCookie.fetchAndRender(e):console.warn("Cookie script loaded but functions not available")},100)},n.onerror=function(){console.warn("Failed to load cookie script for icon")},(document.head||document.body||document.documentElement).appendChild(n)}async function jt(){window._paq=window._paq||[];try{_paq.push(["requireCookieConsent"])}catch(e){}let e=!0;if(h())try{_paq.push(["setCookieConsentGiven"])}catch(e){}else{try{e=await at()}catch(e){}if(e)if("visual"===window.vtBannerMode||"partial"===window.vtBannerMode)try{_paq.push(["setCookieConsentGiven"])}catch(e){}else if(Ut)try{_paq.push(["setCookieConsentGiven"])}catch(e){}else{try{_paq.push(["forgetCookieConsentGiven"])}catch(e){}_paq.push(["disableCookies"]);try{const e=document.cookie?document.cookie.split(";"):[],t=window.location.hostname||"",n=t.split("."),o=n.length>=2?"."+n.slice(-2).join("."):null;for(let n=0;n<e.length;n++){const i=e[n].trim(),r=i.indexOf("="),a=r>=0?i.substring(0,r):i;if(/^_(pk|vt)_(id|ses|ref)\./.test(a)){const e="expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/";try{document.cookie=`${a}=; ${e}`}catch(e){}if(o)try{document.cookie=`${a}=; ${e}; domain=${o}`}catch(e){}try{document.cookie=`${a}=; ${e}; domain=.${t}`}catch(e){}}}}catch(e){}}else try{_paq.push(["setCookieConsentGiven"])}catch(e){}}const t=window.location.href,n=i,r=Ke&&Ke.trackingCode===n&&Ke.currentUrl===t?Ke.data:null;(r?Promise.resolve(r):fetch(`${Et}/api/collect/id?trackingCode=${n}&url=${encodeURIComponent(t)}`).then(e=>{if(!e.ok)throw new Error(`Error ${e.status}: ${e.statusText}`);return e.json()})).then(e=>{if(i!==n)return;try{w(e)}catch{}if(!e.matomoSiteId)return console.error("No Matomo site ID found for this tracking code"),void o("vt:magic-link-pageview-complete",!1,"matomo_site_id_missing");if(!e||!e.matomoTrackingUrl)return console.error("Matomo tracking URL missing from /api/collect/id response; skipping Matomo initialization"),void o("vt:magic-link-pageview-complete",!1,"matomo_tracking_url_missing");let t=String("undefined"!=typeof window&&window.vtMatomoFirstPartyUrl?window.vtMatomoFirstPartyUrl:e.matomoTrackingUrl);t&&!t.endsWith("/")&&(t+="/"),_paq.push(["setTrackerUrl",t+"d.php"]),_paq.push(["setCookieNamePrefix",h()?"_vt_tm_"+p(i+"|"+window.location.hostname+"|"+(a||"/"))+"_":"_vt_"]),h()&&_paq.push(["setCookiePath",a||"/"]),_paq.push(["setSecureCookie","https:"===window.location.protocol]),_paq.push(["setSiteId",e.matomoSiteId]);try{window.__vtMatomoSiteId=e.matomoSiteId}catch(e){}try{var r=Gt(),c=[];try{if(e&&Array.isArray(e.domains))for(var s=0;s<e.domains.length;s++)try{var l=String(e.domains[s]||"").toLowerCase().trim();if(!l)continue;if(l.indexOf("://")>=0)try{l=new URL(l).hostname.toLowerCase()}catch(e){}if(!(l=l.split("/")[0]))continue;c.push(l),0===l.indexOf("www.")?c.push(l.substring(4)):c.push("www."+l)}catch(e){}}catch(e){}try{var d=String(window.location.hostname||"").toLowerCase().trim();d&&(c.push(d),0===d.indexOf("www.")?c.push(d.substring(4)):c.push("www."+d))}catch(e){}r&&!h()&&(_paq.push(["setCookieDomain",r]),c.push("*"+r));for(var u={},m=[],g=0;g<c.length;g++){var f=String(c[g]||"").toLowerCase().trim();f&&(u[f]||(u[f]=!0,m.push(f)))}h()?_paq.push(["setDomains",[window.location.hostname+("/"===a?"":a)]]):m.length>0?(_paq.push(["setDomains",m]),_paq.push(["enableCrossDomainLinking"])):r&&_paq.push(["setDomains",["*"+r]])}catch(e){}(function(e){if(Z()&&"true"!==Wt("vt_cookies_performance"))return void oe(e);const t=function(e){if(!e||!X())return null;const t=te(e);if(t)return ne(e,t),F("cookie",t);const n=K(e);try{const t=I(n);if(V(t))return F("local",t.toLowerCase());t&&C(n);const o=Y(e),i=I(o);if(V(i))return ne(e,i),F("legacy",i.toLowerCase());i&&C(o)}catch(e){return Ye(e,"visitor-id-read"),F("unavailable",null)}const o=ie();return o?ne(e,o)?F("generated",o):F("unavailable",null):null}(e),n=window.location.href.match(/[?&#]pk_vid=([^&#]*)/);!n||h()?t&&_paq.push(["setVisitorId",t]):_paq.push([function(){try{if(!X())return;const o=new URLSearchParams("pk_vid="+n[1]).get("pk_vid").slice(0,16).toLowerCase(),i=this.getVisitorId();if(V(o)&&V(i)&&i.toLowerCase()===o)return void J(e,i);t&&this.setVisitorId(t)}catch(e){Ye(e,"visitor-cross-domain-resolution")}}])})(e.matomoSiteId),_paq.push(["enableLinkTracking"]),_paq.push(["setCustomUrl",L()]),_paq.push(["trackPageView",void 0,{dimension1:window.location.origin+window.location.pathname}]),_paq.push([function(){try{var e=this.getVisitorId&&this.getVisitorId();e&&J(window.__vtMatomoSiteId,e)}catch(e){}}]);try{setTimeout(function(){try{var e=window.Matomo&&"function"==typeof window.Matomo.getAsyncTracker?window.Matomo.getAsyncTracker():window.Piwik&&"function"==typeof window.Piwik.getAsyncTracker?window.Piwik.getAsyncTracker():null;if(e&&"function"==typeof e.getVisitorId){var t=e.getVisitorId();t&&J(window.__vtMatomoSiteId,t)}}catch(e){}},200)}catch(e){}try{if(!window.__vtUtmEnrichRan){let e=0;const t=20,n=setInterval(function(){e++;try{var o=null;try{o=sessionStorage.getItem("vt_matomo_vid")}catch(e){}
1if(o&&"function"==typeof window.avelorUpdateCurrentConversionWithPixels){window.__vtUtmEnrichRan=!0;try{window.avelorUpdateCurrentConversionWithPixels()}catch(e){}return void clearInterval(n)}}catch(e){}e>=t&&clearInterval(n)},200)}}catch(e){}Pt(t).then(function(){try{window._paq&&"function"==typeof window._paq.push&&window._paq.push([function(){try{var e=this.getVisitorId&&this.getVisitorId();if(e)try{J(window.__vtMatomoSiteId,e)}catch(e){}}catch(e){}try{"function"==typeof window.avelorUpdateCurrentConversionWithPixels&&(setTimeout(function(){try{window.avelorUpdateCurrentConversionWithPixels()}catch(e){}},0),setTimeout(function(){try{window.avelorUpdateCurrentConversionWithPixels()}catch(e){}},800),setTimeout(function(){try{window.avelorUpdateCurrentConversionWithPixels()}catch(e){}},3500))}catch(e){}o("vt:magic-link-pageview-complete",!0,null)}])}catch(e){}}).catch(function(e){Ye(e,"matomo-script-load"),o("vt:magic-link-pageview-complete",!1,"matomo_script_failed")})}).catch(e=>{console.error("Error fetching Matomo ID:",e),console.warn("Matomo tracking disabled due to error."),o("vt:magic-link-pageview-complete",!1,"matomo_configuration_failed"),e.message.includes("404")&&(console.error(`Website with tracking code "${i}" not found in database`),console.error("Please check if the tracking code is correct and the website is properly configured"))})}async function Bt(e){if(!await lt())return(window.vtDebugMode||window.avelorDebugMode)&&console.log("Marketing pixels not allowed, skipping initialization"),void(e&&e());try{Ce=null,xe=new Promise(e=>{$e=e})}catch(e){}const t=`${Et}/api/pixel/get-for-site?trackingCode=${i}&url=${encodeURIComponent(window.location.href)}`;(window.vtDebugMode||window.avelorDebugMode)&&console.log("ð Fetching pixels from:",t),fetch(t,{method:"GET",mode:"cors",headers:{"Content-Type":"application/json"}}).then(t=>{if(window.avelorDebugMode&&console.log("ð Pixel API response status:",t.status),404===t.status){(window.vtDebugMode||window.avelorDebugMode)&&console.log("â No tracking pixels configured for this website yet"),(window.vtDebugMode||window.avelorDebugMode)&&console.log(`â If this is unexpected, verify tracking code "${i}" exists in your dashboard`);try{Ce=!1,Je()}catch(e){}return e&&e(),null}if(!t.ok){console.warn("â Failed to fetch pixel data"),console.warn(`â Server responded with status ${t.status} for tracking code "${i}"`);try{Ce=!1,Je()}catch(e){}return e&&e(),null}return t.json()}).then(t=>{if(console.log("ð Pixel API response data:",t),!t){try{Ce=!1,Je()}catch(e){}return void(e&&e())}if(!t||!Array.isArray(t)||0===t.length){console.log("â No active tracking pixels found for this site"),console.log("â Data received:",t);try{Ce=!1,Je()}catch(e){}return void(e&&e())}console.log(`â
Found ${t.length} tracking pixel(s) for this site`);const n=[];t.forEach(e=>{if(!e.active)return void console.log(`Skipping inactive pixel: ${e.type} - ${e.pixelId}`);const t=`${e.type}_${e.pixelId}`;switch(pe.set(t,{id:e.id,type:e.type,pixelId:e.pixelId,name:e.name,serverSideEnabled:!0===e.serverSideEnabled}),e.type){case"facebook":if(le.facebook.has(e.pixelId))return void((window.vtDebugMode||window.avelorDebugMode)&&console.log(`Facebook Pixel ${e.pixelId} already initialized`));!async function(e){if((window.vtDebugMode||window.avelorDebugMode)&&console.log("ð¥ Initializing Facebook Pixel with ID:",e),le.facebook.has(e))return void((window.vtDebugMode||window.avelorDebugMode)&&console.log(`ð Facebook Pixel ${e} already initialized by us, skipping`));if(window.fbq&&"function"==typeof window.fbq){(window.vtDebugMode||window.avelorDebugMode)&&console.log(`ð Facebook Pixel library detected, checking for existing pixel ID ${e}`);try{if(window.fbq._pixelsByID&&window.fbq._pixelsByID[e])return(window.vtDebugMode||window.avelorDebugMode)&&console.log(`â ï¸ Facebook Pixel ${e}
1 found in _pixelsByID, skipping initialization but logging for attribution`),void le.facebook.add(e)}catch(e){(window.vtDebugMode||window.avelorDebugMode)&&console.log("ð Could not check _pixelsByID:",e&&e.message?e.message:e)}try{if("function"==typeof window.fbq.getPixel&&window.fbq.getPixel(e))return(window.vtDebugMode||window.avelorDebugMode)&&console.log(`â ï¸ Facebook Pixel ${e} found via getPixel(), skipping initialization but logging for attribution`),void le.facebook.add(e)}catch(e){(window.vtDebugMode||window.avelorDebugMode)&&console.log("ð Could not check getPixel():",e&&e.message?e.message:e)}try{if(window.dataLayer&&Array.isArray(window.dataLayer)&&window.dataLayer.some(t=>Array.isArray(t)&&"config"===t[0]&&t[1]&&t[1].toString().includes(e)))return(window.vtDebugMode||window.avelorDebugMode)&&console.log(`â ï¸ Facebook Pixel ${e} found in dataLayer, skipping initialization but logging for attribution`),void le.facebook.add(e)}catch(e){(window.vtDebugMode||window.avelorDebugMode)&&console.log("ð Could not check dataLayer:",e&&e.message?e.message:e)}(window.vtDebugMode||window.avelorDebugMode)&&console.log(`â ï¸ Facebook Pixel library exists but pixel ${e} not detected as existing. Initializing our pixel via existing fbq.`);try{fbq("init",e,Yt());const t=Qt(),n=`vt_pv_${e}_${t}_${Date.now()}`;fbq("track","PageView",{},{eventID:n}),yn(e,n),le.facebook.add(e),(window.vtDebugMode||window.avelorDebugMode)&&console.log(`â
Facebook Pixel ${e} initialized via existing library`)}catch(t){console.warn(`â Failed to initialize Facebook Pixel ${e} via existing fbq:`,t)}return}var t,n,o,i,r,a;t=window,n=document,o="script",t.fbq||(i=t.fbq=function(){i.callMethod?i.callMethod.apply(i,arguments):i.queue.push(arguments)},t._fbq||(t._fbq=i),i.push=i,i.loaded=!0,i.version="2.0",i.queue=[],(r=n.createElement(o)).async=!0,r.src="https://connect.facebook.net/en_US/fbevents.js",(a=n.getElementsByTagName(o)[0]).parentNode.insertBefore(r,a)),fbq("init",e,Yt());const c=Qt(),s=`vt_pv_${e}_${c}_${Date.now()}`;fbq("track","PageView",{},{eventID:s}),yn(e,s),le.facebook.add(e),window.avelorDebugMode&&console.log("Facebook Pixel initialized with ID:",e)}(e.pixelId),le.facebook.add(e.pixelId);break;case"linkedin":if(le.linkedin.has(e.pixelId))return void((window.vtDebugMode||window.avelorDebugMode)&&console.log(`LinkedIn Pixel ${e.pixelId} already initialized`));tn(e.pixelId),le.linkedin.add(e.pixelId);break;case"googleads":if(le.googleads.has(e.pixelId))return void((window.vtDebugMode||window.avelorDebugMode)&&console.log(`Google Ads Pixel ${e.pixelId} already initialized`));nn(e.pixelId),le.googleads.add(e.pixelId);break;case"tiktok":if(le.tiktok.has(e.pixelId))return void((window.vtDebugMode||window.avelorDebugMode)&&console.log(`TikTok Pixel ${e.pixelId} already initialized`));on(e.pixelId),le.tiktok.add(e.pixelId);break;case"openai":if(le.openai.has(e.pixelId))return void((window.vtDebugMode||window.avelorDebugMode)&&console.log(`OpenAI Pixel ${e.pixelId} already initialized`));rn(e.pixelId),le.openai.add(e.pixelId);break;case"customcode":if(e.config&&e.config.customCodeIntegrationId){const t=e.config.trigger||"cookie-consent",o=e.config.customCodeIntegrationId;if("always"===t){if(Te.has(o))break;wn(o)}else if("cookie-consent"===t)try{const e=wn(o);e&&"function"==typeof e.then&&(Ce=!0,n.push(e))}catch(e){}else console.warn(`Unknown trigger type for Custom Code Integration: ${t}`)}else console.warn("Custom Code pixel missing customCodeIntegrationId in config");break;default:"custom_code"!==e.type&&console.warn(`Unknown pixel type: ${e.type}`)}});try{n.length?Promise.allSettled(n).then(()=>{Je()}):(Ce=!1,Je())}catch(e){Ce=!1,Je()}e&&e()}).catch(t=>{console.warn("Network error while fetching pixels:",t.message);try{Ce=!1,Je()}catch(e){}e&&e()})}function Ft(e){const t=v(e)+"=",n=document.cookie.split(";");for(let e=0;e<n.length;e++){let o=n[e];for(;" "===o.charAt(0);)o=o.substring(1);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return null}function Vt(){try{if(t)return!0;if(h())return!0;try{if(!1===it)return!0}catch(e){}const e=Ft("vt_consent_prefs");if(!e)return!1;const n=JSON.parse(e);return"true"===String(n&&n.marketing)}catch(e){return!1}}function Wt(e){try{if(t&&e&&e.startsWith("vt_cookies_"))return"true";if(e&&e.startsWith("vt_cookies_")){if(h())return"true";const t=e.substring(11),n=Ft("vt_consent_prefs");if(n)try{const e=JSON.parse(n);if(e&&Object.prototype.hasOwnProperty.call(e,t))return String(e[t])}catch(e){}}}catch(e){}return Ft(e)}function Gt(){const e=window.location.hostname,t=String(e||"").toLowerCase();if(h())return null;if("localhost"===e||"127.0.0.1"===e||/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(e))return null;const n=[".webflow.io"];for(let e=0;e<n.length;e++){const o=n[e];if(t===o.slice(1)||t.endsWith(o))return null}const o=e.split(".");if(o.length<2)return null;const i=String(o[o.length-1]||"").toLowerCase(),r=String(o[o.length-2]||"").toLowerCase(),a=new Set(["co","com","org","net","gov","ac"]),c="."+(2===i.length&&a.has(r)&&o.length>=3?o.slice(-3).join("."):o.slice(-2).join("."));return window.avelorDebugMode&&(ye.has(c)||(ye.add(c),console.log(`ðª Setting cookies for domain: ${c} (from ${e})`))),c}async function Ht(){const e=Qt(),t=Kt(),n=window.location.href,o=function(){try{return Vt()}catch(e){return!1}}(),r=function(){try{return"visual"===window.vtBannerMode||"partial"===window.vtBannerMode}catch(e){return!1}}(),a=o||r;let c=null;if(a)try{const e=I("wf_lead");if(e)try{c=JSON.parse(e)}catch(e){c=null}}catch(e){}let s,l={};if(a)try{l=Fn()||{}}catch(e){}s=o?"accepted":"individual";const d=await bn();fetch(`${Et}/api/conversions/update-current`,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,userId:t,triggerPage:n,newCookieConsent:s,pixels:d,trackingCode:i,firstName:a?l&&l.firstName?l.firstName:c&&c.firstName?c.firstName:null:null,lastName:a?l&&l.lastName?l.lastName:c&&c.lastName?c.lastName:null:null,email:a?l&&l.email?l.email:c&&c.email?c.email:null:null,phone:a?l&&l.phone?l.phone:c&&c.phone?c.phone:null:null,matomoVisitorId:Rn()})}).then(e=>e.ok?e.json():(console.warn(`Failed to update current conversion (${e.status})`),null)).then(e=>{e&&e.updatedCount>0&&d.length}
1).catch(e=>{console.warn("Error updating current conversion:",e)})}async function Jt(e,o,r,a,c){const s=function(){try{return Vt()}catch(e){return!1}}(),l=function(){try{return"visual"===window.vtBannerMode||"partial"===window.vtBannerMode}catch(e){return!1}}(),d=s||l,u=Fn();u.eventValue&&u.eventValue>0&&(a=u.eventValue),u.currency&&(c=u.currency),o&&o.length>0&&o.includes("Page Visit"),r&&r.length;const m=Qt(),g=Kt(),f=Wt("vt_cookies_accepted"),p="true"===Wt("vt_cookies_marketing");let w;if(f)w=p?"accepted":"individual";else{let e=!1;try{e=!1===it}catch(t){e=!1}w=e?"accepted":"not_set"}const h=function(){try{let e=!1;try{e="visual"===window.vtBannerMode||"partial"===window.vtBannerMode||!1===it}catch(t){e=!1}return!(!p&&!e)}catch(e){return!1}}();if(h){try{Ln()}catch(e){}try{On()}catch(e){}try{En()}catch(e){}try{Mn()}catch(e){}}let v=null;d&&(v=u.phone),v||(v=Gn());const y=P(),_={websiteId:window.vtWebsiteId||void 0,trackingCode:window.vtTrackingCode||window.avelorTrackingCode||i,eventNames:o||[],eventValue:a,currency:c||"EUR",pixels:r||[],triggerPage:window.location.href,triggerId:e.id,triggerName:e.name,sourcePage:null,cookieConsent:w,gclid:h?function(){try{return sessionStorage.getItem("vt_click_gclid")}catch(e){return null}}():null,gbraid:h?function(){try{return sessionStorage.getItem("vt_click_gbraid")}catch(e){return null}}():null,wbraid:h?function(){try{return sessionStorage.getItem("vt_click_wbraid")}catch(e){return null}}():null,fbp:h?function(){try{return sessionStorage.getItem("vt_click_fbp")}catch(e){return null}}():null,fbc:h?function(){try{return sessionStorage.getItem("vt_click_fbc")}catch(e){return null}}():null,ttclid:h?function(){try{return sessionStorage.getItem("vt_click_ttclid")}catch(e){return null}}():null,liFatId:h?function(){try{return gn()}catch(e){return null}}():null,openAiOppref:h?function(){try{return se().oppref}catch(e){return null}}():null,openAiObref:h?function(){try{return se().obref}catch(e){return null}}():null,firstName:u.firstName,lastName:u.lastName,email:u.email,phone:v,orderId:u.orderId,vatAmount:u.vatAmount,utmSource:n&&n.utmSource||y.utm_source||null,utmCampaign:n&&n.utmCampaign||y.utm_campaign||null,utmContent:n&&n.utmContent||y.utm_content||null,utmMedium:n&&n.utmMedium||y.utm_medium||null,utmTerm:n&&n.utmTerm||y.utm_term||null,vtCampaign:t?null:y.vt_campaign||null,vtAdset:t?null:y.vt_adset||null,vtAd:t?null:y.vt_ad||null,sessionId:m,userId:g,timeOnPage:Math.round((Date.now()-(window.vtPageStartTime||window.avelorPageStartTime||Date.now()))/1e3),scrollDepth:Math.round((window.pageYOffset+window.innerHeight)/document.documentElement.scrollHeight*100),matomoVisitorId:Rn(),handoffToken:bt()};return window.avelorDebugMode&&(console.log("ð Consolidated conversion data:",_),console.log("ð Matomo Visitor ID: "+(_.matomoVisitorId?"Available":"Not available")),_.matomoVisitorId?console.log("ð UTM parameters will be fetched from Matomo by the API"):console.log("ð No Matomo Visitor ID - UTM parameters will remain null")),fetch(`${Et}/api/conversions`,{method:"POST",mode:"cors",keepalive:!0,headers:{"Content-Type":"application/json"},body:JSON.stringify(_)}).then(e=>e.ok?e.json():(console.warn(`Failed to record consolidated conversion (${e.status})`),e.text().then(e=>{console.error("ð Server error response:",e);try{const t=JSON.parse(e);console.error("ð Parsed error data:",t)}catch(t){console.error("ð Raw error text:",e)}return null}))).then(e=>{e&&(function(e,t){try{if(!e||!t)return;const n=String(e),o=De.get(n)||new Set;o.add(String(t)),De.set(n,o)}catch(e){}}(_.triggerPage,e.id),o&&o.length,r&&r.length,e.matomoUtmEnhanced)}).catch(e=>{console.error("ð Network error recording conversion:",e)})}function Qt(){if(!ee()){try{C("vt_session_id")}catch(e){}try{deleteCookie&&deleteCookie("vt_session_id")}catch(e){}if("undefined"!=typeof window&&!0===window.vtAllowPreConsentSessionId)try{let e=sessionStorage.getItem("vt_session_id_sess");e||(e="sess_"+Date.now()+"_"+Math.random().toString(36).substr(2,9),sessionStorage.setItem("vt_session_id_sess",e));try{window.__vtTransientSessionId=e}catch(e){}return e}catch(e){if(window.__vtTransientSessionId&&"string"==typeof window.__vtTransientSessionId)return window.__vtTransientSessionId;const t="sess_"+Date.now()+"_"+Math.random().toString(36).substr(2,9);try{window.__vtTransientSessionId=t}catch(e){}return t}if(window.__vtTransientSessionId&&"string"==typeof window.__vtTransientSessionId)return window.__vtTransientSessionId;const e="sess_"+Date.now()+"_"+Math.random().toString(36).substr(2,9);try{window.__vtTransientSessionId=e}catch(e){}return e}try{let e=I("vt_session_id");if(!e){const t=Wt("vt_session_id")||Wt("avelor_session_id"),n=function(){try{return window.__vtTransientSessionId}catch(e){return null}}();e=t||n||"sess_"+Date.now()+"_"+Math.random().toString(36).substr(2,9),S("vt_session_id",e);try{deleteCookie&&deleteCookie("vt_session_id")}catch(e){}try{deleteCookie&&deleteCookie("avelor_session_id")}catch(e){}}return e}
1catch(e){return window.__vtTransientSessionId||(window.__vtTransientSessionId="sess_"+Date.now()+"_"+Math.random().toString(36).substr(2,9)),window.__vtTransientSessionId}}function Kt(){if(!ee()){try{C("vt_user_hash")}catch(e){}try{deleteCookie&&deleteCookie("vt_user_hash")}catch(e){}try{deleteCookie&&deleteCookie("avelor_user_hash")}catch(e){}if(window.__vtEphemeralUserHash&&"string"==typeof window.__vtEphemeralUserHash)return window.__vtEphemeralUserHash;const e="user_"+Date.now()+"_"+Math.random().toString(36).substr(2,12);try{window.__vtEphemeralUserHash=e}catch(e){}return e}try{let e=I("vt_user_hash");if(!e){e=Wt("vt_user_hash")||Wt("avelor_user_hash"),e||(e="user_"+Date.now()+"_"+Math.random().toString(36).substr(2,12)),S("vt_user_hash",e);try{deleteCookie&&deleteCookie("vt_user_hash")}catch(e){}try{deleteCookie&&deleteCookie("avelor_user_hash")}catch(e){}}return e}catch(e){let t=Wt("vt_user_hash");if(!t){t="user_"+Date.now()+"_"+Math.random().toString(36).substr(2,12);try{!function(e,t){const n=new Date;n.setTime(n.getTime()+31536e6);const o="expires="+n.toUTCString(),i=Gt(),r=i?`;domain=${i}`:"",c=h()&&a||"/";document.cookie=v("vt_user_hash")+"="+t+";"+o+";path="+c+r+";SameSite=Lax"}(0,t)}catch(e){}}return t}}function Yt(){try{if("true"!==Wt("vt_cookies_marketing"))return{};const e={};try{const t=Kt();t&&(e.external_id=t)}catch(e){}let t={};try{t=Fn()||{}}catch(e){}if(t.email&&"string"==typeof t.email){const n=t.email.trim().toLowerCase();n&&(e.em=n)}if(t.firstName&&"string"==typeof t.firstName){const n=t.firstName.trim().toLowerCase();n&&(e.fn=n)}if(t.lastName&&"string"==typeof t.lastName){const n=t.lastName.trim().toLowerCase();n&&(e.ln=n)}try{let n=t.phone&&"string"==typeof t.phone?t.phone.trim():"";if(n){n=Wn(n,Vn&&Vn())||n}if(n||(n=Gn()||""),n){const t=n.replace(/[\s\-().]/g,"");t&&(e.ph=t)}}catch(e){}return e}catch(e){return{}}}function Zt(e){if(!e)return e;try{const t=new URL(e);["utm_source","utm_medium","utm_campaign","utm_content","utm_term"].forEach(e=>{t.searchParams.delete(e)}),["fbclid","gclid","msclkid","_ga","mc_eid","mc_cid"].forEach(e=>{t.searchParams.delete(e)});const n=t.toString();return n.endsWith("?")?n.slice(0,-1):n}catch(t){return console.warn("Error cleaning URL:",t),e}}function Xt(e){if(!e)return e;try{const t=new URL(e),n=new Set(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id"]),o=[];t.searchParams.forEach(function(e,t){o.push(t)}),o.forEach(function(e){n.has(String(e||"").toLowerCase())||t.searchParams.delete(e)});const i=t.toString();return i.endsWith("?")?i.slice(0,-1):i}catch(t){return Zt(e)}}function en(){return window.__vtBlockAll?Promise.resolve():Re().then(async e=>{if(!e)throw new Error("Trigger check did not return data");e&&e.triggers&&e.triggers.length>0&&await Promise.all(e.triggers.map(async e=>{const t=function(e){try{if(!e||!e.id)return null;const t=function(){try{return window.location.origin+window.location.pathname}catch(e){return""}}();return`vt_trigger_fired:${i}:${e.id}:${p(t)}`}catch(e){return null}}(e)||e&&e.id;if(!t||!Ae.has(t))if(t&&Ae.add(t),e.conversionEvents&&e.conversionEvents.length>0){const t=[],n=[];let o=null,i="EUR";e.conversionEvents.forEach(e=>{"true"===Wt("vt_cookies_marketing")&&function(e){window.avelorDebugMode&&(console.log("ð Event data:",e),console.log("ð Event details:",{platform:e.event?.platform,eventType:e.event?.eventType,hasParameters:!!e.event?.parameters,parametersContent:e.event?.parameters}),console.log("ð Pixel details:",{id:e.pixel?.id,type:e.pixel?.type,pixelId:e.pixel?.pixelId,pixelId_Status:e.pixel?.pixelId?"VALID":"MISSING"}),"googleads"===e.event?.platform||"google"===e.event?.platform?function(e){if(!e||!e.event||!e.pixel)return void console.error("Invalid event structure for Google Ads debugging");const t=e.pixel.pixelId,n=t.startsWith("AW-")?t:`AW-${t}`,o=e.event.platform,i=e.event.parameters||{},r="true"===Wt("vt_cookies_marketing");console.group("Google Ads Event Detailed Debug"),console.log("Event ID:",e.id),console.log("Platform:",o),console.log("Pixel ID:",t),console.log("Formatted Google Ads ID:",n);const a=i.googleAdsConversionLabel||i.conversionLabel,c=i.googleAdsConversionId;a?console.log("â
Conversion Label:",a):r?console.warn("â ï¸ Missing Conversion Label - Google Ads requires this for accurate tracking"):console.log("â¹ï¸ Conversion Label available (would be used if marketing cookies accepted)"),c?console.log("â
Custom Conversion ID:",c):console.log("â¹ï¸ Using default Conversion ID from pixel");const s=function(){try{if(!c)return n;const e=String(c);return e.startsWith("AW-")?e:`AW-${e}`}catch(e){return n}}(),l=a?`${s}/${a}`:s;console.log("Expected send_to value:",l),"function"==typeof window.gtag?console.log("â
gtag is available"):r?console.error("â gtag is NOT available - tracking will fail"):console.log("â¹ï¸ gtag not loaded (marketing cookies not accepted)"),le.googleads.has(n)?console.log("â
This Google Ads pixel is marked as initialized"):r?console.warn("â ï¸ This Google Ads pixel is NOT marked as initialized"):console.log("â¹ï¸ Google Ads pixel not initialized (marketing cookies not accepted)"),console.log("All event parameters:",i),console.groupEnd()}(e):"linkedin"===e.event?.platform&&function(e){if(!e||!e.event||!e.pixel)return void console.error("Invalid event structure for LinkedIn debugging");const t=e.pixel.pixelId,n=e.event.platform,o=e.event.parameters||{},i=e.event.eventType||"conversion",r="true"===Wt("avelor_cookies_marketing");console.group("LinkedIn Event Detailed Debug"),console.log("Event ID:",e.i
1d),console.log("Platform:",n),console.log("Pixel ID (Partner/Tag ID):",t),console.log("Event Type:",i),"function"==typeof window.lintrk?console.log("â
lintrk is available"):r?console.error("â lintrk is NOT available - tracking will fail"):console.log("â¹ï¸ lintrk not loaded (marketing cookies not accepted)"),window._linkedin_data_partner_ids?(console.log("â
_linkedin_data_partner_ids array exists:",window._linkedin_data_partner_ids),window._linkedin_data_partner_ids.includes(t)?console.log("â
This Partner ID is in _linkedin_data_partner_ids array"):r?console.warn("â ï¸ This Partner ID is NOT in _linkedin_data_partner_ids array"):console.log("â¹ï¸ Partner ID not in array (marketing cookies not accepted)")):r?console.error("â _linkedin_data_partner_ids array does not exist"):console.log("â¹ï¸ _linkedin_data_partner_ids not initialized (marketing cookies not accepted)"),le.linkedin.has(t)?console.log("â
This LinkedIn pixel is marked as initialized in our tracker"):r?console.warn("â ï¸ This LinkedIn pixel is NOT marked as initialized in our tracker"):console.log("â¹ï¸ LinkedIn pixel not initialized (marketing cookies not accepted)"),o.conversion_id?console.log("â
conversion_id parameter is present:",o.conversion_id):o.linkedInConversionId?(console.log("â
linkedInConversionId parameter is present:",o.linkedInConversionId),console.log("â¹ï¸ This will be mapped to conversion_id in the event firing")):r?console.warn("â ï¸ Missing conversion_id parameter - LinkedIn requires this for c
1onversions"):console.log("â¹ï¸ conversion_id parameter available (would be used if marketing cookies accepted)"),console.log("All event parameters:",o),console.groupEnd()}(e)),e.event?e.event.eventType||console.warn("Missing event type in event configuration"):console.warn("No event object found in the conversion event"),e.pixel?e.pixel.pixelId||(console.error("â ï¸ CRITICAL ERROR - Missing actual platform pixelId!"),console.log("This pixel will not fire correctly.")):console.error("â ï¸ ERROR - No pixel object in the conversion event data")}(e);const r=function(e){const t=e&&e.event;if(!t)return null;const n=t.parameters&&"object"==typeof t.parameters?t.parameters:{},o="string"==typeof t.platform?t.platform.toLowerCase():"";if("googleads"===o&&"string"==typeof n.googleAdsEventName&&n.googleAdsEventName.trim())return n.googleAdsEventName.trim();if("linkedin"===o&&"string"==typeof n.linkedInEventName&&n.linkedInEventName.trim())return n.linkedInEventName.trim();if("custom_code"===o){const e=n.customCodeEventName||n.customCodeName||n.name;if("string"==typeof e&&e.trim())return e.trim()}return"string"==typeof t.eventType&&t.eventType.trim()?t.eventType.trim():null}(e);if(r&&(t.includes(r)||t.push(r),e.event.parameters)){const t=e.event.parameters;if(t.value){const e=parseFloat(t.value);(null===o||e>o)&&(o=e)}t.currency&&(i=t.currency)}if(e.pixel&&!1!==e.pixel.active&&e.pixel.pixelId){const t={id:e.pixel.id,type:e.pixel.type,pixelId:e.pixel.pixelId,name:e.pixel.name};n.find(e=>e.id===t.id)||n.push(t)}else e.pixel&&!1===e.pixel.active?console.warn(`Pixel ${e.pixel.pixelId} is deactivated, excluding from pixel firing but conversion will still be recorded`):e.pixel&&!e.pixel.pixelId&&console.warn(`Missing platform pixelId for event ${e.id}, pixel type: ${e.pixel.type}, excluding from pixel firing but conversion will still be recorded`)});const r=Wt("vt_cookies_accepted"),a="true"===Wt("vt_cookies_marketing"),c=await bn();let s=n;if(s=r&&a?[...n,...c].reduce((e,t)=>(e.find(e=>e.id===t.id)||e.push(t),e),[]):c.length>0?c:[],e.conversionEvents&&e.conversionEvents.length>0&&await Jt(e,t,s,o,i),!await lt())return void console.log("ð« Marketing pixels not allowed, skipping conversion event firing");console.log("ð¥ Marketing pixels allowed, firing conversion events"),e.conversionEvents.forEach(async t=>{if(!t.pixel||!1===t.pixel.active||!t.pixel.pixelId)return void(t.pixel&&!1===t.pixel.active&&window.avelorDebugMode&&console.log(`Skipping pixel firing for deactivated pixel ${t.pixel.pixelId}, but conversion was already recorded`));const n=t.pixel.type,o=t.pixel.pixelId;if(t.event){const n=t.event,i=n.platform,r=n.eventType,a=n.parameters||{};try{const e=Fn();e&&(e.eventValue&&e.eventValue>0&&(a.value=e.eventValue),e.currency&&(a.currency=e.currency))}catch(e){}if(!r)return void console.warn(`Empty or missing event type for ${i} pixel, skipping event firing`);if(!await lt())return void console.warn(`Marketing pixels not allowed, aborting pixel firing for ${i} pixel ${o}`);try{Ee.add(`consent_replay_${t.id}_${e.id}_${window.location.pathname}`)}catch(e){}switch(i){case"facebook":if(window.fbq){void 0!==window._fbq&&window._fbq.queue&&(window._fbq.queue.some(e=>"init"===e[0]&&e[1]===o)||le.facebook.has(o)||(console.warn(`Facebook pixel ${o} was not previously initialized, initializing now`),window.fbq("init",o,Yt()),le.facebook.add(o)));const n=Qt(),i=`vt_conv_${t.id}_${n}_${Date.now()}`,c=`ss_${t.id}_${e.id}_${window.location.pathname}`;fe(o,r,a,i,function(e){Me.add(c),hn(o,r,a,e)}),console.log("Facebook conversion event fired successfully with parameters:",{pixelId:o,eventType:r,eventID:i,parameters:a})}else console.warn("Facebook Pixel not initialized, cannot fire event");break;case"linkedin":{const e=Qt(),n=`vt_li_${t.id}_${e}_${Date.now()}`;un(o,a,r,n)}break;case"google":case"googleads":if(!window.gtag)return console.warn(`Google Ads tracking not initialized, initializing now for ${o}`),nn(o),void setTimeout(()=>{console.log("Delayed firing of Google Ads event after initialization"),dn(o,a,t)},1e3);const n=o.startsWith("AW-")?o:`AW-${o}`;if(!le.googleads.has(n))return console.warn(`This specific Google Ads pixel ${n} was not initialized, initializing now`),nn(o),void setTimeout(()=>{console.log("Delayed firing of Google Ads event after new pixel initialization"),dn(o,a,t)},1e3);dn(o,a,t);break;case"openai":{const e=Qt(),n=`vt_openai_${t.id}_${e}_${Date.now()}`;ln(o,a,r,n);break}
1case"tiktok":if(window.ttq){le.tiktok.has(o)||(console.log(`TikTok pixel ${o} not found in integrations, initializing for conversion event`),console.warn(`â ï¸ TikTok pixel ${o} should be installed in Integrations for optimal performance`),on(o),le.tiktok.add(o));const e=Qt(),n={...a,event_id:`vt_conv_${t.id}_${e}_${Date.now()}`};try{if(window.ttq&&window.ttq.instance){const e=window.ttq.instance(o);e&&e.track?(e.track(r,n),console.log(`TikTok conversion event fired (${r}) for specific pixel ${o}`,n)):(console.error(`Could not get TikTok pixel instance for ${o}`),window.ttq.track(r,{...n,pixelId:o}),console.log(`TikTok event fired globally with pixel ID ${o} (fallback)`,n))}else console.error("TikTok instance API not available"),window.ttq.track(r,n),console.log(`TikTok event fired globally (final fallback) for ${o}`,n)}catch(e){console.error("Error firing TikTok event:",e),window.ttq.track(r,n),console.log(`TikTok event fired globally (error fallback) for ${o}`,n)}}else console.warn("TikTok Pixel not initialized, cannot fire event");break;case"custom_code":try{if(a&&a.customCodeEventId){if(Ne.has(a.customCodeEventId))return;const e=a.trigger||"cookie-consent";if("always"===e)return;"cookie-consent"===e?He().then(()=>{fn(a.customCodeEventId)}):(console.warn(`Unknown trigger type for custom code event: ${e}`),fn(a.customCodeEventId))}else console.warn("Missing customCodeEventId parameter for custom code event")}catch(e){console.error("Error executing custom code:",e)}break;default:console.warn(`Unknown platform: ${i}`)}}else switch(n){case"facebook":window.fbq&&(window.fbq("track","PageView"),console.log("Generic Facebook PageView event fired"));break;case"linkedin":console.warn("Generic LinkedIn conversion skipped: conversion ID is missing");break;case"googleads":if(window.gtag){const e=o.startsWith("AW-")?o:`AW-${o}`,t=parameters&&(parameters.googleAdsConversionLabel||parameters.conversionLabel),n=t?`${e}/${t}`:e;window.gtag("event","conversion",{send_to:n}),console.log(`Generic Google Ads conversion event fired for ID ${n}`)}break;case"tiktok":window.ttq&&(window.ttq.track("SubmitForm"),console.log("Generic TikTok SubmitForm event fired"))}})}else{const t=await bn(),n="magic_link"===e.matchType?[]:["Page Visit"];await Jt(e,n,t,null,"EUR")}}))}).then(()=>{o("vt:magic-link-triggers-complete",!0,null)}).catch(e=>{console.warn("Error checking triggers",e),o("vt:magic-link-triggers-complete",!1,"trigger_check_failed")})}async function tn(e){if((window.vtDebugMode||window.avelorDebugMode)&&console.log("ð¥ Initializing LinkedIn Insight Tag with ID:",e),le.linkedin.has(e))(window.vtDebugMode||window.avelorDebugMode)&&console.log(`ð LinkedIn Insight Tag ${e} already initialized by us, skipping`);else{if(window._linkedin_data_partner_ids&&Array.isArray(window._linkedin_data_partner_ids)&&window._linkedin_data_partner_ids.includes(e))return(window.vtDebugMode||window.avelorDebugMode)&&console.log(`â ï¸ LinkedIn Insight Tag ${e} already exists on page (likely via GTM), skipping initialization but logging for attribution`),void le.linkedin.add(e);if(window._linkedin_data_partner_ids=window._linkedin_data_partner_ids||[],window._linkedin_data_partner_ids.includes(e)||window._linkedin_data_partner_ids.push(e),!window.lintrk&&(window.lintrk=function(e,t){window.lintrk.q.push([e,t])},window.lintrk.q=[],!document.querySelector('script[src*="snap.licdn.com/li.lms-analytics/insight.min.js"]'))){const t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src="https://snap.licdn.com/li.lms-analytics/insight.min.js",t.onload=function(){},t.onerror=function(){console.error(`Failed to load LinkedIn script for ID ${e}`)},document.head.appendChild(t)}le.linkedin.add(e),window.avelorDebugMode&&console.log("LinkedIn Insight Tag initialized with ID:",e)}}async function nn(e){(window.vtDebugMode||window.avelorDebugMode)&&console.log("ð¥ Initializing Google Ads Conversion Tracking with ID:",e);const t=e.startsWith("AW-")?e:`AW-${e}`;if(le.googleads.has(t))(window.vtDebugMode||window.avelorDebugMode)&&console.log(`ð Google Ads Conversion ${t} already initialized by us, skipping`);else{if(window.gtag&&"function"==typeof window.gtag&&window.dataLayer&&Array.isArray(window.dataLayer)&&window.dataLayer.some(e=>Array.isArray(e)&&"config"===e[0]&&e[1]===t))return(window.vtDebugMode||window.avelorDebugMode)&&console.log(`â ï¸ Google Ads ${t} already exists on page (likely via GTM), skipping initialization but logging for attribution`),void le.googleads.add(t);if(window.dataLayer=window.dataLayer||[],window.gtag=window.gtag||function(){dataLayer.push(arguments)},gtag("js",new Date),gtag("config",t,{send_page_view:!1,allow_enhanced_conversions:!0}
1),ue(t),!document.querySelector(`script[src*="googletagmanager.com/gtag/js?id=${t}"]`)){const e=document.createElement("script");e.async=!0,e.src=`https://www.googletagmanager.com/gtag/js?id=${t}`,document.head.appendChild(e),e.onload=function(){ue(t)},e.onerror=function(){console.error(`Failed to load Google Ads script for ID ${t}`)}}le.googleads.add(t),window.avelorDebugMode&&console.log("Google Ads Pixel initialized with ID:",t)}}async function on(e){if((window.vtDebugMode||window.avelorDebugMode)&&console.log("ð¥ Initializing TikTok Pixel with ID:",e),le.tiktok.has(e))(window.vtDebugMode||window.avelorDebugMode)&&console.log(`ð TikTok Pixel ${e} already initialized by us, skipping`);else{if(window.ttq&&"function"==typeof window.ttq)return(window.vtDebugMode||window.avelorDebugMode)&&console.log("â ï¸ TikTok Pixel library already exists on page (likely via GTM), skipping initialization but logging for attribution"),void le.tiktok.add(e);!function(t,n,o){t.TiktokAnalyticsObject=o;var i=t[o]=t[o]||[];i.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie"],i.setAndDefer=function(e,t){e[t]=function(){e.push([t].concat(Array.prototype.slice.call(arguments,0)))}};for(var r=0;r<i.methods.length;r++)i.setAndDefer(i,i.methods[r]);i.instance=function(e){for(var t=i._i[e]||[],n=0;n<i.methods.length;n++)i.setAndDefer(t,i.methods[n]);return t},i.load=function(e,t){var n="https://analytics.tiktok.com/i18n/pixel/events.js";i._i=i._i||{},i._i[e]=[],i._i[e]._u=n,i._t=i._t||{},i._t[e]=+new Date,i._o=i._o||{},i._o[e]=t||{};var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=n+"?sdkid="+e+"&lib="+o;var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(r,a)},i.load(e),i.page()}(window,document,"ttq"),le.tiktok.add(e),window.avelorDebugMode&&console.log("TikTok Pixel initialized with ID:",e)}}async function rn(e){if(e&&!le.openai.has(e))try{if(!window.oaiq){const e=function(){e.q.push(arguments)};e.q=[],window.oaiq=e}if(!document.querySelector("script[data-vibetrack-openai-pixel]")){const e=document.createElement("script");e.async=!0,e.src="https://bzrcdn.openai.com/sdk/oaiq.min.js",e.setAttribute("data-vibetrack-openai-pixel","true"),e.onerror=function(){console.error("OpenAI Measurement Pixel SDK could not be loaded")};const t=document.getElementsByTagName("script")[0];t&&t.parentNode?t.parentNode.insertBefore(e,t):document.head.appendChild(e)}window.oaiq("consent",!0),window.oaiq("init",{pixelId:e}),le.openai.add(e),setTimeout(function(){try{ae()}catch(e){}},250)}catch(e){console.error("OpenAI Measurement Pixel could not be initialized",e)}}function an(e){return"lead_created"===e||"appointment_scheduled"===e||"registration_completed"===e?"customer_action":"subscription_created"===e||"trial_started"===e?"plan_enrollment":"custom"===e?"custom":"contents"}function cn(e){if("string"!=typeof e)return null;const t=e.trim().toUpperCase();return/^[A-Z]{3}$/.test(t)?t:null}window.__vtBlockAll||jt(),window.__vtBlockAll||_n(),window.__vtBlockAll||kn(),window.__vtBlockAll?window.avelorDebugMode&&console.log("ð« Tracking blocked by preflight - skipping pixels and cookie UI"):(async()=>{await lt()?(window.avelorDebugMode&&console.log("Marketing pixels allowed, initializing tracking pixels"),await Bt(()=>{en()})):((window.vtDebugMode||window.avelorDebugMode)&&console.log("Marketing pixels not allowed, skipping tracking pixels"),en()),Lt?qt||zt(i):Rt(i)})(),!window.__vtBlockAll&&Lt&&zt(i),window.avelorInitializePixels=function(){(window.vtDebugMode||window.avelorDebugMode)&&console.log("ð Clearing marketing pixels cache after cookie acceptance"),ct=null,st=null,it=null,rt=null,"true"===Wt("vt_cookies_marketing")?(Ot=!1,fetch(`${Et}/api/pixel/get-for-site?trackingCode=${i}&url=${encodeURIComponent(window.location.href)}`,{method:"GET",mode:"cors",headers:{"Content-Type":"application/json"}}).then(e=>e.ok?e.json():(console.log("Could not fetch pixel names for caching"),null)).then(e=>{e&&Array.isArray(e)&&e.forEach(e=>{if(e.active){const t=`${e.type}_${e.pixelId}`;pe.set(t,{id:e.id,type:e.type,pixelId:e.pixelId,name:e.name})}})}).catch(e=>{console.log("Error caching pixel names:",e.message)}),(async()=>{await Bt(function(){Ht(),function(){try{return Vt()}catch(e){return!1}}()&&Re().then(e=>
1{e&&e.triggers&&0!==e.triggers.length&&e.triggers.forEach(e=>{e.conversionEvents&&0!==e.conversionEvents.length&&e.conversionEvents.forEach(t=>{const n=`consent_replay_${t.id}_${e.id}_${window.location.pathname}`;Ee.has(n)||(Ee.add(n),async function(e,t,n={}){if(!t||!t.pixel||!1===t.pixel.active||!t.pixel.pixelId)return;const o=t.pixel.type,i=t.pixel.pixelId;if(t.event){const o=t.event,r=o.platform,a=o.eventType,c={...o.parameters||{}};try{const e=Fn();e&&(e.eventValue&&e.eventValue>0&&(c.value=e.eventValue),e.currency&&(c.currency=e.currency))}catch(e){}if(!a)return void console.warn(`Empty or missing event type for ${r} pixel, skipping event firing`);if(!await lt())return void console.warn(`Marketing pixels not allowed, aborting pixel replay for ${r} pixel ${i}`);switch(r){case"facebook":if(window.fbq){void 0!==window._fbq&&window._fbq.queue&&(window._fbq.queue.some(e=>"init"===e[0]&&e[1]===i)||le.facebook.has(i)||(console.warn(`Facebook pixel ${i} was not previously initialized, initializing now`),window.fbq("init",i,Yt()),le.facebook.add(i)));const o=Qt(),r=`vt_conv_${t.id}_${o}_${Date.now()}${n.isConsentReplay?"_consent":""}`,s=`ss_${t.id}_${e.id}_${window.location.pathname}`,l=!Me.has(s);fe(i,a,c,r,l?function(e){Me.add(s),hn(i,a,c,e)}:null),console.log("Facebook conversion event replayed successfully with parameters:",{pixelId:i,eventType:a,eventID:r,parameters:c})}else console.warn("Facebook Pixel not initialized, cannot replay event");break;case"linkedin":{const e=Qt(),n=`vt_li_${t.id}_${e}_${Date.now()}_replay`;un(i,c,a,n)}break;case"google":case"googleads":{if(!window.gtag)return console.warn(`Google Ads tracking not initialized, initializing now for ${i}`),nn(i),void setTimeout(()=>{console.log("Delayed replay of Google Ads event after initialization"),dn(i,c,t)},1e3);const e=i.startsWith("AW-")?i:`AW-${i}`;if(!le.googleads.has(e))return console.warn(`This specific Google Ads pixel ${e} was not initialized, initializing now`),nn(i),void setTimeout(()=>{console.log("Delayed replay of Google Ads event after new pixel initialization"),dn(i,c,t)},1e3);dn(i,c,t);break}case"openai":{const e=Qt(),o=`vt_openai_${t.id}_${e}_${Date.now()}${n.isConsentReplay?"_consent":""}`;ln(i,c,a,o);break}case"tiktok":if(window.ttq){le.tiktok.has(i)||(console.log(`TikTok pixel ${i} not found in integrations, initializing for conversion event replay`),on(i),le.tiktok.add(i));const e=Qt(),o={...c,event_id:`vt_conv_${t.id}_${e}_${Date.now()}${n.isConsentReplay?"_consent":""}`};try{if(window.ttq&&window.ttq.instance){const e=window.ttq.instance(i);e&&e.track?(e.track(a,o),console.log(`TikTok conversion event replayed (${a}) for specific pixel ${i}`,o)):(console.error(`Could not get TikTok pixel instance for ${i}`),window.ttq.track(a,{...o,pixelId:i}),console.log(`TikTok event replayed globally with pixel ID ${i} (fallback)`,o))}else console.error("TikTok instance API not available"),window.ttq.track(a,o),console.log(`TikTok event replayed globally (final fallback) for ${i}`,o)}catch(e){console.error("Error replaying TikTok event:",e),window.ttq.track(a,o),console.log(`TikTok event replayed globally (error fallback) for ${i}`,o)}}else console.warn("TikTok Pixel not initialized, cannot replay event");break;case"custom_code":try{if(c&&c.customCodeEventId){if(Ne.has(c.customCodeEventId))return;const e=c.trigger||"cookie-consent";if("always"===e)return;"cookie-consent"===e?He().then(()=>{fn(c.customCodeEventId)}):(console.warn(`Unknown trigger type for custom code event: ${e}`),fn(c.customCodeEventId))}else console.warn("Missing customCodeEventId parameter for custom code event")}catch(e){console.error("Error executing custom code replay:",e)}break;default:console.warn(`Unknown platform: ${r}`)}return}switch(o){case"facebook":window.fbq&&(window.fbq("track","PageView"),console.log("Generic Facebook PageView event replayed"));break;case"linkedin":console.warn("Generic LinkedIn conversion skipped: conversion ID is missing");break;case"googleads":if(window.gtag){const e=i.startsWith("AW-")?i:`AW-${i}`,n=t.event&&t.event.parameters?t.event.parameters:{},o=n&&(n.googleAdsConversionLabel||n.conversionLabel),r=o?`${e}/${o}`:e;window.gtag("event","conversion",{send_to:r}),console.log(`Generic Google Ads conversion event replayed for ID ${r}`)}break;case"tiktok":window.ttq&&(window.ttq.track("SubmitForm"),console.log("Generic TikTok SubmitForm event replayed"))}}(e,t,{isConsentReplay:!0}).catch(e=>
1{console.warn("Error replaying external conversion event after consent",e)}))})})}).catch(e=>{console.warn("Error fetching triggers for external event replay",e)})})})()):(window.vtDebugMode||window.avelorDebugMode)&&console.log("Marketing cookies not accepted, aborting pixel initialization")};const sn=new Map;function ln(e,t,n,o){window.oaiq||rn(e);const r=function(e,t){const n=t&&"object"==typeof t?t:{},o=cn(n.currency),i=function(e,t){const n="number"==typeof e?e:"string"==typeof e&&e.trim()?Number(e):Number.NaN,o=cn(t);if(!o||!Number.isFinite(n)||n<0)return null;try{const e=new Intl.NumberFormat("en-US",{style:"currency",currency:o}).resolvedOptions().maximumFractionDigits;if("number"!=typeof e||!Number.isInteger(e)||e<0)return null;const t=Math.round(n*10**e);return Number.isSafeInteger(t)?t:null}catch(e){return null}}(n.value,o);return{type:an(e),...null!==i&&o?{amount:i,currency:o}:{}}}(n,t),a={event_id:o};"custom"===n&&(a.custom_event_name=t.customEventName),window.oaiq("measureSingle",e,n,r,a);const c=pe.get(`openai_${e}`);c&&!0!==c.serverSideEnabled||async function(e,t,n,o,r){try{const a=await async function(e){const t=sn.get(e);if(t&&t.expiresAt>Date.now()+5e3)return t.token;const n=new URLSearchParams({pixelId:e,trackingCode:i,url:window.location.href}),o=await fetch(`${Et}/api/conversion-api/openai/check-availability?${n.toString()}`,{method:"GET",mode:"cors"}),r=await o.json().catch(function(){return null});return o.ok&&r&&r.available&&r.eventToken?(sn.set(e,{token:r.eventToken,expiresAt:Number(r.eventTokenExpiresAt||0)}),r.eventToken):null}(e);if(!a)return;const c=Fn()||{},s=se(),l=await fetch(`${Et}/api/conversion-api/openai/send-event`,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify({pixelId:e,trackingCode:i,eventToken:a,eventId:n,eventName:t,eventTimeMs:Date.now(),eventSourceUrl:window.location.href,matomoVisitorId:function(){try{return Rn()}catch(e){return null}}(),customEventName:"custom"===t?r.customEventName:void 0,oppref:s.oppref,userData:{email:c.email,phone:c.phone,firstName:c.firstName,lastName:c.lastName,externalId:Kt(),obref:s.obref,userAgent:navigator.userAgent},data:o})});l.ok||console.warn(`OpenAI CAPI event failed with status ${l.status}`)}catch(e){console.warn("OpenAI CAPI event could not be sent",e)}}(e,n,o,r,t||{})}async function dn(e,t,n=null){const o=e.startsWith("AW-")?e:`AW-${e}`,i=t&&(t.googleAdsConversionLabel||t.conversionLabel),r=(t?.googleAdsConversionId||o.replace("AW-",""),i?`${o}/${i}`:o);try{const e={send_to:r,transaction_id:`vt_conv_${n?.id||"unknown"}_${Qt()}_${Date.now()}`},o=Fn(),i=Vn(),a=await async function(e,t){const n={},o=function(e){if("string"!=typeof e)return null;const t=e.trim().toLowerCase(),n=t.lastIndexOf("@");if(n<=0||n===t.length-1||t.indexOf("@")!==n)return null;let o=t.slice(0,n);const i=t.slice(n+1);return o&&i.includes(".")&&!/\s/.test(t)?("gmail.com"!==i&&"googlemail.com"!==i||(o=o.replace(/\./g,"")),`${o}@${i}`):null}(e&&e.email),i=function(e,t){if("string"!=typeof e||!e.trim())return null;let n=e.trim().replace(/\(0\)/g,"");if(/^00\d/.test(n)&&(n=`+${n.slice(2)}`),n.startsWith("+")){if(/[^+\d\s().-]/.test(n))return null;n=`+${n.slice(1).replace(/[^\d]/g,"")}`}else{if("string"!=typeof t||!/^\+?[1-9]\d{0,3}$/.test(t.trim()))return null;const e=n.replace(/[^\d]/g,"").replace(/^0+/,""),o=t.replace(/[^\d]/g,"");if(!e||!o)return null;n=`+${o}${e}`}return/^\+[1-9]\d{10,14}$/.test(n)?n:null}(e&&e.phone,t);if(o){const e=await zn(o);e&&(n.sha256_email_address=e)}if(i){const e=await zn(i);e&&(n.sha256_phone_number=e)}const r=e&&"string"==typeof e.firstName?e.firstName.trim().toLowerCase():"",a=e&&"string"==typeof e.lastName?e.lastName.trim().toLowerCase():"",c=e&&"string"==typeof e.postalCode?e.postalCode.trim():"",s=function(e){if("string"!=typeof e)return null;const t=e.trim().toUpperCase();return"UK"===t?"GB":/^[A-Z]{2}$/.test(t)?t:null}(e&&e.country);if(r&&a&&c&&s){const[e,t]=await Promise.all([zn(r),zn(a)]);e&&t&&(n.address={sha256_first_name:e,sha256_last_name:t,postal_code:c,country:s})}return n}(o,i);if(Object.keys(a).length>0&&(window.gtag("set","user_data",a),(window.vtDebugMode||window.avelorDebugMode)&&console.log(`Enhanced Conversions: ${Object.keys(a).length} matching fields prepared`)),t){const n={...t};["googleAdsConversionLabel","conversionLabel","googleAdsConversionId"].forEach(e
1=>delete n[e]),Object.entries(n).forEach(([t,n])=>{null!=n&&""!==n&&(e[t]=n)})}window.gtag("event","conversion",e),console.log("Google Ads conversion event fired successfully with parameters:",e)}catch(e){console.error("Error firing Google Ads conversion event:",e)}}function un(e,t,n,o){const r=Qt(),a=o||`vt_li_${r}_${Date.now()}`;if(function(e){return"CONVERSIONS_API"===e?.linkedInConversionMethod}(t)){const o=`ss_li_${e}_${t?.linkedInConversionUrn||t?.linkedInConversionId||"unknown"}_${a}`;Me.has(o)||(Me.add(o),function(e,t,n,o){try{const r=n?.linkedInConversionUrn||n?.linkedInConversionId;if(!r)return;const a=`li_ss_status_${i}_${e}_${r}`,c=`${a}_token`,s=`${a}_token_expiry`,l=sessionStorage.getItem(a),d=sessionStorage.getItem(c),u=Number(sessionStorage.getItem(s)||0);if("disabled"===l)return;const m=`linkedin:${i}:${e}:${r}`,g=function(r){r&&async function(e,t,n,o,r){try{let c=!1;try{c=await lt()}catch(e){c=!1}if(!c)return;const s={};if(c){const e=Fn();if(e.email&&(s.email=e.email),e.firstName&&(s.firstName=e.firstName),e.lastName&&(s.lastName=e.lastName),!s.email){const e=vt(document)?.value;e&&(s.email=e)}const t=gn();t&&(s.liFatId=t)}const l=function(){try{return Kt()}catch(e){return null}}(),d=function(){try{return Rn()}catch(e){return null}}(),u=Math.floor(Date.now()/1e3),m=(a={marketingAllowed:c,pixelId:e,eventName:t,eventId:o,eventTime:u,trackingCode:window.vtTrackingCode||window.avelorTrackingCode||i,matomoVisitorId:d,externalIds:[l,d].filter(Boolean),userData:s,customData:n||{},eventToken:r})&&!0===a.marketingAllowed&&a.eventToken?{pixelId:a.pixelId,eventName:a.eventName,eventId:a.eventId,eventTime:a.eventTime,trackingCode:a.trackingCode,matomoVisitorId:a.matomoVisitorId,externalIds:Array.isArray(a.externalIds)?a.externalIds.filter(Boolean):[],userData:a.userData||{},customData:a.customData||{},eventToken:a.eventToken}:null;if(!m)return;fetch(`${Et}/api/conversion-api/linkedin/send-event`,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify(m)}).then(function(t){if(!t.ok){if(401===t.status)try{const t=`li_ss_status_${i}_${e}_${n?.linkedInConversionUrn||n?.linkedInConversionId}`;sessionStorage.removeItem(t),sessionStorage.removeItem(`${t}_token`),sessionStorage.removeItem(`${t}_token_expiry`)}catch(e){}return t.json().then(function(e){console.warn("LinkedIn server-side event failed:",e&&e.message?e.message:t.status)}).catch(function(){console.warn("LinkedIn server-side event failed:",t.status)})}return t.json()}).then(function(t){t&&t.success&&console.log(`LinkedIn server-side event sent for tag ${e}`)}).catch(function(e){console.warn("LinkedIn server-side event network error:",e&&e.message?e.message:e)})}catch(e){console.warn("LinkedIn server-side event preparation error:",e&&e.message?e.message:e)}var a}(e,t,n,o,r)};if("enabled"===l&&d&&u>Date.now()+5e3)return void g(d);if(sessionStorage.removeItem(c),sessionStorage.removeItem(s),Le.has(m))return void Le.get(m).then(function(e){e&&e.available&&e.eventToken&&g(e.eventToken)}).catch(function(e){console.warn("LinkedIn server-side availability check failed:",e&&e.message?e.message:e)});const f=async function(e,t){try{const n=new URLSearchParams({pixelId:String(e),trackingCode:String(i),conversion:String(t),url:String(window.location.href)}),o=await fetch(`${Et}/api/conversion-api/linkedin/check-availability?${n.toString()}`,{method:"GET",mode:"cors",headers:{"Content-Type":"application/json"}});if(!o.ok)return{available:!1,clientOnly:!1};const r=await o.json();return(!r||!0!==r.available&&!0!==r.clientOnly)&&console.warn("LinkedIn server-side tracking unavailable:",r&&r.message?r.message:"not available"),{available:!!r&&!0===r.available,clientOnly:!!r&&!0===r.clientOnly,eventToken:r&&"string"==typeof r.eventToken?r.eventToken:null,eventTokenExpiresAt:r&&"number"==typeof r.eventTokenExpiresAt?r.eventTokenExpiresAt:0}}catch(e){return{available:!1,clientOnly:!1}}}(e,r);Le.set(m,f),f.then(function(e){Le.delete(m),e&&e.available?(sessionStorage.setItem(a,"enabled"),e.eventToken&&sessionStorage.setItem(c,e.eventToken),e.eventTokenExpiresAt&&sessionStorage.setItem(s,String(e.eventTokenExpiresAt))):e&&e.clientOnly?sessionStorage.setItem(a,"disabled"):(sessionStorage.removeItem(a),sessionStorage.removeItem(c),sessionStorage.removeItem(s)),e&&e.available&&e.eventToken&&g(e.eventToken)}).catch(function(e){Le.delete(m),sessionStorage.removeItem(a),sessionStorage.removeItem(c),sessionStorage.removeItem(s),console.warn("LinkedIn server-side availability check failed:",e&&e.message?e.message:e)})}catch(e){console.warn("LinkedIn server-side event preparation error:",e&&e.message?e.message:e)}}(e,n,t||{},a))}try{window._linkedin_data_partner_ids=window._linkedin_data_partner_ids||[],window._linkedin_data_partner_ids.includes(e)||window._linkedin_data_partner_ids.push(e),window.lintrk?mn(e,t,n,a):(console.warn(`LinkedIn tracking not available, reinitializing for ID ${e}`),tn(e),setTimeout(()=>{mn(e,t,n,a)},1e3)),le.linkedin.add(e)}catch(e){console.error("Error firing LinkedIn event:",e)}}
1function mn(e,t,n,o){const i=t?.linkedInConversionId,r=t?.linkedInEventName,a={};i?(a.conversion_id=i,a.event_id=o,r&&(a.conversion_name=r),t&&Object.entries(t).forEach(([e,t])=>{if(null!=t){if("linkedInEventId"===e||"linkedInEventName"===e||"linkedInConversionId"===e||"linkedInConversionUrn"===e||"linkedInConversionMethod"===e)return;a[e]=t}}),window.lintrk("track",a),console.log("LinkedIn conversion event fired successfully with parameters:",{pixelId:e,eventType:n,parameters:a})):console.warn("LinkedIn browser conversion skipped: conversion ID is missing")}function gn(){try{const e=sessionStorage.getItem("vt_click_li_fat_id");if(e)return e}catch(e){}try{const e=In("vt_li_fat_id");if(e)return e;const t=In("li_fat_id");if(t)return t}catch(e){}return null}function fn(e){try{if(_e.has(e))return;if(Ie&&!1!==ke)return _e.add(e),void We().then(()=>{_e.delete(e),fn(e)}).catch(()=>{_e.delete(e)})}catch(e){}if(Ne.has(e))return;const t="undefined"!=typeof performance&&performance.now?performance.now():Date.now();if(Be("â¶ï¸",Ve(e)),we.has(e)){try{pn(we.get(e),e),Ne.add(e)}catch(e){console.error(`Error executing cached custom code: ${e.message}`)}return}const n="undefined"!=typeof performance&&performance.now?performance.now():Date.now();Be("ð Fetching custom code event",e),fetch(`${Et}/api/custom-code-events/${e}`,{method:"GET",mode:"cors",headers:{"Content-Type":"application/json"}}).then(e=>{if(!e.ok)throw console.error(`Failed to fetch custom code: ${e.status} ${e.statusText}`),new Error(`Failed to fetch custom code: ${e.status} ${e.statusText}`);return e.json()}).then(o=>{if(o&&o.codeContent){try{o&&o.name&&he.set(e,{name:o.name})}catch(e){}const i="undefined"!=typeof performance&&performance.now?performance.now():Date.now();Be("â
Fetched",Ve(e),`in ${Math.round(i-n)}ms`),we.set(e,o.codeContent),pn(o.codeContent,e);try{"undefined"!=typeof window&&void 0===window.obApi&&"string"==typeof o.codeContent&&o.codeContent.includes("obApi")&&Fe("â ï¸ obApi is not available after execution (possible Outbrain load race).",Ve(e))}catch(e){}Ne.add(e);const r="undefined"!=typeof performance&&performance.now?performance.now():Date.now();Be("â±ï¸ Finished",Ve(e),`in ${Math.round(r-t)}ms`)}else console.warn(`Custom code event ${e} returned empty code content`)}).catch(e=>{console.error("Error fetching custom code:",e)})}function pn(e,t){try{if(!e||0===e.trim().length)return console.warn(`Custom code ${t} is empty, skipping execution`),Promise.resolve();if(e.trim().startsWith("<")&&e.trim().includes(">")){const n=document.createElement("div");n.innerHTML=e;const o=Array.prototype.slice.call(n.querySelectorAll("script"));return o&&o.length>0?(Be(`Found ${o.length} script tag(s) in ${Ve(t)}, executing in DOM order`),o.reduce((e,n,o)=>e.then(()=>new Promise(e=>{const i=n.getAttribute("src"),r=`script ${o+1} from ${Ve(t)}`;if(i){const t=n.getAttribute("id");if(t&&document.getElementById(t))return Be(`${r} already exists, skipping duplicate external script`),void e();const o=document.createElement("script");for(let e=0;e<n.attributes.length;e++){const t=n.attributes[e];o.setAttribute(t.name,t.value)}return n.hasAttribute("async")||(o.async=!1),o.onload=()=>{Be(`External ${r} loaded successfully`),e()},o.onerror=()=>{console.error(`Error loading external ${r}: ${i}`),e()},Be(`Loading external ${r}: ${i}`),void(document.head||document.body||document.documentElement).appendChild(o)}const a=(n.text||n.textContent||"").trim();if(a){Be(`Executing script ${o+1} from ${Ve(t)}`);try{new Function("window","document","console",a)(window,document,console),Be(`Script ${o+1} from ${Ve(t)} executed successfully`)}catch(e){console.error(`Error executing script ${o+1} from ${t}: ${e.message}`)}}e()})),Promise.resolve())):(console.warn(`Custom code ${t} appears to contain HTML instead of JavaScript`),console.warn(`HTML content detected but no script tags found: ${e.substring(0,100)}...`),console.error("Please wrap your code in <script> tags or use pure JavaScript"),Promise.resolve())}return e.includes("$")&&void 0===window.$&&(console.warn(`Custom code ${t} appears to use jQuery ($) but jQuery is not loaded`),console.warn("Consider loading jQuery first or using vanilla JavaScript")),new Function("window","document","console",e)(window,document,console),Promise.resolve()}catch(n){return console.error(`Error executing custom code ${t}: ${n.message}`),console.error(`Code content (first 200 chars): ${e.substring(0,200)}...`),n.message.includes("Unexpected token")&&console.error("Syntax error detected. Please ensure the custom code contains valid JavaScript."),n.message.includes("$ is not defined")&&console.error("jQuery ($) is not available. Please load jQuery first or use vanilla JavaScript."),Promise.resolve()}}function wn(e){if(Te.has(e))return void Be(`Custom Code Integration ${e} already executed, skipping duplicate`);const t="undefined"!=typeof performance&&performance.now?performance.now():Date.now();Be("â¶ï¸",Ve(`integration_${e}`)),Te.add(e);const n=`integration_${e}`;if(we.has(n)){Be(`Using cached ${Ve(`integration_${e}`)}`);try{const t=pn(we.get(n),`integration_${e}`);return t&&"function"==typeof t.then?t:Promise.resolve()}catch(e){console.error(`Error executing cached custom code integration: ${e.message}`)}return Promise.resolve()}const o="undefined"!=typeof performance&&performance.now?performance.now():Date.now();return Be("ð Fetching custom code integration",e),fetch(`${Et}/api/integration-custom-codes/${e}`,{method:"GET",mode:"cors",headers:{"Content-Type":"application/json"}}).then(e=>{if(!e.ok)throw console.error(`Failed to fetch custom code integration: ${e.status} ${e.statusText}`),new Error(`Failed to fetch custom code integration: ${e.status} ${e.statusText}`);return e.json()}).then(i=>{if(i&&i.codeContent){try{i&&i.name&&ve.set(e,{name:i.name})}catch(e){}const r="undefined"!=typeof performance&&performance.now?performance.now():Date.now();return Be("â
Fetched",Ve(`integration_${e}`),`in ${Math.round(r-o)}ms`),we.set(n,i.codeContent),pn(i.codeContent,`integration_${e}`).then(()=>{try{"undefined"!=typeof window&&void 0===window.obApi&&"string"==typeof i.codeContent&&i.codeContent.includes("obApi")&&Fe("â ï¸ obApi is not available after integration execution (possible Outbrain load race).",Ve(`integration_${e}`))}catch(e){}const n="undefined"!=typeof performance&&performance.now?performance.now():Date.now();Be("â±ï¸ Finished",Ve(`integration_${e}`),`in ${Math.round(n-t)}ms`)})}console.warn(`Custom code integration ${e} returned empty code content`)}
1).catch(e=>{console.error("Error fetching custom code integration:",e)})}function hn(e,t,n,o){try{const r=`ss_status_${e}`,a=sessionStorage.getItem(r);if("disabled"===a)return;if(!a||"disabled"!==a){if(Le.has(e))return void Le.get(e).then(i=>{i&&vn(e,t,n,o)}).catch(t=>{console.warn(`â Error from ongoing check for pixel ${e}:`,t)});const a=async function(e){try{const t=await fetch(`${Et}/api/conversion-api/facebook/check-availability?pixelId=${e}&trackingCode=${encodeURIComponent(i)}`,{method:"GET",mode:"cors",headers:{"Content-Type":"application/json"}});return t.ok?!0===(await t.json()).available:(console.log(`â ï¸ Availability check failed with status ${t.status}`),!1)}catch(t){return console.warn(`â Network error checking availability for pixel ${e}:`,t.message),!1}}(e);return Le.set(e,a),void a.then(i=>{Le.delete(e),i?(sessionStorage.setItem(r,"enabled"),vn(e,t,n,o)):sessionStorage.setItem(r,"disabled")}).catch(t=>{Le.delete(e),console.warn(`â Error checking availability for pixel ${e}:`,t),sessionStorage.setItem(r,"disabled")})}}catch(e){console.warn("â Server-side event preparation error:",e.message)}}async function vn(e,t,n,o){try{const r={};let a=!1;try{a=await lt()}catch(e){a=!1}if(a){const e=Fn();e.email&&(console.log(` â Email from URL params: ${e.email.substring(0,3)}***`),r.email=e.email),e.phone&&(console.log(` â Phone from URL params: ${e.phone.substring(0,3)}***`),r.phone=e.phone),e.firstName&&(console.log(` â First name from URL params: ${e.firstName.substring(0,2)}***`),r.firstName=e.firstName),e.lastName&&(console.log(` â Last name from URL params: ${e.lastName.substring(0,2)}***`),r.lastName=e.lastName)}if(a&&!r.email){const e=vt(document)?.value;e?(console.log(` â Email from forms: ${e.substring(0,3)}***`),r.email=e):console.log(" â No email found in forms")}if(a&&!r.phone){const e=Gn();e?(console.log(` â Phone from forms: ${e.substring(0,3)}***`),r.phone=e):console.log(" â No phone found in forms")}if(r.phone&&"string"==typeof r.phone&&!r.phone.startsWith("+")){const e=Vn(),t=Wn(r.phone,e);t&&(r.phone=t)}if(navigator.userAgent&&(r.clientUserAgent=navigator.userAgent,console.log(" â User Agent collected")),a){if(document.cookie){const e=document.cookie.match(/(?:^|; )_fbp=([^;]*)/);e?(r.fbp=e[1],console.log(` â Facebook Browser ID (fbp): ${r.fbp.substring(0,10)}...`)):console.log(" â No Facebook Browser ID (fbp) found - pixel may not be properly initialized")}const e=new URLSearchParams(window.location.search).get("fbclid"),t=qn(e);e&&t?(r.fbclid=e,r.fbc=t,console.log(` â Facebook Click ID (fbc) from URL: ${r.fbc.substring(0,15)}...`)):t?(r.fbc=t,console.log(` â Facebook Click ID (fbc) from stored attribution: ${r.fbc.substring(0,15)}...`)):console.log(" â No Facebook Click ID (fbc) found - user didn't come from Facebook ad")}const c=function(){try{return Kt()}catch(e){return null}}(),s=function(){try{return Rn()}catch(e){return null}}(),l=Math.floor(Date.now()/1e3),d={pixelId:e,eventName:t,eventId:o,eventTime:l,eventSourceUrl:Xt(window.location.href),trackingCode:window.vtTrackingCode||window.avelorTrackingCode||i,matomoVisitorId:function(){try{return Rn()}catch(e){return null}}(),externalIds:[c,s].filter(Boolean),userData:r,customData:n||{}};console.log(` Event ID: ${o} (for deduplication)`);const u="true"===new URLSearchParams(window.location.search).get("vt_server_debug");if(u)try{console.log("𧪠vt_server_debug: About to POST server event (sanitized):",{pixelId:e,eventName:t,eventId:o,eventTime:l,trackingCode:d.trackingCode,externalIds:d.externalIds,hasUserData:!!d.userData})}catch(e){}fetch(`${Et}/api/conversion-api/facebook/send-event`,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)}).then(e=>e.ok?e.json():(console.warn(`â Server-side event failed: ${e.status}`),e.json().then(e=>{console.warn(" Error details:",e.message)}).catch(()=>{console.warn(" Server-side event failed without details")}))).then(t=>{if(t&&t.success&&(console.log(`â
SERVER-SIDE EVENT SUCCESS for pixel ${e}
1`),u))try{console.log("𧪠vt_server_debug: Server response (sanitized):",{success:t.success,status:"ok",eventId:t.eventId,hasFacebookResponse:!!t.facebookResponse})}catch(e){}}).catch(e=>{if(console.warn("â Server-side event network error:",e.message),u)try{console.log("𧪠vt_server_debug: Network error sending server event:",e.message)}catch(e){}})}catch(e){console.warn("â Server-side event preparation error:",e.message)}}function yn(e,t){try{console.log(`ð Sending server-side PageView for pixel ${e}`),console.log(` ð Event ID: ${t} (for deduplication with client-side PageView)`),hn(e,"PageView",{},t)}catch(e){console.warn("â Server-side PageView preparation error:",e.message)}}window.testEventDeduplication=function(e){if(!e)return void console.error('â Please provide a pixel ID: testEventDeduplication("YOUR_PIXEL_ID")');console.log("𧪠DEDUPLICATION TEST START"),console.log("Testing if same Event ID prevents duplicates...");const t=`dedup_test_${Date.now()}`,n="ViewContent",o={test:!0,content_type:"product"};console.log(`ð± CLIENT-SIDE: Sending test event with ID: ${t}`),window.fbq&&(window.fbq("trackSingle",e,n,o,{eventID:t}),console.log("â
Client-side event sent")),console.log(`ð SERVER-SIDE: Sending SAME event with SAME ID: ${t}`),hn(e,n,o,t),console.log("ð Check Facebook Events Manager in 5-10 minutes"),console.log("â
SUCCESS = Only 1 event appears"),console.log("â FAILURE = 2 events appear (deduplication not working)")},window.diagnoseEventMatchQuality=function(){console.log("ð EVENT MATCH QUALITY DIAGNOSTIC"),console.log("=================================");const e={scores:{available:0,total:10},issues:[],recommendations:[]},t=Fn();if(t.email||t.phone||t.firstName||t.lastName?(console.log("ð Contact data from URL parameters:"),console.log(" firstName:",t.firstName),console.log(" lastName:",t.lastName),console.log(" email:",t.email),console.log(" phone:",t.phone)):console.log("â ï¸ No contact data in URL parameters"),t.email)console.log("â
EMAIL: Available from URL parameters (highest quality)"),e.scores.available+=2;else{const t=function(e){const t=e&&"function"==typeof e.querySelectorAll?e:document;return Array.from(t.querySelectorAll(dt))}(document),n=vt(document);t.length>0?n?(console.log("â
EMAIL: Found and available for hashing from forms"),e.scores.available+=2):(console.log("â ï¸ EMAIL: Field found but no value entered yet"),e.issues.push("Email field exists but no value captured"),e.recommendations.push("Capture email on form submission or user input")):(console.log("â EMAIL: No email fields found on page"),e.issues.push("No email collection detected"),e.recommendations.push("Add email capture forms for +2 match points"))}if(t.phone)console.log("â
PHONE: Available from URL parameters (highest quality)"),e.scores.available+=1.5;else{const t=document.querySelectorAll('input[type="tel"], input[name*="phone"], input[id*="phone"]');if(t.length>0){const n=Array.from(t).find(e=>e.value)?.value;n&&n.length>5?(console.log("â
PHONE: Found and available for hashing from forms"),e.scores.available+=1.5):(console.log("â ï¸ PHONE: Field found but no value entered yet"),e.issues.push("Phone field exists but no value captured"))}else console.log("â PHONE: No phone fields found on page"),e.issues.push("No phone collection detected"),e.recommendations.push("Add phone number capture for +1.5 match points")}const n=document.cookie.match(/(?:^|; )_fbp=([^;]*)/);n?(console.log(`â
FACEBOOK BROWSER ID (fbp): ${n[1].substring(0,15)}...`),e.scores.available+=1.5):(console.log("â FACEBOOK BROWSER ID (fbp): Not found"),e.issues.push("Facebook Browser ID missing"),e.recommendations.push("Ensure Facebook Pixel is properly initialized before events"));const o=qn(new URLSearchParams(window.location.search).get("fbclid"));o?(console.log(`â
FACEBOOK CLICK ID (fbc): ${o.substring(0,20)}...`),e.scores.available+=2):(console.log("â FACEBOOK CLICK ID (fbc): Not found"),e.issues.push("No Facebook Click ID detected"),e.recommendations.push("This comes from Facebook ads - ensure fbclid parameter is preserved")),console.log("â
CLIENT IP: Available (server-side detected)"),e.scores.available+=1,navigator.userAgent&&(console.log("â
USER AGENT: Available"),e.scores.available+=1);const i=document.querySelectorAll('input[name*="first"], input[name*="fname"], input[id*="first"]'),r=document.querySelectorAll('input[name*="last"], input[name*="lname"], input[id*="last"]');i.length>0&&r.length>0&&(console.log("â ï¸ NAMES: Fields detected but not captured (potential +1 point)"),e.recommendations.push("Consider capturing first/last name for additional matching"));const a=Math.round(e.scores.available/e.scores.total*10*10)/10;return console.log("ð MATCH QUALITY SUMMARY:"),console.log(`Current Estimated Score: ${a}/10`),console.log("Facebook Reported Score: 4.4/10 (you mentioned)"),console.log(`Available Data Points: ${e.scores.available}/${e.scores.total}`),e.issues.length>
10&&(console.log("â ISSUES FOUND:"),e.issues.forEach(e=>console.log(` ⢠${e}`))),e.recommendations.length>0&&(console.log("ð¡ RECOMMENDATIONS:"),e.recommendations.forEach(e=>console.log(` ⢠${e}`))),e},function(){try{fetch(`${Et}/api/conversion-api/facebook/warmup`,{method:"GET",mode:"cors",headers:{"Content-Type":"application/json"}}).then(e=>{e.ok}).catch(e=>{})}catch(e){}}();try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>Hn()):Hn()}catch(e){}function _n(){try{if(be)return We();be=!0,ke=null,Ie=new Promise(e=>{Se=e})}catch(e){}fetch(`${Et}/api/pixel/get-for-site?trackingCode=${i}&url=${encodeURIComponent(window.location.href)}`,{method:"GET",mode:"cors",headers:{"Content-Type":"application/json"}}).then(e=>404===e.status?(console.log("No pixels configured yet for always-execute check"),console.log(`If this is unexpected, verify tracking code "${i}" exists in your dashboard`),null):e.ok?e.json():(console.warn("Failed to fetch pixel data for always-execute check"),console.warn(`Server responded with status ${e.status} for tracking code "${i}"`),null)).then(e=>{if(!e||!Array.isArray(e)||0===e.length)return ke=!1,void Ge();const t=e.filter(e=>"customcode"===e.type&&e.active&&e.config&&"always"===e.config.trigger&&e.config.customCodeIntegrationId);if(0===t.length)return ke=!1,void Ge();ke=!0;const n=t.map(e=>{try{return wn(e.config.customCodeIntegrationId)}catch(e){return Promise.resolve()}});Promise.allSettled(n).then(()=>{Ge()})}).catch(e=>{console.warn("Error checking for always-execute Custom Code Integrations:",e),ke=!1,Ge()})}function kn(){Re().then(e=>{if(!e||!e.triggers||0===e.triggers.length)return;const t=[];e.triggers.forEach(e=>{e.conversionEvents&&e.conversionEvents.length>0&&e.conversionEvents.forEach(n=>{n.event&&"custom_code"===n.event.platform&&n.event.parameters&&n.event.parameters.customCodeEventId&&"always"===n.event.parameters.trigger&&t.push({triggerId:e.id,triggerName:e.name,eventId:n.event.parameters.customCodeEventId})})}),0!==t.length&&We().then(()=>{t.forEach(e=>{fn(e.eventId)})})}).catch(e=>{console.warn("Error checking for always-execute Custom Code Events:",e)})}async function bn(){const e=[];return await lt()?(window.avelorDebugMode&&console.log("ð Building pixel list for conversion attribution"),le.facebook.size>0&&le.facebook.forEach(t=>{const n=`facebook_${t}`,o=pe.get(n);o?e.push(o):e.push({id:`fb_${t}`,type:"facebook",pixelId:t,name:`Facebook Pixel ${t}`})}),le.linkedin.size>0&&le.linkedin.forEach(t=>{const n=`linkedin_${t}`,o=pe.get(n);o?e.push(o):e.push({id:`li_${t}`,type:"linkedin",pixelId:t,name:`LinkedIn Pixel ${t}`})}),le.googleads.size>0&&le.googleads.forEach(t=>{const n=`googleads_${t}`,o=pe.get(n);o?e.push(o):e.push({id:`ga_${t}`,type:"googleads",pixelId:t,name:`Google Ads ${t}`})}),le.tiktok.size>0&&le.tiktok.forEach(t=>{const n=`tiktok_${t}`,o=pe.get(n);o?e.push(o):e.push({id:`tt_${t}`,type:"tiktok",pixelId:t,name:`TikTok Pixel ${t}`})}),le.openai.size>0&&le.openai.forEach(t=>{const n=`openai_${t}`,o=pe.get(n);e.push(o||{id:`openai_${t}`,type:"openai",pixelId:t,name:`OpenAI Pixel ${t}`})}),e):(console.log("ð« Marketing pixels not allowed, returning empty pixel list for conversion"),e)}function In(e){try{const t=(document.cookie||"").split(";").map(e=>e.trim());for(let n=0;n<t.length;n++){const o=t[n];if(!o)continue;const i=o.indexOf("=");if((i>=0?o.slice(0,i):o).trim()===e){const e=i>=0?o.slice(i+1):"";try{return decodeURIComponent(e)}catch(t){return e}}}return null}catch(e){return null}}function Sn(e){if(!e||"string"!=typeof e)return null;const t=e.trim();if(!t||-1!==t.indexOf("{")||-1!==t.indexOf("}"))return null;const n=t.toLowerCase();return"undefined"===n||"null"===n?null:t}function Cn(e){const t={};d.forEach(function(n){const o=Sn(e&&e[n]);o&&(t[n]=o)});const n=d.filter(function(e){return!!t[e]});return t.wbraid&&n.length>1?{ids:{},conflictingTypes:n}:{ids:t}}function xn(e){try{if(d.forEach(function(e){sessionStorage.removeItem("vt_click_"+e)}),!e||!e.ids)return;d.forEach(function(t){e.ids[t]&&sessionStorage.setItem("vt_click_"+t,e.ids[t])})}catch(e){}}function $n(){xn(null);try{sessionStorage.removeItem("vt_google_click_conflict")}catch(e){}try{const e=v(s),t=h()&&a||"/";y(e,t),e!==s&&y(s,t)}catch(e){}}function Tn(e){try{const n=Number.isFinite(e)?e:Date.now(),o=Ft(s);if(!o)return null;const i=decodeURIComponent(o),r=JSON.parse(i),a=Cn(r&&1===r.version&&(t=r.type,-1!==d.indexOf(t))?{[r.type]:r.value}:r&&2===r.version?r.ids:null),c=Number(r&&r.capturedAt),u=Number(r&&r.expiresAt);return!r||1!==r.version&&2!==r.version||a.conflictingTypes||0===Object.keys(a.ids).length||!Number.isSafeInteger(c)||!Number.isSafeInteger(u)||u<=n||u<=c||u-c>l?($n(),null):{version:2,ids:a.ids,capturedAt:c,expiresAt:u}}catch(e){return $n(),null}var t}function Nn(e,t){try{const n=Cn(e),o=Number.isSafeInteger(t)?t:Date.now();if(n.conflictingTypes||0===Object.keys(n.ids).length)return null;const i=Tn(Date.now());if(i&&d.every(function(e){return(i.ids[e]||null)===(n.ids[e]||null)}))return xn(i),i;const r={version:2,ids:n.ids,capturedAt:o,expiresAt:o+l}
1,c=Math.max(1,Math.floor((r.expiresAt-Date.now())/1e3)),u=Gt(),m=u?"; domain="+u:"",g="https:"===window.location.protocol?"; Secure":"",f=h()&&a||"/";document.cookie=v(s)+"="+encodeURIComponent(JSON.stringify(r))+"; path="+f+"; max-age="+c+m+"; SameSite=Lax"+g,xn(r);try{sessionStorage.removeItem("vt_google_click_conflict")}catch(e){}return r}catch(e){return null}}function An(e,t){try{const n=In(t);if(!n)return null;const o=/^[^.]+\.(\d{10,13})\.(.+)$/.exec(n);if(!o)return null;const i=Number(o[1]),r=10===o[1].length?1e3*i:i,a=Sn(o[2]);return Number.isSafeInteger(r)&&a?r>Date.now()||r<Date.now()-l?null:{ids:{[e]:a},capturedAt:r}:null}catch(e){return null}}function Mn(){try{const e=new URLSearchParams(window.location.search).get("li_fat_id")||In("li_fat_id")||In("vt_li_fat_id");if(!e)return null;try{sessionStorage.setItem("vt_click_li_fat_id",e)}catch(e){}try{const t="https:"===window.location.protocol?"; Secure":"";document.cookie=`vt_li_fat_id=${encodeURIComponent(e)}; path=/; max-age=2592000; SameSite=Lax${t}`}catch(e){}return e}catch(e){return null}}function En(){try{const e=new URLSearchParams(window.location.search).get("ttclid")||In("vt_ttclid");if(!e)return null;try{sessionStorage.setItem("vt_click_ttclid",e)}catch(e){}try{const t="https:"===window.location.protocol?"; Secure":"";document.cookie=`vt_ttclid=${encodeURIComponent(e)}; path=/; max-age=2592000; SameSite=Lax${t}`}catch(e){}return e}catch(e){return null}}function Dn(){try{sessionStorage.removeItem("vt_click_ttclid")}catch(e){}try{y("vt_ttclid","/")}catch(e){}}function Pn(){try{sessionStorage.removeItem("vt_click_li_fat_id")}catch(e){}try{y("vt_li_fat_id","/")}catch(e){}try{y("li_fat_id","/")}catch(e){}}function Ln(){try{const e=new URLSearchParams(window.location.search),t=d.map(function(t){return{type:t,value:Sn(e.get(t))}}).filter(function(e){return!!e.value}),n={};t.forEach(function(e){n[e.type]=e.value});const o=Cn(n);if(o.conflictingTypes){$n();try{sessionStorage.setItem("vt_google_click_conflict",o.conflictingTypes.join(","))}catch(e){}return null}if(Object.keys(o.ids).length>0)return Nn(o.ids,Date.now());const i=Tn(Date.now());if(i)return xn(i),i;const r=function(){try{const e={};d.forEach(function(t){e[t]=sessionStorage.getItem("vt_click_"+t)});const t=Cn(e);return!t.conflictingTypes&&Object.keys(t.ids).length>0?t.ids:null}catch(e){return null}}();if(r)return Nn(r,Date.now());xn(null);const a=function(){const e=[An("gclid","_gcl_aw"),An("gclid","_gcl_dc"),An("gbraid","_gcl_gb")].filter(Boolean);return e.sort(function(e,t){return t.capturedAt-e.capturedAt}),e[0]||null}();return a?Nn(a.ids,a.capturedAt):null}catch(e){return null}}function Un(e){try{if(!e||"string"!=typeof e)return null;let t=e.trim();try{t=decodeURIComponent(t)}catch(e){}const n=/^fb\.\d+\.\d{13}\.(\S+)$/.exec(t);return n?{value:t,clickId:n[1]}:null}catch(e){return null}}function qn(e){try{const t=Sn(e),n=Un(In("_fbc")),o=function(){try{return Un(sessionStorage.getItem("vt_click_fbc"))}catch(e){return null}}(),i=(t?[n,o].find(function(e){return e&&e.clickId===t}):null)||n||o;let r=i?i.value:null;if(!t||i&&i.clickId===t||(r="fb.1."+Date.now()+"."+t),r)try{sessionStorage.setItem("vt_click_fbc",r)}catch(e){}return r}catch(e){return null}}function On(){try{const e=new URLSearchParams(window.location.search).get("fbclid"),t=In("_fbp"),n=In("_fbc"),o=(e,t)=>{if(t)try{sessionStorage.setItem(e,t)}catch(e){}};o("vt_click_fbp",t),o("vt_click_fbc",qn(e)||n)}catch(e){}}function Rn(){try{if(!H())return null;if(!V(W))return null;const e=window.__vtMatomoSiteId?String(window.__vtMatomoSiteId):null;return e&&e===G?W:null}catch(e){return console.warn("Error extracting Matomo visitor ID:",e),null}}async function zn(e){if(!e)return null;try{const t=e.toString().trim().toLowerCase(),n=(new TextEncoder).encode(t),o=await crypto.subtle.digest("SHA-256",n);return Array.from(new Uint8Array(o)).map(e=>e.toString(16).padStart(2,"0")).join("")}catch(e){return console.warn("SHA-256 hashing failed:",e),null}}window.manuallyInitializePixels=function(){console.log("ð§ MANUAL PIXEL INITIALIZATION"),console.log("==============================");const e="true"===Wt("vt_cookies_marketing")||"true"===Wt("avelor_cookies_marketing");if(console.log(`Marketing cookies accepted: ${e}`),!e)return console.warn("â ï¸ Marketing cookies not accepted - pixels will not initialize"),void console.log('ð¡ To test: Set marketing cookie with: document.cookie = "vt_cookies_marketing=true; path=/"');console.log("ð Initializing pixels manually..."),window.avelorInitializePixels()}
1,window.avelorUpdateCookieConsent=function(e){const t=Qt();Zt(window.location.href);let n=!1;try{const t="true"===Wt("vt_cookies_marketing"),o="accepted"===e||"nur_visuell"===e||"deaktiviert"===e,i=function(){try{return"visual"===window.vtBannerMode||"partial"===window.vtBannerMode||!1===it}catch(e){return!1}}();if(n=!!(t||o||i),n){Ln(),On(),En(),Mn(),ae();try{window.oaiq&&window.oaiq("consent",!0)}catch(e){}}else{$n(),Dn(),Pn(),ce();try{window.oaiq&&window.oaiq("consent",!1)}catch(e){}}}catch(e){}const o={sessionId:t,newCookieConsent:e,trackingCode:i,attributionAttempt:0,conversionIds:Pe(),gclid:n?function(){try{return sessionStorage.getItem("vt_click_gclid")}catch(e){return null}}():null,gbraid:n?function(){try{return sessionStorage.getItem("vt_click_gbraid")}catch(e){return null}}():null,wbraid:n?function(){try{return sessionStorage.getItem("vt_click_wbraid")}catch(e){return null}}():null,fbp:n?function(){try{return sessionStorage.getItem("vt_click_fbp")}catch(e){return null}}():null,fbc:n?function(){try{return sessionStorage.getItem("vt_click_fbc")}catch(e){return null}}():null,ttclid:n?function(){try{return sessionStorage.getItem("vt_click_ttclid")}catch(e){return null}}():null,liFatId:n?function(){try{return gn()}catch(e){return null}}():null,openAiOppref:n?function(){try{return sessionStorage.getItem("vt_click_oppref")}catch(e){return null}}():null,openAiObref:n?function(){try{return re("__obref")||sessionStorage.getItem("vt_click_obref")}catch(e){return null}}():null},r=function(e,t){fetch(`${Et}/api/conversions/update-cookie-status`,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.ok?e.json():(console.warn(`Failed to update cookie consent status (${e.status})`),null)).then(o=>{const i=o&&Array.isArray(o.missingConversionIds)?o.missingConversionIds:[];if(n&&0===e.conversionIds.length&&t<2)setTimeout(function(){r({...e,conversionIds:Pe(),attributionAttempt:t+1},t+1)},0===t?1200:2500);else if(i.length>0&&t<2)setTimeout(function(){r({...e,conversionIds:i,attributionAttempt:t+1},t+1)},0===t?1200:2500);else try{window.avelorUpdateCurrentConversionWithPixels&&window.avelorUpdateCurrentConversionWithPixels()}catch(e){}}).catch(e=>{console.warn("Error updating cookie consent status:",e)})};r(o,0)},window.debugUtmAttribution=async function(){console.log("ð MATOMO UTM ATTRIBUTION DEBUG"),console.log("================================================");const e=Rn();if(console.log("ð Matomo Visitor ID:",e),e){console.log("ð Fetching UTM parameters from Matomo...");const t=await async function(e,t){if(!e||!t)return console.warn("Missing visitor ID or tracking code for Matomo UTM fetch"),null;try{console.log(`ð Fetching Matomo UTM parameters for visitor ${e}`);const n=await fetch(`${Et}/api/collect/get-utm-parameters?visitorId=${encodeURIComponent(e)}&trackingCode=${encodeURIComponent(t)}`,{method:"GET",mode:"cors",headers:{"Content-Type":"application/json"}});if(!n.ok)return console.warn(`Failed to fetch Matomo UTM parameters: ${n.status}`),null;const o=await n.json();return console.log("ð Matomo UTM data received:",o),o}catch(e){return console.warn("Error fetching Matomo UTM parameters:",e),null}}(e,i);if(t&&t.utmParameters){console.log("â
Matomo UTM parameters found:");const e=t.utmParameters;return console.log("ð UTM Attribution from Matomo:"),e.utm_source&&console.log(` utm_source: "${e.utm_source}"`),e.utm_campaign&&console.log(` utm_campaign: "${e.utm_campaign}"`),e.utm_medium&&console.log(` utm_medium: "${e.utm_medium}"`),e.utm_content&&console.log(` utm_content: "${e.utm_content}"`),e.utm_term&&console.log(` utm_term: "${e.utm_term}"`),(e.referrer_name||e.referrer_url)&&(console.log("ð Referrer Information:"),e.referrer_name&&console.log(` name: "${e.referrer_name}"`),e.referrer_url&&console.log(` url: "${e.referrer_url}"`)),t.visitCount&&(console.log("ð¤ Visitor Statistics:"),console.log(` Total visits: ${t.visitCount}`),console.log(` First visit: ${t.firstVisit}`),console.log(` Last visit: ${t.lastVisit}`)),e.utm_source||e.utm_campaign||e.utm_medium||e.utm_content||e.utm_term?(console.log("ð¯ Status: UTM attribution data available from Matomo"),console.log("â¹ï¸ This data will be automatically used for new conversions")):(console.log("â ï¸ Status: No UTM parameters found in Matomo data"),console.log("â¹ï¸ Visitor may have arrived via direct traffic or non-UTM source")),t}return console.log("â No Matomo UTM data available"),console.log("â¹ï¸ Possible reasons:"),console.log(" ⢠Visitor has no recorded visits with UTM parameters"),console.log(" ⢠Matomo API configuration issue"),console.log(" ⢠Website not configured with Matomo site ID"),null}return console.log("â No Matomo Visitor ID found"),console.log("â¹ï¸ Possible reasons:"),console.log(" ⢠Matomo tracking not properly initialized"),console.log(" ⢠_pk_id cookie not set (user may have blocked cookies)"),console.log(" ⢠Page loaded before Matomo had time to set visitor ID"),null};const jn=["firstName","lastName","email","phone","postalCode","country"];function Bn(...e){const t={};return jn.forEach(n=>{for(const o of e){const e=o&&o[n];if("string"==typeof e&&e.trim()){t[n]=e.trim();break}}}),t}function Fn(){const e=new URLSearchParams(window.location.search);function t(e){try{if(null==e)return null;let t=String(e).trim();if(!t)return null;
1if(t=t.replace(/,/g,"."),t=t.replace(/[^\d.]/g,""),!t)return null;if(/^\d+$/.test(t)){const e=parseInt(t,10);return isNaN(e)?null:t.length>=4?e/100:e}const n=parseFloat(t);return isNaN(n)?null:n}catch(e){return null}}const n={firstName:null,lastName:null,email:null,phone:null,postalCode:null,country:null,eventValue:null,orderId:null,vatAmount:null,currency:null,gclid:null};if(n.firstName=e.get("invitee_first_name")||null,n.lastName=e.get("invitee_last_name")||null,n.email=e.get("invitee_email")||null,!n.firstName&&!n.lastName){const t=e.get("invitee_full_name")||e.get("full_name");if(t&&t.trim()){const e=t.trim().replace(/\s+/g," ").split(" ");n.firstName=e[0]||null,n.lastName=e.length>1?e.slice(1).join(" "):null}}if(!n.firstName&&!n.lastName){const t=e.get("name");if(t&&t.trim()){const e=t.trim().replace(/\s+/g," ").split(" ");n.firstName=e[0]||null,n.lastName=e.length>1?e.slice(1).join(" "):null}}function o(e){try{let t=String(e||"").trim().toLowerCase();return"function"==typeof t.normalize&&(t=t.normalize("NFD").replace(/[\u0300-\u036f]/g,"")),t=t.replace(/[^a-z0-9]/g,""),t}catch(e){return""}}function i(t){try{for(const n of e.entries()){const e=n&&n[0],i=n&&n[1];if(o(e)===t)return i}}catch(e){return null}return null}if(!n.firstName&&!n.lastName){const e=i("name");if(e&&String(e).trim()){const t=String(e).trim().replace(/\s+/g," ").split(" ");n.firstName=t[0]||null,n.lastName=t.length>1?t.slice(1).join(" "):null}}if(n.firstName||(n.firstName=e.get("vorname")||i("vorname")||null),n.lastName||(n.lastName=e.get("nachname")||i("nachname")||null),n.firstName||(n.firstName=e.get("vt_vn")||i("vtvn")||null),n.lastName||(n.lastName=e.get("vt_ln")||i("vtln")||null),n.phone||(n.phone=e.get("vt_p")||i("vtp")||null),n.email||(n.email=e.get("vt_e")||i("vte")||null),n.firstName||(n.firstName=e.get("firstname")||i("firstname")||null),n.lastName||(n.lastName=e.get("lastname")||i("lastname")||null),n.email||(n.email=e.get("email")||i("email")||null),n.phone||(n.phone=e.get("phone")||i("phone")||null),n.postalCode||(n.postalCode=e.get("postal_code")||e.get("postalCode")||e.get("postcode")||e.get("zip")||e.get("zipcode")||e.get("plz")||i("postalcode")||i("postcode")||i("zipcode")||i("plz")||null),n.country||(n.country=e.get("country")||e.get("country_code")||e.get("countryCode")||i("country")||i("countrycode")||null),!n.firstName&&!n.lastName){const e=i("vorundnachname")||i("vornameundnachname")||null;if(e&&String(e).trim()){const t=String(e).trim().replace(/\s+/g," ").split(" ");n.firstName=t[0]||null,n.lastName=t.length>1?t.slice(1).join(" "):null}}if(n.email||(n.email=i("email")||null),n.phone||(n.phone=i("telefonnummer")||i("telefon")||i("phonenumber")||i("telephone")||null),n.firstName||(n.firstName=e.get("buyer_first_name")||null),n.lastName||(n.lastName=e.get("buyer_last_name")||null),n.email||(n.email=e.get("buyer_email")||null),!n.phone){const t=e.get("buyer_phone")||e.get("buyer_phone_number")||e.get("buyer_address_phone_no")||e.get("telephone");t&&(n.phone=/^\s+\d/.test(t)?`+${t.trim()}`:t)}if(n.currency||(n.currency=e.get("currency")||null),n.firstName||(n.firstName=e.get("first_name")||null),n.lastName||(n.lastName=e.get("last_name")||null),n.email||(n.email=e.get("customer_email")||null),n.firstName||(n.firstName=e.get("payer_first_name")||null),n.lastName||(n.lastName=e.get("payer_last_name")||null),n.email||(n.email=e.get("payer_email")||null),!n.phone){const t=e.get("payer_phone")||null,o=(e.get("payer_country_code")||"").trim().toUpperCase();n.phone=t&&"DE"===o&&/^49\d+$/.test(t.trim())?`+${t.trim()}`:t}if(n.firstName||(n.firstName=e.get("wj_lead_first_name")||null),n.lastName||(n.lastName=e.get("wj_lead_last_name")||null),n.email||(n.email=e.get("wj_lead_email")||null),!n.phone){const t=e.get("wj_lead_phone_number"),o=e.get("wj_lead_phone_country_code");t&&(n.phone=o?`${o}${t}`:t)}const r=e.get("phone_country_code")||e.get("phone_code")||e.get("country_code")||e.get("dial_code")||e.get("prefix");if(r&&n.phone&&!n.phone.startsWith("+")){let e=decodeURIComponent(r).trim();e&&!e.startsWith("+")&&(e=`+${e.replace(/[^\d]/g,"")}`);const t=decodeURIComponent(n.phone).trim().replace(/\s|\-|\(|\)/g,"").replace(/^0+/,"");n.phone=`${e}${t}`}
1else{const t=(e.get("country")||e.get("countryCode")||e.get("country_code")||"").toLowerCase();if(t&&n.phone&&!n.phone.startsWith("+")){const e={de:"+49",at:"+43",ch:"+41",pl:"+48",nl:"+31",be:"+32",fr:"+33",es:"+34",it:"+39",dk:"+45",se:"+46",no:"+47",fi:"+358",pt:"+351",cz:"+420",sk:"+421",hu:"+36",ro:"+40",bg:"+359",gr:"+30",ie:"+353",lu:"+352",li:"+423",lt:"+370",lv:"+371",ee:"+372",hr:"+385",si:"+386",rs:"+381",ba:"+387",me:"+382",mk:"+389",al:"+355",md:"+373",ua:"+380",by:"+375",tr:"+90",il:"+972",in:"+91",cn:"+86",jp:"+81",kr:"+82",us:"+1",ca:"+1",gb:"+44",uk:"+44",au:"+61",nz:"+64"}[t];if(e){const t=decodeURIComponent(n.phone).trim().replace(/\s|\-|\(|\)/g,"").replace(/^0+/,"");n.phone=`${e}${t}`}}}const a=e.get("price");if(a){const e=t(a);null==e||isNaN(e)||(n.eventValue=e)}const c=e.get("amount");if(c&&null==n.eventValue){const e=t(c);null==e||isNaN(e)||(n.eventValue=e)}n.orderId=e.get("order_id")||e.get("invoice")||e.get("id")||null;const s=e.get("vat_amount");s&&(n.vatAmount=parseFloat(s));const l=e.has("invitee_email")&&(e.has("event_type_uuid")||e.has("invitee_uuid"));if(!n.phone&&l){const t=new Set;for(const[n,o]of e.entries()){if(!/^answer_[1-9]\d*$/.test(n))continue;const e=o.trim();if(!/^(?:\+[1-9]|0)[\d\s\-()/]+$/.test(e))continue;let i=e.replace(/[\s\-()/]/g,"");i.startsWith("00")&&(i=`+${i.slice(2)}`);const r=i.replace(/^\+/,"");r.length<10||r.length>15||/^0+$/.test(r)||i.startsWith("+")&&!/^\+[1-9]\d+$/.test(i)||t.add(i)}1===t.size&&(n.phone=t.values().next().value)}if(n.email&&(n.email=decodeURIComponent(n.email)),n.phone&&(n.phone=decodeURIComponent(n.phone)),n.currency){const e=decodeURIComponent(n.currency).trim();n.currency=e?e.toUpperCase():null}if(n.phone&&!n.phone.startsWith("+")){const e=Vn(),t=Wn(n.phone,e);t&&(n.phone=t)}n.gclid=e.get("gclid")||null;const d={firstName:n.firstName,lastName:n.lastName,email:n.email,phone:n.phone,postalCode:n.postalCode,country:n.country};try{const e=Vt(),t=function(){try{return"visual"===window.vtBannerMode||"partial"===window.vtBannerMode}catch(e){return!1}}();if(e||t){const e=$t(document);Object.assign(n,Bn(n,e));const t=I("wf_lead");if(t){const e=JSON.parse(t);Object.assign(n,Bn(n,e))}try{const e=!!(d.firstName||d.lastName||d.email||d.phone||d.postalCode||d.country);if(e)Ct(d);else if(e){const e=I("wf_lead"),t={...e?JSON.parse(e):{}};["firstName","lastName","email","phone","postalCode","country"].forEach(e=>{d[e]&&(t[e]=d[e])}),S("wf_lead",JSON.stringify(t))}}catch(e){}}}catch(e){console.warn("Failed to merge Webflow lead from localStorage",e)}if(n.phone&&!n.phone.startsWith("+")){const e=Vn(),t=Wn(n.phone,e);t&&(n.phone=t)}return n}function Vn(){try{const e=document.querySelector(".iti__selected-dial-code");if(e&&e.textContent&&/^\+\d{1,4}$/.test(e.textContent.trim()))return e.textContent.trim();const t=document.querySelectorAll(".iti__selected-country, .iti__selected-flag, .iti__country-container");for(const e of Array.from(t)){const t=[e.getAttribute("title"),e.getAttribute("aria-label"),e.textContent].filter(
1Boolean).join(" ").match(/\+(\d{1,4})/);if(t)return`+${t[1]}`}const n=document.querySelector('.iti__country[aria-selected="true"]');if(n&&n.getAttribute("data-dial-code")){const e=n.getAttribute("data-dial-code");if(e)return`+${e}`}const o=document.querySelectorAll('[aria-label*="country code" i], [id^="country-select-button-" i]');for(const e of Array.from(o)){const t=[e.getAttribute("aria-label"),e.getAttribute("title"),e.textContent].filter(Boolean).join(" ").match(/\+(\d{1,4})/);if(t)return`+${t[1]}`}const i=document.querySelectorAll('input[name*="country_code"], input[name*="dial_code"], input[name*="phone_code"], input[name*="phone_country_code"], input[id*="dial"]');for(const e of Array.from(i)){const t=e.value&&e.value.toString().trim();if(t&&/^\+?\d{1,4}$/.test(t))return t.startsWith("+")?t:`+${t}`}const r=document.querySelectorAll("select");for(const e of Array.from(r)){const t=e.options&&e.options[e.selectedIndex];if(!t)continue;const n=t.getAttribute("data-dial-code")||t.dataset?.dialCode;if(n&&/^\d{1,4}$/.test(n))return`+${n}`;const o=(t.textContent||"").trim().match(/\+(\d{1,4})/);if(o)return`+${o[1]}`;const i=(t.value||"").trim();if(/^\+?\d{1,4}$/.test(i))return i.startsWith("+")?i:`+${i}`}}catch(e){}try{const e=Vt(),t=function(){try{return"visual"===window.vtBannerMode||"partial"===window.vtBannerMode}catch(e){return!1}}();if(e||t){const e=I("vt_last_dial_code")||I("avelor_last_dial_code");if(e&&/^\+\d{1,4}$/.test(e))return e}}catch(e){}return null}function Wn(e,t){if(!e)return null;let n=e.toString().trim();if(n.startsWith("+"))return n.replace(/\s|\-|\(|\)/g,"");if(n=n.replace(/\s|\-|\(|\)/g,""),!t)return n;let o=t.trim();return o.startsWith("+")||(o=`+${o.replace(/[^\d]/g,"")}`),n=n.replace(/^0+/,""),`${o}${n}`}function Gn(){try{const e=wt(document);if(!e)return null;const t=Vn();return Wn(e.value,t)}catch(e){return null}}function Hn(){try{const e=e=>{try{if(e&&/^\+\d{1,4}$/.test(e)){try{S("vt_last_dial_code",e)}catch(e){}try{C("avelor_last_dial_code")}catch(e){}}}catch(e){}},t=Vn();t&&e(t);const n=()=>{const t=Vn();t&&e(t)};document.addEventListener("change",n,!0),document.addEventListener("input",n,!0),document.addEventListener("click",n,!0)}catch(e){}}window.testContactDataExtraction=function(){console.log("𧪠CONTACT DATA EXTRACTION TEST"),console.log("================================"),console.log("Current URL:",window.location.href),console.log("Current search params:",window.location.search);const e=Fn();return console.log("ð EXTRACTION RESULTS:"),console.log("firstName:",e.firstName),console.log("lastName:",e.lastName),console.log("email:",e.email),console.log("phone:",e.phone),console.log("eventValue (amount):",e.eventValue),console.log("orderId:",e.orderId),console.log("vatAmount:",e.vatAmount),console.log("gclid (Google Click ID):",e.gclid),e.firstName||e.lastName||e.email||e.phone||e.eventValue||e.orderId||e.vatAmount||e.gclid?(console.log("â
SUCCESS: Contact data extracted successfully!"),console.log("ð¡ These values will be included in conversions when triggers fire"),e.eventValue&&console.log("ð° CopeCart amount will override any existing event value in conversions")):(console.log("â NO DATA: No contact data found in URL"),console.log("ð¡ Expected parameters for Calendly:"),console.log(" - invitee_first_name"),console.log(" - invitee_last_name"),console.log(" - invitee_email"),console.log(" - answer_1 (for phone)"),console.log("ð¡ Expected parameters for German forms:"),console.log(" - vorname"),console.log(" - nachname"),console.log(" - email"),console.log(" - phone"),console.log("ð¡ Expected parameters for CopeCart:"),console.log(" - first_name"),console.log(" - last_name"),console.log(" - customer_email"),console.log(" - amount (overrides event value)"),console.log(" - order_id"),console.log(" - vat_amount"),console.log("ð¡ Expected parameters for WebinarJam:"),console.log(" - wj_lead_first_name"),console.log(" - wj_lead_last_name"),console.log(" - wj_lead_email"),console.log(" - wj_lead_phone_number"),console.log(" - wj_lead_phone_country_code (combined with phone number)"),console.log("ð¡ Google Enhanced Conversions:"),console.log(" - gclid (Google Click ID for better attribution)")),e}}();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.