1/*! 2 * Affonso Tracking Pixel (c) 2024 3 * All rights reserved 4 * Unauthorized use or modification of this file is strictly prohibited 5 */ 6function getReferralCookie(){const t="affonso_referral=",e=decodeURIComponent(document.cookie).split(";");for(let n=0;n<e.length;n++){let o=e[n].trim();if(0===o.indexOf(t)){const t=o.substring(17);return window.affonso_referral=t,t&&void 0!==window.CustomEvent&&setTimeout(()=>{try{window.dispatchEvent(new CustomEvent("affonso_referral_ready",{detail:{referralId:t}}))}catch(t){}},100),t}}return window.affonso_referral="",""}function getAffonsoDataCookie(){const t="affonso_data=",e=decodeURIComponent(document.cookie).split(";");for(let n=0;n<e.length;n++){let o=e[n].trim();if(0===o.indexOf(t)){const t=o.substring(13);try{const e=JSON.parse(t);return window.affonso_data=e,e}catch(t){return window.affonso_data={},{}}}}return window.affonso_data={},{}}function resolveTrackingScript(){const t=document.currentScript;if(t&&"SCRIPT"===t.tagName&&t.hasAttribute("data-affonso"))return t;const e=document.querySelectorAll("script[data-affonso]");return e.length?e[e.length-1]:null}!function(){try{for(var t=document.querySelectorAll('script[src*="affonso"]'),e=0;e<t.length;e++){var n=t[e].src||"",o=!1;if(n.includes("pixel.js")&&!n.includes("pixel.min.js")&&(o=!0),n.includes("affonso.io")&&!n.includes("cdn.affonso.io")&&(o=!0),o){console.warn("[Affonso] Your tracking script URL is outdated and will stop working soon.\nPlease update to: https://cdn.affonso.io/js/pixel.min.js\nNeed help? https://affonso.io/help/getting-started/overview");break}}}catch(t){}}(),getReferralCookie(),getAffonsoDataCookie();const trackingScript=resolveTrackingScript();function getTrackingScriptAttribute(t){return trackingScript?trackingScript.getAttribute(t):null}function getApiBase(){const t=getTrackingScriptAttribute("data-api-base");return t?t.replace(/\/$/,""):"https://api.affonso.io/v1"}function getCookieDuration(){const t=parseInt(getTrackingScriptAttribute("data-cookie_duration"),10);return Number.isFinite(t)?t:30}function isConsentRequired(){return"true"===getTrackingScriptAttribute("data-requires-consent")}function getAffonsoIdFromUrl(){return new URLSearchParams(window.location.search).get("affonso_id")}function decorateLandingUrl(t){const e=t&&t.clickId,n=t&&t.resolvedQueryParams,o=!t||!1!==t.appendAffonsoIdEnabled,r=new URL(window.location.href);let i=!1;if(o&&e&&!r.searchParams.has("affonso_id")&&(r.searchParams.set("affonso_id",e),i=!0),n&&"object"==typeof n&&!Array.isArray(n))for(const[t,e]of Object.entries(n))t&&e&&!r.searchParams.has(t)&&(r.searchParams.append(t,e),i=!0);if(i)try{window.history.replaceState(null,"",r.toString())}catch(t){}}function hasUserConsent(){return!window.affonsoConsentMode||window.affonsoConsentStatus}function loadPslScript(t){const e=document.createElement("script");try{e.src=trackingScript?.src?new URL("psl.min.js",trackingScript.src).toString():"https://cdn.affonso.io/js/psl.min.js"}catch(t){e.src="https://cdn.affonso.io/js/psl.min.js"}e.onload=t,document.head.appendChild(e)}function removeSubdomain(t){if("undefined"==typeof psl)return t;if(t.includes(".local")){const e=t.split(".");return e.length>2?e.slice(-2).join("."):t}const e=psl.parse(t);return t.endsWith("localhost")?t.split(":")[0]:e.error?t:e.domain}window.affonsoConsentMode=isConsentRequired(),window.affonsoConsentStatus=!1,loadPslScript(function(){const t=removeSubdomain(window.location.hostname.replace("www.","")),e=getApiBase(),n=window.location.search,o=new URLSearchParams(n),r=(o.get("affonso")||o.get("atp"),o.get("affonso")||o.get("atp")||o.get("aff")||o.get("via")||o.get("ref")||null),i=o.get("sub1")||null,a=o.get("sub2")||null,s=o.get("sub3")||null,c=o.get("sub4")||null,d=o.get("sub5")||null,f=o.get("utm_source")||null,l=o.get("utm_medium")||null,u=o.get("utm_campaign")||null,g=o.get("utm_term")||null,p=o.get("utm_content")||null,m=o.get("gclid")||null,w=o.get("gbraid")||null,h=o.get("wbraid")||null,C=o.get("gad_source")||null,k=o.get("utm_agid")||null,b=o.get("gad_campaignid")||null,_=o.get("utm_adid")||null,S=o.get("fbclid")||null,y=o.get("fbadid")||null,A=o.get("fbgid")||null,v=o.get("igshid")||null,U=o.get("msclkid")||null,I=o.get("ttclid")||null,T=o.get("li_fat_id")||null,R=o.get("twclid")||null,P=o.get("epik")||null,
6j=o.get("ScCid")||null,x=o.get("rdt_cid")||null,$=getTrackingScriptAttribute("data-affonso"),D=getCookieDuration();function E(e,n){document.cookie=`affonso_referral=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; domain=${t}; samesite=none; secure`;const o=new Date;o.setTime(o.getTime()+24*n*60*60*1e3);const r="expires="+o.toUTCString(),i=encodeURIComponent(e);document.cookie=`affonso_referral=${i};${r};path=/;domain=${t};samesite=lax`}function O(e,n){document.cookie=`affonso_data=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; domain=${t}; samesite=none; secure`;const o=new Date;o.setTime(o.getTime()+24*n*60*60*1e3);const r="expires="+o.toUTCString(),i=encodeURIComponent(JSON.stringify(e));document.cookie=`affonso_data=${i};${r};path=/;domain=${t};samesite=lax`}getReferralCookie();const q=new class{async pagevisitor(){const t=window.affonsoConsentMode?getAffonsoIdFromUrl():null;if(!$||!r&&!t)return;const n=hasUserConsent()&&document.referrer||"",o=hasUserConsent()&&navigator.userAgent||"",q={programId:$,trackingId:r||"",sub1:i,sub2:a,sub3:s,sub4:c,sub5:d,referrer:n,userAgent:o,utmSource:f,utmMedium:l,utmCampaign:u,utmTerm:g,utmContent:p,gclid:m,gbraid:w,wbraid:h,gadSource:C,utmAgid:k,gadCampaignid:b,utmAdid:_,fbclid:S,fbadid:y,fbgid:A,igshid:v,msclkid:U,ttclid:I,li_fat_id:T,twclid:R,epik:P,ScCid:j,rdt_cid:x,upgradeClickId:t||void 0,hasConsent:hasUserConsent()};try{const n=await fetch(`${e}/track`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(q),credentials:"omit"});if(!n.ok)throw new Error(`API Error: ${n.status}`);{const e=await n.json();if(e.cid){const n=hasUserConsent(),o=!1!==e.append_affonso_id_enabled,r=e.resolved_query_params||null;if(n&&E(e.cid,D),window.affonso_referral=e.cid,decorateLandingUrl({clickId:e.cid,appendAffonsoIdEnabled:o,resolvedQueryParams:r}),e.data&&n&&(O(e.data,D),window.affonso_data=e.data),void 0!==window.CustomEvent)try{window.dispatchEvent(new CustomEvent("affonso_referral_ready",{detail:{referralId:e.cid,data:e.data||{},consentMode:window.affonsoConsentMode||!1,upgraded:!!t}}))}catch(t){}return e.cid}}}catch(t){throw t}}};r&&$&&q.pagevisitor(),window.affonsoConsentGranted=async function(){if(window.affonsoConsentGrantedProcessing)return!1;window.affonsoConsentGrantedProcessing=!0,window.affonsoConsentStatus=!0;try{const t=getAffonsoIdFromUrl(),e=getReferralCookie();if(t&&!e)try{await q.pagevisitor();return!0}catch(t){return!1}return!(!t||!e)||(!(t||!e)||!(t||e||!r)&&(await q.pagevisitor(),!0))}catch(t){return!1}finally{window.affonsoConsentGrantedProcessing=!1}},window.Affonso={signup:function(t){const n=getReferralCookie()||getAffonsoIdFromUrl();if(!n)return;let o=null,r=null,i=null;if("string"==typeof t?o=t:"object"==typeof t&&null!==t&&(o=t.email||null,r=t.externalUserId||null,i=t.name||null),!o&&!r)return;if(o&&("string"!=typeof o||!o.includes("@")))return;const a={clickId:n};o&&(a.email=o),r&&(a.externalUserId=r),i&&(a.name=i),fetch(`${e}/signups`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a),credentials:"omit"}).catch(t=>{})},getDiscount:function(){return getAffonsoDataCookie().discount||null},getAffiliateCoupons:function(){return getAffonsoDataCookie().affiliateCoupons||[]},getData:function(){return getAffonsoDataCookie()},getReferralId:function(){return getAffonsoIdFromUrl()||getReferralCookie()},consentGranted:function(){return window.affonsoConsentGranted()},isConsentRequired:function(){return window.affonsoConsentMode}}});
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.