if(null==CEAffTracker)var CEAffTracker=new function(){var t,e,i,o="CE_Affiliate";this.setCookieDays=function(t){i=t},this.getCookieDays=function(){return i},this.getCookieName=function(){return o},this.setParamNameId=function(t){e=t},this.getParamNameId=function(){return e},this.setAffiliateId=function(e){paramName=this.getParamNameId();var i=document.location.search.split("?");if(i.length>1){parameters=i[1].split("&");for(var o=0;o<parameters.length;o++)parsed=parameters[o].split("="),parsed[0]==this.getParamNameId()&&(t=parsed[1])}},this.getAffiliateId=function(){return t},this.getDomainName=function(){return window.location.hostname.substring(window.location.hostname.lastIndexOf(".",window.location.hostname.lastIndexOf(".")-1)+1)},this.getHttpCookie=function(){var t=document.cookie.match("(^|;) ?"+this.getCookieName()+"=([^;]*)(;|$)");return t&&""!=t[2]?decodeURIComponent(t[2]):null},this.setCookie=function(){var t="SameSite=Lax";"https:"==document.location.protocol&&(t="Secure;SameSite=None");var e=new Date;e.setTime(e.getTime()+24*this.getCookieDays()*60*60*1e3),expires=e.toUTCString(),domain=this.getDomainName(),o=this.getCookieName(),""!=this.getAffiliateId()&&(document.cookie=o+"="+encodeURIComponent(this.getAffiliateId())+";expires="+expires+";domain="+domain+";path=/;"+t)},this.track=function(){null===this.getHttpCookie()&&(this.setAffiliateId(),this.setCookie())}};
