(function(window){ var replaceUrl = false; var url = new URL(window.location.href); var searchParams = new URLSearchParams(url.search); if ('undefined' === typeof window.kuuid) { setUuidParam(); } if ('undefined' === typeof window.kll) { setKllParam(); } if ('undefined' === typeof window.kref) { setKrefParam(); } setKaffParam(); if (replaceUrl) { window.history.replaceState( null, null, url.toString() ); } function getCookie(name) { var cookieRegex = '(?:(?:^|.*; *)' + name + ' *= *([^;]*).*$)|^.*$'; var cookie = document.cookie.match(cookieRegex)[1]; if (cookie) { return decodeURIComponent(cookie); } } function setCookie(name, value, options) { if (options && options.days) { options['max-age'] = options.days * 60 * 60 * 24; delete options.days; } var optionString = ''; Object.keys(options).map(function(key) { optionString += '; ' + key + '=' + options[key]; }); document.cookie = name + '=' + encodeURIComponent(value) + optionString + "; path=/; domain=" + getMainDomain(); } function getMainDomain() { var parts = document.domain.split('.').reverse(); var mainDomain = parts[1] + '.' + parts[0]; return mainDomain; } function generateUUID() { var d = new Date().getTime(); var d2 = ( 'undefined' !== typeof performance && performance.now && (performance.now() * 1000) ) || 0; return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { var r = Math.random() * 16; if (d > 0) { r = (d + r) % 16 | 0; d = Math.floor(d / 16); } else { r = (d2 + r) % 16 | 0; d2 = Math.floor(d2 / 16); } return ( c === 'x' ? r : (r & 0x3 | 0x8) ).toString(16); }); } function isInIframe() { try { return window.self !== window.top; } catch (e) { return true; } } function setUuidParam() { var inIframe = isInIframe(); var uuid; if (inIframe) { if (searchParams.has('kuid')) { uuid = searchParams.get('kuid'); } else { uuid = getCookie('kuuid'); if (!uuid) { uuid = generateUUID(); } } } else { uuid = getCookie('kuuid'); if (!uuid) { if (searchParams.has('kuid')) { uuid = searchParams.get('kuid'); } else { uuid = generateUUID(); } } } window.kuuid = uuid; if (searchParams.has('kuid')) { url.searchParams.delete('kuid'); replaceUrl = true; } } function setKllParam() { var kll = getCookie('kll'); if (!kll) { if (searchParams.has('kll')) { kll = searchParams.get('kll'); } } window.kll = kll; if (searchParams.has('kll')) { url.searchParams.delete('kll'); replaceUrl = true; } } function setKrefParam() { var referrer; var inIframe = isInIframe(); if (inIframe) { if (searchParams.has('referrer')) { referrer = searchParams.get('referrer'); } } else { referrer = (document.referrer && document.referrer.split('?')[0]) || ''; } if (searchParams.has('kref')) { referrer = searchParams.get('kref'); replaceUrl = true; url.searchParams.delete('kref'); } window.kref = referrer; } function setKaffParam() { if ( searchParams.has('kaff') && searchParams.has('kmid') ) { var affiliateHash = searchParams.get('kaff'); var memberHash = searchParams.get('kmid'); var cookieName = 'kaff_' + memberHash; url.searchParams.delete('kaff'); url.searchParams.delete('kmid'); setCookie( cookieName, affiliateHash, { path: '/', days: 30, secure: true, samesite: 'none', } ); replaceUrl = true; } } }(window)); var container_is_arraya87ff679a2f3e71d9181a67b7542122c = 1; if (document.getElementsByClassName('kartra_optin_containera87ff679a2f3e71d9181a67b7542122c').length != 0) { var kartra_containersa87ff679a2f3e71d9181a67b7542122c = document.getElementsByClassName('kartra_optin_containera87ff679a2f3e71d9181a67b7542122c'); } else if (document.getElementsByClassName('kartra_optin_containerYO4z6n0rGWdT').length != 0) { var kartra_containersa87ff679a2f3e71d9181a67b7542122c = document.getElementsByClassName('kartra_optin_containerYO4z6n0rGWdT'); } else { var currentScript = document.currentScript || (function() { var scripts = document.getElementsByTagName('script'); return scripts[scripts.length - 1]; })(); var kartra_containersa87ff679a2f3e71d9181a67b7542122c = currentScript.parentNode; container_is_arraya87ff679a2f3e71d9181a67b7542122c = 0 } function kartra_do_the_optin_forma87ff679a2f3e71d9181a67b7542122c() { if (container_is_arraya87ff679a2f3e71d9181a67b7542122c == 1) { for (i_optin_kartra = 0; i_optin_kartra < kartra_containersa87ff679a2f3e71d9181a67b7542122c.length; i_optin_kartra++) { kartra_containersa87ff679a2f3e71d9181a67b7542122c[i_optin_kartra].innerHTML = '\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \