/* D638AC54018DD731/shopify-files/1-pmid.js */ _pm_pid = 'D638AC54018DD731'; _pm_root = 'https://my.profitmetrics.io'; /* D638AC54018DD731/shopify-files/1000-shopify-bundle.js */ !function(){"use strict";var e=["AdsBot-Google","AdsBot-Google-Mobile","Googlebot","Storebot-Google","APIs-Google","Mediapartners-Google","FeedFetcher-Google","Google-Read-Aloud","DuplexWeb-Google","Google Favicon","googleweblight","Pinterestbot","AhrefsSiteAudit","AhrefsBot","Seekport Crawler","DuckDuckBot","PingdomPageSpeed","pingbot","YandexAccessibilityBot","adidxbot","bingbot","SMTBot","HubSpot Crawler","e.ventures Investment Crawler","Cincraw","Facebot","Twitterbot","Jooblebot","YisouSpider","YandexMetrika","Applebot","PagePeeker","Linespider","proximic","Algolia Crawler Renderscript","PetalBot","SEOFeedback_WebCrawler","oBot","Impact Radius Compliance Bot","Cocolyzebot","nlnbot","SemrushBot-SA","Bytespider","RyteBot","BrandVeritySpider","ethical-bugbot","Screaming Frog SEO Spider","BublupBot","bitlybot","Better Uptime Bot","KargoBot-Artemis-Mobile","YandexVideoParser","DotBot","BLEXBot","CheckMarkNetwork","MegaIndex.ru","Baiduspider","SurdotlyBot","Taboolabot","SiteScoreBot","StatusCake_Pagespeed_Indev","www.facebook.com/externalhit_uatext.php","+http://yandex.com/bots","YandexBot","LinkedInBot","+https://intelx.io","+https://www.seokicks.de/robot.html","SEOkicks;","ZoominfoBot","BingPreview","Morningscore","heritrix","http://tech.quickpay.net/api/callback","CookieInformationScanner","MJ12bot","KlarnaBot-PriceWatcher","HeadlessChrome","Barkrowler","Chrome-Lighthouse","https://vendorcentral.amazon.com/support/amazonproductbot"];const t=e=>{const t=`${e}=`,o=document.cookie.split(";");for(let e=0;e{let n="";if(o){const e=new Date;e.setTime(e.getTime()+24*o*60*60*1e3),n=`; expires=${e.toUTCString()}`}document.cookie=`${e}=${t||""}${n}; path=/`},n=e=>{const t=new RegExp(`[?&]${e}=([^&#]*)`).exec(window.location.search);return null===t?null:decodeURIComponent(t[1].replace(/\+/g," "))},r=e=>{const o=t("pmStorage");if(null===o)return null;const n=JSON.parse(decodeURIComponent(o));return n&&n[e]?n[e]:null},i=async(e,t)=>{const o=new Headers;o.append("accept","application/json"),o.append("Content-Type","text/plain");const n={method:"POST",headers:o,body:t};await fetch(`https://api.my.profitmetrics.io/api/public/frontend/clientLog?level=${e}`,n)};var a;!function(e){e.Shopify="shopify"}(a||(a={}));const c=()=>!window.Shopify.customerPrivacy||window.Shopify.customerPrivacy.analyticsProcessingAllowed(),s=()=>!window.Shopify?.customerPrivacy||window.Shopify?.customerPrivacy.marketingAllowed(),l=["gacid","gacid_source","fbp","ga4SessionId","ga4SessionNumber"],d=["gclid","fbc","gbraid","wbraid"],u=["fbclid","gclid","wbraid","gbraid"],p=()=>{let e=t("pmStorage")||null;if(e)try{e=JSON.parse(decodeURIComponent(e))}catch(e){o="pmStorage",document.cookie=o+"=; Max-Age=-99999999;",i("WARN",`pid: ${_pm_pid}. An error ocurred while parsing the pmStorage cookie in the Shopify tracking script version e0a78321afdfe824c54789edef9921fe2712331d. The cookie was deleted and functionality should continue as normal.`).then((e=>e))}var o;return e},g=()=>{const e=f(),t=c(),n=s();t||l.forEach((t=>e[t]=null)),n||d.forEach((t=>e[t]=null));const r=p(),i=((e,t)=>{const o=e,n=["url","referer","ts","cua","cc_statistics","cc_marketing","em_md5","em_sha256"];return Object.keys(e).forEach((r=>{n.includes(r)||(e[r]?o[r]=e[r]:t&&t[r]&&(o[r]=t[r]))})),o})(e,r);return o("pmStorage",encodeURIComponent(JSON.stringify(i))),i},f=()=>({visitSource:_(),gacid:S().id,gacid_source:S().source,gclid:y(),gbraid:w(),wbraid:b(),ga4SessionId:h(),ga4SessionNumber:m(),fbp:k(),fbc:C()}),h=()=>{const e=document.cookie.split(";").filter((e=>-1!==e.indexOf("_ga_"))).map((e=>e.trim().split("."))).filter((e=>null!=e&&void 0!==e&&"number"==typeof e.length&&e.length>=4)).map((e=>e[0].substring(4,e[0].indexOf("="))+":"+e[2])).join(",");return null!=e&&e.length>0?e:null},m=()=>{const e=document.cookie.split(";").filter((e=>-1!==e.indexOf("_ga_"))).map((e=>e.trim().split("."))).filter((e=>null!=e&&void 0!==e&&"number"==typeof e.length&&e.length>=4)).map((e=>e[0].substring(4,e[0].indexOf("="))+":"+e[3])).join(",");return null!=e&&e.length>0?e:null},w=()=>n("gbraid"),b=()=>n("wbraid"),_=()=>{const e=r("visitSource");if(e)return e;const t=new RegExp("[?&]utm_source=([^&#]*)").exec(window.location.search),o=null===t?"":decodeURIComponent(t[1].replace(/\+/g," ")),n=new RegExp("[?&]utm_campaign=([^&#]*)").exec(window.location.search),i=null===n?"":decodeURIComponent(n[1].replace(/\+/g," ")),a=new RegExp("[?&]utm_medium=([^&#]*)").exec(window.location.search),c=null===a?"":decodeURIComponent(a[1].replace(/\+/g," "));let l=document.referrer.substring(0,2e3);const d=document.referrer.length,p=s(),g=new URLSearchParams(window.location.search);p||u.forEach((e=>g.delete(e)));let f=`${window.location.pathname}`;g.toString()&&(f+=`?${g.toString()}`),f=f.substring(0,2e3);const h=f.length;let m={utm_source:o.substring(0,100),utm_campaign:i.substring(0,100),utm_medium:c.substring(0,100),http_referrer:l,http_referrer_length:d,landingpage:f,landingpage_length:h,time:(new Date).valueOf()/1e3|0},w=encodeURIComponent(JSON.stringify(m));return w.length>4e3&&(m.http_referrer=m.http_referrer?.substring(0,1e3),null!=m.landingpage&&(m.landingpage=m.landingpage.substring(0,1e3)),w=encodeURIComponent(JSON.stringify(m))),w.length>4e3&&(m={error:"too long",time:new Date/1e3|0},w=encodeURIComponent(JSON.stringify(m))),JSON.parse(decodeURIComponent(w))},S=()=>{if(window.ga&&"function"==typeof window.ga.getAll){if(window.ga.getAll()&&window.ga.getAll().length)return{id:window.ga.getAll()[0].get("clientId"),source:"gatracker"}}else if(t("_ga"))return{id:t("_ga"),source:"gacookie"};return{id:null,source:null}},y=()=>{const e=n("gclid");if(null!=e)return e;if(null!=r("gclid"))return null;try{const e=t("_shopify_sa_p");if(null!=e){const t=new URLSearchParams(decodeURIComponent(e)).get("gclid");if(null!=t)return t}}catch(e){}const o=t("FPGCLAW");if(null!=o){const e=o.split(".");if(e.length>=3)return o.substring(e[0].length+e[1].length+1+1)}const i=t("_gcl_aw");if(null!=i){const e=i.split(".");if(e.length>=3)return i.substring(e[0].length+e[1].length+1+1)}return null},k=()=>t("_fbp")||null,C=()=>{const e=n("fbclid")||null;if(null!=e)return x(e);if(null!=r("fbc"))return null;try{const e=t("_shopify_sa_p");if(null!=e){const t=new URLSearchParams(decodeURIComponent(e)).get("fbclid");if(null!=t)return x(t)}}catch(e){}return t("_fbc")||null||null},x=e=>`fb.1.${Math.floor(Date.now())}.${e}`;const I=async e=>{const n=t("pmPreviousRequest"),r=function(e){const t=`${_pm_root}/ss/shopify.php`,o=g(),n={v:1};n.pid=_pm_pid,n.cv="e0a78321afdfe824c54789edef9921fe2712331d",n.cart_token=e,window.shopifyCheckoutId&&(n.checkout_id=window.shopifyCheckoutId);try{const e=sessionStorage.getItem("pmShopifyLastOrderId");if(null!=e){const t=JSON.parse(e);if(t.orderId&&t.ts){const e=Math.floor(Date.now()/1e3)-1800;t.ts>e&&(n.order_id_internal=t.orderId)}}}catch(e){}return n.gclid=o?.gclid,n.gacid=o?.gacid,n.gacid_source=o?.gacid_source,n.gbraid=o?.gbraid,n.wbraid=o?.wbraid,n.ga4_sessionid=o?.ga4SessionId,n.ga4_sessioncount=o?.ga4SessionNumber,n.fbp=o?.fbp,n.fbc=o?.fbc,n.t=JSON.stringify(o?.visitSource),`${t}?${Object.keys(n).filter((e=>!!n[e])).map((e=>encodeURIComponent(e)+"="+encodeURIComponent(n[e]))).join("&")}`}(e);n!==r&&(o("pmPreviousRequest",r,999),await fetch(r))},R=async()=>{try{if(!c()&&!s())return;await fetch("/cart/update.js",{method:"post",body:"attributes[__profitmetrics_script]=1",headers:{"Content-Type":"application/x-www-form-urlencoded"}}).then((async e=>await e.json())).then((async e=>{await I(e.token),e.attributes.__profitmetrics_ct&&e.token===e.attributes.__profitmetrics_ct||await fetch("/cart/update.js",{method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:`attributes[__profitmetrics_ct]=${e.token}`})}))}catch(e){const t=`pid: ${_pm_pid}. Error in carttoken set -> /ss/shopify.php chain. Error message: ${e}.`;await i("ERROR",t)}};(()=>{const t=navigator.userAgent.toLowerCase();return e.some((e=>t.indexOf(e.toLowerCase())>=0))})()||(window.Shopify?.loadFeatures?window.Shopify.loadFeatures([{name:"consent-tracking-api",version:"0.1"}],(e=>{e||R().then((e=>e))})):R().then((e=>e)),document.addEventListener("visitorConsentCollected",(async()=>{R().then((e=>e))})))}();