var Profitshare={setup:function(e,t,a,i,s,r,n){this.psName="psid",this.name=e,this.days=t,this.domain=a,this.ajax=i,this.ajaxUrl=s,this.duplicateValues=r,this.duplicateValuesAjax=n},setCookie:function(e){var t=new Date;t.setTime(t.getTime()+864e5*this.days);var a=this.name+"="+escape(e)+"; expires="+t.toGMTString()+"; path=/; domain="+this.domain;document.cookie=a},findGetParameter:function(e){var t=null,a=[];return location.search.substr(1).split("&").forEach(function(i){(a=i.split("="))[0]===e&&(t=decodeURIComponent(a[1]))}),t},callAjax:function(e){var t=new XMLHttpRequest;t.onreadystatechange=function(){if(this.readyState==XMLHttpRequest.DONE&&200==this.status){var e=JSON.parse(this.responseText);e.hasOwnProperty("click_code")&&Profitshare.setCookie(e.click_code)}};let a=this.ajaxUrl,i=this.findGetParameter("psntrf");i&&(a+="?psntrf="+i),t.open("POST",a,!0),t.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),t.send("id="+e+"&referer="+encodeURI(document.referrer))},callAjaxDuplicate:function(e,t){var a=this.getCookie(this.name),i=new XMLHttpRequest;i.open("POST",this.duplicateValuesAjax,!0),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.send("t="+e+"&x="+t+"&c="+a+"&u="+encodeURIComponent(window.location)+"&r="+encodeURI(document.referrer))},updateUrl:function(e,t,a){var i=window.location.origin+window.location.pathname;a.length&&(i+="?"+a.join("&")),window.history.replaceState({},document.title,i)},start:function(){var e=window.location.search.substring(1);if(0==e.length||top.location.href!=window.location.href)return!1;for(var t=e.split("&"),a=null,i=0;i{e.name.toLowerCase()==r.toLowerCase()&&e.value.toLowerCase()==n.toLowerCase()&&this.callAjaxDuplicate(r,n)})}null!==a&&(t.splice(a,1),this.updateUrl(r,n,t))}}; Profitshare.setup( 'click_code', 30, '.scentoparfum.ro', 1, '//t.profitshare.ro/t/ajax/', [{"name":"utm_source","value":"2parale"},{"name":"utm_source","value":"2Performant"},{"name":"utm_campaign","value":"2Performant"},{"name":"utm_campaign","value":"2parale"}], '//t.profitshare.ro/t/ajax/duplicate' ); Profitshare.start(); if (typeof Checkout === 'object') { if (typeof Checkout.$ === 'function') { function getCookie(name) { let value = "; " + document.cookie; let parts = value.split("; " + name + "="); if (parts.length === 2) return parts.pop().split(";").shift(); } if (getCookie(Profitshare.name) !== "") { let callUrl = 'https://shop-extension.profitshare.com/postback/49/' + getCookie(Profitshare.name)+'/'+Shopify.Checkout.token+"/"+Shopify.checkout.order_id+".gif"; let oImg = document.createElement("img"); oImg.setAttribute('src', callUrl); oImg.setAttribute('height', '1px'); oImg.setAttribute('width', '1px'); document.body.appendChild(oImg); } } }