Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const JS_VERSION="2025.03.04.2213",LASSO_JS_URL="https://js.getlasso.co",LASSO_API="https://lasso.link",LASSO_LINK_CLICK="Lasso Link Click",LASSO_DISPLAY_BOX="Lasso Display Primary Click",LASSO_DISPLAY_BOX_2ND="Lasso Display Secondary Click",LASSO_INTERNAL="Internal Click",LASSO_EXTERNAL="External Click",LASSO_CLICK_SUBID_PREFIX="LCID_",LASSO_REDIRECT_DOMAIN="https://go.lasso.link",LASSO_REDIRECT_AMAZON_URL="https://go.lasso.link/amazon",DISALLOWED_CHANGE_SUBID_AFFILIATES=["tradetracker"],LASSO_JSON_BOTS_URL=LASSO_JS_URL+"/bots.min.json",LASSO_JSON_AFFILIATES_URL=LASSO_JS_URL+"/affiliates.min.json",LASSO_JSON_IMPACT_DOMAINS_URL=LASSO_JS_URL+"/impact-domains.min.json",LASSO_JSON_AMAZON_DOMAINS_URL=LASSO_JS_URL+"/amazon-associates-domains.min.json",LASSO_ERROR_PREFIX="[Lasso] > ",SENTRY_URL="https://browser.sentry-cdn.com/9.1.0/bundle.tracing.min.js",SENTRY_DSN="https://[email protected]/4508838724501504";Object.hasOwn||(Object.hasOwn=function(t,r) {
- return Object.prototype.hasOwnProperty.call(t,r);
- });
- const LassoEvents= {
- bots: null,params:null,lstracking:null,matching:1,priorityAffiliate:0,debug:0,affiliates:null,impactDomains:null,amazonDomains:null,unitTest:!1,setProperty:function(t,r){this[t]=r;
- },captureError:function(t,r="Error",e= {
- }){t="[Lasso] > "+t.toString(),r="[Lasso] > "+r.toString();const i=t instanceof Error?t:new Error(t);if(i.name=r,console.error(i),"undefined"==typeof Sentry)return;if((i.stack||"").includes("lasso-performance.")||this.unitTest) {
- let t={params: e;
- };
- Sentry.captureException(i, {
- extra: {...t,timestamp:(new Date).toISOString();
- }})}
- else this.log("Skipping non-Lasso error:",i);
- },rtrim:function(t,r="/") {
- try{return t.replace(new RegExp(r+"*$"),"");
- }
- catch(t) {
- this.captureError(t,"Error in rtrim");
- }},isBot:function(t,r) {
- let e=!1;try{let i=this.bots;if(!i)return!1;for(let a=0;a{let s=i[a],n=s.url||null,o=s.regex||null;if(t&&n&&this.formatUrl(t).toLowerCase()===this.formatUrl(n).toLowerCase())return e=!0,!0;if(r&&o)try{if(new RegExp(o,"i").test(r))return e=!0,!0;
- }
- catch(t) {
- let e={regexPattern: o,userAgent:r;
- };
- this.captureError(t,"Error in isBot",e);
- }}
- return e;
- }
- catch(t) {
- return this.captureError(t,"Error in isBot"),e;
- }},getUTM:function() {
- let t={
- };
- try {
- let r=window.location.search,e=new URLSearchParams(r).entries();for(const r of e){let e=r[0],i=r[1];0===e.indexOf("utm_")&&(t[e]=i);
- }
- return t;
- }
- catch(t) {
- this.captureError(t,"Error in getUTM");
- }
- return t;
- },isValidHref:function(t) {
- if(!t||"string"!=typeof t)return!1;if((t=t.trim().toLocaleLowerCase()).startsWith("#")||t.startsWith("javascript:")||t.startsWith("mailto:")||t.startsWith("tel:")||t.startsWith("data:")||t.startsWith("/")||t.startsWith(":")||!t.startsWith("http://")&&!t.startsWith("https://"))return!1;try{new URL(t);
- }
- catch(t) {
- return this.captureError(t,"Error in isValidHref"),!1;
- }
- return!0;
- },getUrlParam:function(t,r) {
- try{if(!this.isValidHref(t))return null;return new URL(t).searchParams.get(r);
- }
- catch(t) {
- this.captureError(t,"Error in getUrlParam");
- }
- return null;
- },sendEvent:function(t,r,e) {
- try{const i=/^localhost$|^127(?: \.[0-9]+){0,2;
- }\.[0-9]+$|^(?:0*:)*?:?0*1$/.test(location.hostname)||"file:"===location.protocol;if(!r.trackLocalhost&&i&&!this.unitTest)return console.warn("[Lasso] Ignoring event because website is running locally");const a= {
- n: t,u:r.url,d:r.domain,r:r.referrer,w:r.deviceWidth,h:r.hashMode?1:0,p:e&&e.props?e.props:void 0;
- },s=new XMLHttpRequest;s.open("POST",r.apiHost+"/events/tracking",!0),s.setRequestHeader("Content-Type","text/plain"),s.send(JSON.stringify(a)),s.onreadystatechange=()=> {
- 4===s.readyState&&e&&e.callback&&e.callback();
- }}
- catch(t) {
- this.captureError(t,"Error in sendEvent");
- }},LassoTracking:function(t) {
- try{const r=()=>Object.assign({hashMode: !1,trackLocalhost:!1,url:location.href,domain:location.hostname,referrer:document.referrer||null,deviceWidth:window.innerWidth,apiHost:"https://lasso.link";
- },t);return {
- trackEvent: (t,e,i)=>{this.sendEvent(t,Object.assign(Object.assign({
- },r()),i),e);
- }}}
- catch(t) {
- this.captureError(t,"Error in LassoTracking");
- }
- return null;
- },getPageLoadTime:function() {
- try{let t=window.performance.getEntriesByType("navigation"),r=0;return t.length>=1&&void 0!==t[0].domContentLoadedEventEnd&&(r=parseInt(t[0].domContentLoadedEventEnd)),r;
- }
- catch(t) {
- this.captureError(t,"Error in getPageLoadTime");
- }
- return 0;
- },getHierarchy:function(t,r=[]) {
- try{let e=t.localName,i=t.parentElement;if(!i||"body"==e)return r=r.join(" ");let a=t.getAttribute("class"),s=[],n="";a&&(s=a.split(" "),n="."+s.join("."));let o=e+n;return r.unshift(o),this.getHierarchy(i,r);
- }
- catch(t) {
- this.captureError(t,"Error in getHierarchy");
- }
- return null;
- },initLassoTracking:function(t) {
- try{window.lstracking=window.lstracking||this.lstracking;let t={lsid: this.params.lsid,pid:this.params.pid,ipa:this.params.ipa,d:location.origin,plt:this.getPageLoadTime(),utm:this.getUTM(),pt:document.title,pp:window.location.pathname,rh:this.sha256(document.body.innerHTML);
- };
- if(this.log("Lasso Tracking is ready!"),!this.params.lsid)return;if(this.isBot(document.referrer||null,window.navigator.userAgent||null))return void console.warn("Bot request");this.lstracking.trackEvent("pageview", {
- props: t;
- })}
- catch(t) {
- this.captureError(t,"Error in initLassoTracking");
- }},sendClickEvent:function(t,r,e) {
- try{let i=document.location.href,a=this.getUrlParam(i,"gclid"),s={lsid: this.params.lsid,pid:this.params.pid,ipa:this.params.ipa,gclid:a,d:location.origin,pt:document.title;
- };
- return(t= {
- ...t,...s;
- }).type=r,delete t.event_category,delete t.event_label,t&&!this.isValidHref(t.lasso_href)?t:this.params.lsid?(t.lasso_href=this.addLassoClickIdToSubIDUrlArgument(t),t.js_version=JS_VERSION,t.js_matching=this.matching,e&&lstracking.trackEvent("click", {
- props: t;
- }),t):t;
- }
- catch(t) {
- this.captureError(t,"Error in sendClickEvent");
- }
- return t;
- },sendScrollDepthEvent:function(t,r) {
- try{let e={lsid: this.params.lsid,pid:this.params.pid,ipa:this.params.ipa,d:location.origin,pt:document.title,pp:window.location.pathname;
- };(t= {
- ...t,...e;
- }).type=r,lstracking.trackEvent("scroll", {
- props: t;
- })}
- catch(t) {
- this.captureError(t,"Error in sendScrollDepthEvent");
- }},getEventName:function(t) {
- let r=LASSO_LINK_CLICK;try{let e=t.getAttribute("data-lasso-box-trackable"),i=t.getAttribute("data-lasso-name"),a=t.getAttribute("href"),s=t.classList;return r="true"===e?s.contains("lasso-button-2")?LASSO_DISPLAY_BOX_2ND: LASSO_DISPLAY_BOX:i&&"true"!==e?LASSO_LINK_CLICK:"string"==typeof a&&0===a.indexOf(location.origin)?LASSO_INTERNAL:LASSO_EXTERNAL,r;
- }
- catch(t) {
- this.captureError(t,"Error in getEventName");
- }
- return r;
- },getButtonText:function(t) {
- let r="",e=this.getEventName(t);try{let i=t.closest(".lasso-display");e===LASSO_LINK_CLICK?r=t.innerText: e===LASSO_DISPLAY_BOX?r=i.querySelector(".lasso-button-1").innerText:e===LASSO_DISPLAY_BOX_2ND?r=i.querySelector(".lasso-button-2").innerText:e===LASSO_EXTERNAL&&(r=t.innerText),""===r&&(r=t.innerText);
- }
- catch(t) {
- r="",this.captureError(t,"Error in getButtonText");
- }
- return r;
- },lassoClickTracking:function() {
- try{let t=this;this.log("Lasso click function"),document.addEventListener("click",(function(r){let e=r.target;if("a"!=e.localName&&(e=e.closest("a")),null===e)return;let i=e.getAttribute("data-lasso-id"),a=e.getAttribute("data-lasso-name"),s=e.getAttribute("class"),n=t.getEventName(e),o=t.getButtonText(e);o=o||a,o="string"==typeof o?o.trim(): "";
- let c=r.clientX,l=r.clientY,h=e.closest(".lasso-container"),u=h?h.querySelector(".lasso-badge"): null;
- if(u=u?u.innerText: "","a"==e.localName){let h=e.getAttribute("href"),f={lasso_title:a,lasso_href:h,lasso_text:o,lasso_badge:u,event_category:a,event_label:o;
- };
- f.lasso_lid=i?parseInt(i):0,f.tag=e.localName,f.class=s,f.hierarchy=t.getHierarchy(e),f.cx=c,f.cy=l,f.sh=window.screen.height,f.sw=window.screen.width;let d=t.isLeanRedirect(h),p=!d,g=t.sendClickEvent(f,n,p),m=g.lasso_href;if(t.log("Lasso event sent: "+n+" || "+a),a&&(e.setAttribute("href",m),setTimeout((function(r,e) {
- e=t.appendParamsToUrl(e,{lcid: null;
- }),r.setAttribute("href",e);
- }),500,e,m)),d) {
- let i=e.getAttribute("data-lasso-link"),a=i||h;if(i){g.u=location.href;let r=t.matching?1: 0;
- a=LASSO_REDIRECT_AMAZON_URL+"?url="+encodeURIComponent(h)+"&matching="+r,a=t.appendParamsToUrl(a,g);
- }"_blank"===e.target?window.open(a,"_blank"):window.location.assign(a),r.preventDefault();
- }}}))}
- catch(t) {
- this.captureError(t,"Error in lassoClickTracking");
- }},lassoDetectLinks:function() {
- try{if(this.log("Lasso matching",this.matching),!this.matching)return;const t=this,r=document.links.length;for(let e=0;e{let r=document.links[e],i=r.href;if(""!==i&&!/^#/.test(i)&&(t.isAmazonLink(i)&&t.getAmazonProductId(i)||t.isAmazonShortLink(i))){t.removeOtherRedirectsPlugins(r);let e=LASSO_REDIRECT_AMAZON_URL+"?url="+encodeURIComponent(i);r.setAttribute("data-lasso-link",e);
- }}}
- catch(t) {
- this.captureError(t,"Error in lassoDetectLinks");
- }},enableTrackingGTM:function() {
- try{this.enableTrackingGAv4(!0);
- }
- catch(t) {
- this.captureError(t,"Error in enableTrackingGTM");
- }},enableTrackingGAv4:function(t=!1) {
- try{let r=this;this.log("Lasso GA function gtag"),document.addEventListener("click",(function(e){let i=e.target;if("a"!=i.localName&&(i=i.closest("a")),null===i)return;let a=i.getAttribute("data-lasso-name"),s=r.getEventName(i),n=r.getButtonText(i);n=n||a,n="string"==typeof n?n.trim(): "";
- let o=i.closest(".lasso-container"),c=o?o.querySelector(".lasso-badge"): null;
- if(c=c?c.innerText: "","a"==i.localName){let e={lasso_title:a,lasso_href:i.getAttribute("href"),lasso_text:n,lasso_badge:c,event:s,event_type:s,event_category:a,event_label:n;
- };
- a&&(t?dataLayer.push(e):gtag("event",s,e),r.log("Lasso GA event sent: "+s+" || "+a));
- }}))}
- catch(t) {
- this.captureError(t,"Error in enableTrackingGAv4");
- }},enableTrackingGA:function() {
- try{let t=this;this.log("Lasso GA click"),document.addEventListener("click",(function(r){let e=r.target;if("a"!=e.localName&&(e=e.closest("a")),null===e)return;let i=e.getAttribute("data-lasso-id"),a=e.getAttribute("data-lasso-name"),s=t.getEventName(e);if("a"==e.localName&&i&&a){let r=e.getAttribute("href");void 0!==ga.getByName("LassoTracker")?(t.log("lasso ga with tracker"),ga("LassoTracker.send","event",a,s,r)): (t.log("lasso ga without tracker"),ga("send","event",a,s,r)),t.log("Lasso GA event sent");
- }}))}
- catch(t) {
- this.captureError(t,"Error in enableTrackingGA");
- }},lsSetCookie:function(t,r,e) {
- try{var i="";if(e){var a=new Date;a.setTime(a.getTime()+24*e*60*60*1e3),i="; expires="+a.toUTCString();
- }
- document.cookie=t+"="+(r||"")+i+"; path=/";
- }
- catch(t) {
- this.captureError(t,"Error in lsSetCookie");
- }},lsGetCookie:function(t) {
- for(var r=t+"=",e=document.cookie.split(";"),i=0;i{for(var a=e[i];" "==a.charAt(0);)a=a.substring(1,a.length);if(0==a.indexOf(r))return a.substring(r.length,a.length);
- }
- return null;
- },docReady:function(t) {
- try{this.log(document.readyState),this.log(document.addEventListener),"complete"===document.readyState||"undefined"!=typeof lassoHtmlLoaded&&!0===lassoHtmlLoaded?t(): document.addEventListener?document.addEventListener("DOMContentLoaded",t):document.attachEvent("onreadystatechange",(function(){"complete"===document.readyState&&t();
- }))}
- catch(t) {
- this.captureError(t,"Error in docReady");
- }},generateId:function(t) {
- try{let r="";const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=e.length;let a=0;for(;a;)r+=e.charAt(Math.floor(Math.random()*i)),a+=1;return r;
- }
- catch(t) {
- this.captureError(t,"Error in generateId");
- }},init:function(t= {
- }){try {
- if("true"===document.getElementsByTagName("body")[0].getAttribute("lsevent"))return;document.getElementsByTagName("body")[0].setAttribute("lsevent","true"),this.debug=t.debug||this.debug,this.debug="1"===this.debug||1===this.debug,this.log("Lasso GA is ready!"),t.lsid=t.lsid?t.lsid: "lsp-"+this.generateId(40);
- let r=this.lsGetCookie("lsid");if(!r){let e=1;this.lsSetCookie("lsid",t.lsid,e),r=this.lsGetCookie("lsid");
- }
- t.lsid=r,t.pid=t.pid||0,t.performance=parseInt(t.performance||1),this.params=t,this.lstracking=this.LassoTracking( {
- apiHost: LASSO_API;
- }),Object.hasOwn(t,"lssid")&&void 0!==t.lssid&&null!==t.lssid&&""!==t.lssid?this.matching=1:(this.matching=t.matching||this.matching,this.matching="1"===this.matching||1===this.matching),this.log("Lasso matching",this.matching),this.priorityAffiliate=t.priority_affiliate||this.priorityAffiliate,this.priorityAffiliate="1"===this.priorityAffiliate||1===this.priorityAffiliate,"function"==typeof gtag?this.enableTrackingGAv4():"function"==typeof tag?this.enableTrackingGA():"object"==typeof dataLayer&&this.enableTrackingGTM(),1===t.performance&&(this.initLassoTracking(),this.lassoClickTracking(),this.lassoDetectLinks());
- }
- catch(t) {
- this.captureError(t,"Error in init");
- }},debounce:function(t,r) {
- try{let e;return function(...i){clearTimeout(e),e=setTimeout((function(){t(...i);
- }),r);
- }}
- catch(t) {
- this.captureError(t,"Error in debounce");
- }},addLassoClickIdToSubIDUrlArgument:function(t) {
- try{let r=t.lasso_href,e=t.lasso_title,i=this.isAffiliate(r),a=this.buildLassoSubID();if(i&&!DISALLOWED_CHANGE_SUBID_AFFILIATES.includes(i)){let t=this.getAffiliateSubID(i,r),e=Object.keys(t),s=e[e.length-1];if(1===e.length){let r=e[0];t[r]=t[r].replace(/__LCID_\w{10;
- }/g,""),t[r]=t[r].replace(/LCID_\w {
- 10;
- }/g,""),t[r]=""!==t[r]?t[r]+"__"+a:a;
- }
- else for(let r in t) {
- if(""!==t[r]&&t[r].includes("__LCID_")){let e=t[r].split("__LCID_");t[r]=e[0]+"__"+a;break;
- }
- if(""===t[r]||t[r].includes("LCID_")) {
- t[r]=a;break;
- }
- if(s===r) {
- t[r]=t[r].replace(/__LCID_\w{10;
- }/g,""),t[r]=t[r].replace(/LCID_\w {
- 10;
- }/g,""),t[s]=t[r]+"__"+a;break;
- }}
- r=this.appendParamsToUrl(r,t);
- }
- else if(e) {
- this.getBaseDomain(location.hostname)===this.getBaseDomain(r)&&(r=this.appendParamsToUrl(r,{lcid: a;
- }))}
- return r;
- }
- catch(r) {
- return this.captureError(r,"Error in addLassoClickIdToSubIDUrlArgument"),t.lasso_href;
- }},buildLassoSubID:function(t=10) {
- try{const r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",e=r.length;let i="";for(;i.length{i+=r[Math.floor(Math.random()*e)];
- }
- return"LCID_"+i.substring(0,t);
- }
- catch(t) {
- this.captureError(t,"Error in buildLassoSubID");
- }},isAffiliate:function(t) {
- try{let r=this;if(!this.affiliates)return!1;for(const e in this.affiliates)if(Object.hasOwn(this.affiliates,e)&&r[this.affiliates[e].is_affiliate_function](t))return this.affiliates[e].slug;return!1;
- }
- catch(t) {
- return this.captureError(t,"Error in isAffiliate"),!1;
- }},getAffiliateSubID:function(t,r) {
- try{if(!this.affiliates)return{
- };
- let e=this.affiliates[t].sub_ids,i= {
- };
- for(const t of e)i[t]="";let a=this.getQueryParameters(r);for(let t in a)e.includes(t)&&""!==a[t]&&(i[t]=a[t]);return i;
- }
- catch(t) {
- return this.captureError(t,"Error in getAffiliateSubID"),{
- }}},check_regex:function(t,r) {
- try{t=t.replace(/^\/|\/$/g,"");let e=new RegExp(t,"g");return r.match(e);
- }
- catch(t) {
- return this.captureError(t,"Error in check_regex"),!1;
- }},is_awin:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.awin.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_awin"),!1;
- }},is_cj:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.cj.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_cj"),!1;
- }},is_financeAds:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.financeads.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_financeAds"),!1;
- }},is_impact:function(t) {
- try{if(!this.impactDomains)return!1;let r=this.getBaseDomain(t),e=this.getBaseDomain(t,!1);return Object.hasOwn(this.impactDomains,r)||Object.hasOwn(this.impactDomains,e);
- }
- catch(t) {
- return this.captureError(t,"Error in is_impact"),!1;
- }},is_shareasale:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.shareasale.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_shareasale"),!1;
- }},is_amazon:function(t) {
- try{if(!this.amazonDomains)return!1;let r=this.getBaseDomain(t);return Object.hasOwn(this.amazonDomains,r);
- }
- catch(t) {
- return this.captureError(t,"Error in is_amazon"),!1;
- }},is_partnerize:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.partnerize.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_partnerize"),!1;
- }},is_flexoffers:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.flexoffers.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_flexoffers"),!1;
- }},is_refersion:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.refersion.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_refersion"),!1;
- }},is_post_affiliate_pro:function(t) {
- try{if(!this.isValidHref(t))return!1;let r=new URL(t);const e=/(a_aid=.+)|(tr_aid=.+)/,i=/repfitness\.com/,a=/\.ivacy.com/,s=/(\.postaffiliatepro|affiliates\.xeroshoes)\.com\/scripts\//,n=/a_aid|tr_aid|a_bid/;return!!(r.hash.match(e)||r.origin.match(i)||r.origin.match(a)||r.href.match(s)||r.search.match(n));
- }
- catch(t) {
- return this.captureError(t,"Error in is_post_affiliate_pro"),!1;
- }},is_avantlink:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.avantlink.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_avantlink"),!1;
- }},is_pepperjam:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.pepperjam.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_pepperjam"),!1;
- }},is_everflow:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.everflow.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_everflow"),!1;
- }},is_tune:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.tune.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_tune"),!1;
- }},is_partnerstack:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.partnerstack.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_partnerstack"),!1;
- }},is_goaffpro:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.goaffpro.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_goaffpro"),!1;
- }},is_aragon:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.aragon.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_aragon"),!1;
- }},is_sovrn:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.sovrn.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_sovrn"),!1;
- }},is_rakuten:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.rakuten.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_rakuten"),!1;
- }},is_skimlinks:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.skimlinks.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_skimlinks"),!1;
- }},is_agoda:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.agoda.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_agoda"),!1;
- }},is_bol:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.bol.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_bol"),!1;
- }},is_booking:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.booking.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_booking"),!1;
- }},is_cake:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.cake.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_cake"),!1;
- }},is_clickbank:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.clickbank.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_clickbank"),!1;
- }},is_commission_factory:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.commission_factory.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_commission_factory"),!1;
- }},is_daisycon:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.daisycon.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_daisycon"),!1;
- }},is_ebay:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.ebay.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_ebay"),!1;
- }},is_firstpromoter:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.firstpromoter.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_firstpromoter"),!1;
- }},is_get_your_guide:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.get_your_guide.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_get_your_guide"),!1;
- }},is_idevaffiliate:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.idevaffiliate.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_idevaffiliate"),!1;
- }},is_linkconnector:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.linkconnector.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_linkconnector"),!1;
- }},is_maxbounty:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.maxbounty.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_maxbounty"),!1;
- }},is_rentalcarscom:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.rentalcarscom.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_rentalcarscom"),!1;
- }},is_tradedoubler:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.tradedoubler.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_tradedoubler"),!1;
- }},is_tradetracker:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.tradetracker.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_tradetracker"),!1;
- }},is_webgains:function(t) {
- try{return!!this.affiliates&&this.check_regex(this.affiliates.webgains.matches,t);
- }
- catch(t) {
- return this.captureError(t,"Error in is_webgains"),!1;
- }},sha256:function(t) {
- try{const i=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function r(t,r){return t>>>r|t<<32-r;
- }
- function e(t,e) {
- const a=new Uint32Array(64);for(let r=0;r<16;r++)a[r]=t[4*r]<<24|t[4*r+1]<<16|t[4*r+2]<<8|t[4*r+3];for(let t=16;t<64;t++){const e=r(a[t-15],7)^r(a[t-15],18)^a[t-15]>>>3,i=r(a[t-2],17)^r(a[t-2],19)^a[t-2]>>>10;a[t]=a[t-16]+e+a[t-7]+i>>>0;
- }
- let s=e[0],n=e[1],o=e[2],c=e[3],l=e[4],h=e[5],u=e[6],f=e[7];for(let t=0;t<64;t++) {
- const e=f+(r(l,6)^r(l,11)^r(l,25))+(l&h^~l&u)+i[t]+a[t]>>>0,d=s&n^s&o^n&o;f=u,u=h,h=l,l=c+e>>>0,c=o,o=n,n=s,s=e+((r(s,2)^r(s,13)^r(s,22))+d>>>0)>>>0;
- }
- e[0]=e[0]+s>>>0,e[1]=e[1]+n>>>0,e[2]=e[2]+o>>>0,e[3]=e[3]+c>>>0,e[4]=e[4]+l>>>0,e[5]=e[5]+h>>>0,e[6]=e[6]+u>>>0,e[7]=e[7]+f>>>0;
- }
- const a=(new TextEncoder).encode(t),s=64*Math.ceil((a.length+9)/64),n=new Uint8Array(s);n.set(a),n[a.length]=128,n[s-4]=8*a.length>>>24&255,n[s-3]=8*a.length>>>16&255,n[s-2]=8*a.length>>>8&255,n[s-1]=8*a.length&255;const o=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);for(let t=0;t;t+=64)e(n.subarray(t,t+64),o);return o.reduce((t,r)=>t+r.toString(16).padStart(8,"0"),"");
- }
- catch(t) {
- return this.captureError(t,"Error in sha256"),!1;
- }},isAmazonLink:function(t) {
- try{return!!t&&t.includes("amazon.");
- }
- catch(t) {
- return this.captureError(t,"Error in isAmazonLink"),!1;
- }},isAmazonShortLink:function(t) {
- try{return/^https?: \/\/amzn\.to\/[A-Za-z0-9]+\/?$/.test(t);
- }
- catch(t) {
- return this.captureError(t,"Error in isAmazonShortLink"),!1;
- }},getAmazonProductId:function(t) {
- try{let r=!1;if(t=this.formatUrl(t,!1),!this.isValidHref(t))return!1;const e=new URL(t),i=e.pathname.replace(/[^A-Za-z0-9\/\: ]+/g,""),a=`${e.protocol;
- }//${e.hostname;
- }${i;
- }`,s=`$ {
- e.protocol;
- }//${e.hostname;
- }`,n=/https?:\/\/(?:www\.)?amazon\.[a-z\.]+\/(?:[\w-]+\/)?(?:gp\/aw\/d|d\/[\w-]+\/[\w-]+|dp|dp\/product|gp\/product|ASIN|gp\/video\/detail|exec\/obidos\/ASIN|hz\/audible\/mlp\/mfpdp|gp\/offerlisting)\/([A-Z0-9] {
- 10;
- })/i,o=t.match(n);if(o&&(r=o[1]),!r) {
- const t=new RegExp(s+"(?:/[a-z]+)?/([\\w-]+/)?(gp/aw/d|d/[\\w-]+/[\\w-]+|dp|dp/product|gp/product|ASIN|gp/video/detail|exec/obidos/ASIN|hz/audible/mlp/mfpdp|gp/offerlisting)/(\\w+)?(\\w{10})(/)?"),e=a.match(t);e&&(r=e[4]);
- }
- if(!1!==r&&r.includes("?")) {
- const t=r.split("?");r=t.length>0?t[0]: r;
- }
- return!1!==r&&(r=r.toUpperCase()),r;
- }
- catch(t) {
- return this.captureError(t,"Error in getAmazonProductId"),!1;
- }},formatUrl:function(t,r=!0) {
- try{if(!t||!this.isValidHref(t))return t;const e=new URL(t),i=e.protocol.replace(":",""),a=e.search||"",s=e.port||"",n=e.hash||"";let o=`${i;
- }
- ://$ {
- e.hostname;
- }${s?":"+s:"";
- }${e.pathname;
- }${n;
- }`;
- return r&&a&&(o+=""+a),o;
- }
- catch(r) {
- return this.captureError(r,"Error in formatUrl"),t;
- }},appendParamsToUrl:function(t,r) {
- try{const[e,i]=t.split("?"),a=new URLSearchParams(i||"");return Object.entries(r).forEach(([t,r])=>{null!==r&&""!==r&&void 0!==r&&"undefined"!==r?a.set(t,r): a.delete(t);
- }),`${e;
- }?${a.toString();
- }`}
- catch(r) {
- return this.captureError(r,"Error in appendParamsToUrl"),t;
- }},getBaseDomain:function(t,r=!0) {
- try{t=t.replace(/^(https?: \/\/)?(www\.)?/,"");
- let e=t.split("/")[0];if(!r){const t=e.split(".");t.length>2&&(e=t.slice(1).join("."));
- }
- return e;
- }
- catch(t) {
- return this.captureError(t,"Error in getBaseDomain"),"";
- }},getQueryParameters:function(t) {
- try{const r={
- };
- return new URL(t).searchParams.forEach((t,e)=> {
- r[e]=t;
- }),r;
- }
- catch(t) {
- return this.captureError(t,"Error in getQueryParameters"),{
- }}},log:function(...t) {
- try{this.debug&&console.log(...t);
- }
- catch(t) {
- this.captureError(t,"Error in log");
- }},removeOtherRedirectsPlugins:function(t) {
- try{t.removeAttribute("data-geniuslink"),t.onclick=null;
- }
- catch(t) {
- this.captureError(t,"Error in removeOtherRedirectsPlugins");
- }},isLeanRedirect:function(t) {
- try{if(!this.matching)return!1;let r=Boolean(this.isAmazonLink(t)&&this.getAmazonProductId(t)||this.isAmazonShortLink(t)),e=r,i=null!==this.getUrlParam(t,"aa_campaignid")&&r;return e&&i&&(e=this.priorityAffiliate),e;
- }
- catch(t) {
- return this.captureError(t,"Error in isLeanRedirect"),!1;
- }}},loadJSON=t=>new Promise((r,e)=> {
- try{const i=new XMLHttpRequest;i.onreadystatechange=function(){if(this.readyState===this.DONE)if(200===this.status)try{const t=JSON.parse(this.responseText);r(t);
- }
- catch(t) {
- e(new Error("Failed to parse JSON"));
- }
- else e(new Error("HTTP error! status: "+this.status));
- },i.onerror=()=>e(new Error("Network error")),i.open("GET",t,!0),i.send(null);
- }
- catch(r) {
- console.error("Error in loadJSON: "+t,r),e(r);
- }}),loadSentryScript=()=>new Promise((t,r)=> {
- try{const e=document.createElement("script");e.src=SENTRY_URL,e.crossOrigin="anonymous",e.onload=()=>{"undefined"!=typeof Sentry?(Sentry.init({dsn: SENTRY_DSN,tracesSampleRate:.1,beforeSend(t){if(t.exception){const r=t.exception.values[0];
- let e=0===r.type.indexOf("[Lasso] > "),i=0===r.value.indexOf("[Lasso] > ");if(!(e&&i))return null;
- }
- return t;
- },release:"lasso@"+JS_VERSION,environment:"production";
- }),t()):r(new Error("Sentry failed to initialize"));
- },e.onerror=()=>r(new Error("Failed to load Sentry script")),document.head.appendChild(e);
- }
- catch(t) {
- console.error(t,"Error in loadSentryScript");
- }}),lassoLoadSentry=async()=> {
- document.addEventListener("DOMContentLoaded",async()=>{try{const t=await loadJSON(LASSO_JSON_BOTS_URL);t&&(LassoEvents.bots=t);const r=await loadJSON(LASSO_JSON_AFFILIATES_URL);r&&(LassoEvents.affiliates=r);const e=await loadJSON(LASSO_JSON_IMPACT_DOMAINS_URL);e&&(LassoEvents.impactDomains=e);const i=await loadJSON(LASSO_JSON_AMAZON_DOMAINS_URL);i&&(LassoEvents.amazonDomains=i),await new Promise((t,r)=>{try{const e=document.createElement("script");e.src=SENTRY_URL,e.crossOrigin="anonymous",e.onload=()=>{"undefined"!=typeof Sentry?(Sentry.init({dsn: SENTRY_DSN,tracesSampleRate:.1,beforeSend(t){if(t.exception){const r=t.exception.values[0];
- let e=0===r.type.indexOf("[Lasso] > "),i=0===r.value.indexOf("[Lasso] > ");if(!e||!i)return null;
- }
- return t;
- },release:"lasso@"+JS_VERSION,environment:"production";
- }),t()):r(new Error("Sentry failed to initialize"));
- },e.onerror=()=>r(new Error("Failed to load Sentry script")),document.head.appendChild(e);
- }
- catch(t) {
- console.error(t,"Error in loadSentryScript");
- }});
- const a=new CustomEvent("lassoTrackingEventLoaded", {
- detail: LassoEvents;
- });
- document.dispatchEvent(a);
- }
- catch(t) {
- console.log("Error loading Sentry:",t);
- }})};
- lassoLoadSentry(),"undefined"!=typeof module&&module.exports&&(module.exports= {
- LassoEvents: LassoEvents,LASSO_REDIRECT_AMAZON_URL:LASSO_REDIRECT_AMAZON_URL,JS_VERSION:JS_VERSION;
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement