New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@leaffm/automatic-script-test

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@leaffm/automatic-script-test - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

dist/index.esm.min.js

@@ -1,1 +0,1 @@

"undefined"==typeof leafconnect_analytics&&(leafconnect_analytics={}),"undefined"==typeof leafconnect_browser&&(leafconnect_browser={});var t={"andrea-development-extensibility.myshopify.com":{FB:!0,FBID:"1473426379889073",GA4:!0,GA4ID:"G-QC2R6N47SR",GADS:!0,GADSID:"AW-16733937504",GADSPV:"uABpCJuF6fIZEOC-rqs-",GADSVI:"Sc7LCJ6F6fIZEOC-rqs-",GADSATC:"W-ZvCJWF6fIZEOC-rqs-",GADSIC:"HwINCJiF6fIZEOC-rqs-",GADSP:"ZRi6CJKF6fIZEOC-rqs-",PT:!0,PTID:"2613625049372",TT:!0,TTID:"C9AAA0BC77UB71TGNRA0",CMV2:!0,GTM:!0,GTMID:"GTM-KQX5BSXM"},"kev-checkout-extensibility.myshopify.com":{FB:!0,FBID:"1473426379889073",GA4:!0,GA4ID:"G-QC2R6N47SR",GADS:!0,GADSID:"AW-16733937504",GADSPV:"uABpCJuF6fIZEOC-rqs-",GADSVI:"Sc7LCJ6F6fIZEOC-rqs-",GADSATC:"W-ZvCJWF6fIZEOC-rqs-",GADSIC:"HwINCJiF6fIZEOC-rqs-",GADSP:"ZRi6CJKF6fIZEOC-rqs-",PT:!0,PTID:"2613625049372",TT:!0,TTID:"C9A087BC77UB71TGNRA0",CMV2:!0,GTM:!0,GTMID:"GTM-KQX5BSXM"},domain3:{FB:!1,FBID:"",GA4:!0,GA4ID:"G-12378988876",GADS:!0,GADSID:"AW-4444567891",GADSPV:"",GADSVI:"",GADSATC:"",GADSIC:"",GADSP:"",PT:!1,PTID:"",TT:!0,TTID:"C9A087BC77UB71TGNRA0",CMV2:!1,GTM:!0,GTMID:"GTM-234567890"}},e=[];function a(t){console.log("saving function type ",typeof t),e.push(t)}api.customerPrivacy.subscribe("visitorConsentCollected",(t=>{var a=t.customerPrivacy;console.log("customerPrivacyStatus ... ",a),e.forEach((function(t){console.log("eventFunction ",t),t()})),e=[]}));var i=init;const n=i.context?.document;var r=n.location.host;i.customerPrivacy;var c=i.customerPrivacy.marketingAllowed,o=i.customerPrivacy.analyticsProcessingAllowed;let d;if(t[r].GA4){var u="https://www.googletagmanager.com/gtag/js?id="+t[r].GA4ID;const e=document.createElement("script");e.setAttribute("src",u),e.setAttribute("async",""),document.head.appendChild(e),window.dataLayer=window.dataLayer||[],d=function(){dataLayer.push(arguments)},d("js",new Date),d("config",t[r].GA4ID,{send_page_view:!1,page_location:n?.location?.href,page_referrer:n?.referrer,page_title:n?.title})}if(t[r].CMV2&&(d("consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}),d("consent","update",{ad_storage:c?"granted":"denied",analytics_storage:o?"granted":"denied",ad_user_data:c?"granted":"denied",ad_personalization:c?"granted":"denied"})),t[r].GADS){var s="https://www.googletagmanager.com/gtag/js?id="+t[r].GADSID;const e=document.createElement("script");e.setAttribute("src",s),e.setAttribute("async",""),document.head.appendChild(e),window.dataLayer=window.dataLayer||[],d=function(){dataLayer.push(arguments)},d("js",new Date),d("config",t[r].GADSID,{page_location:n?.location?.href,page_referrer:n?.referrer,page_title:n?.title})}var l,_,p,m,v,h;let f,y,g,A;t[r].GTM&&function(t,e,a,i,n){t[i]=t[i]||[],t[i].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var r=e.getElementsByTagName(a)[0],c=e.createElement(a);c.async=!0,c.src="https://www.googletagmanager.com/gtm.js?id="+n,r.parentNode.insertBefore(c,r)}(window,document,"script","dataLayer",t[r].GTMID),t[r].FB&&c&&(l=window,_=document,p="script",l.fbq||(m=l.fbq=function(){m.callMethod?m.callMethod.apply(m,arguments):m.queue.push(arguments)},l._fbq||(l._fbq=m),m.push=m,m.loaded=!0,m.version="2.0",m.queue=[],(v=_.createElement(p)).async=!0,v.src="https://connect.facebook.net/en_US/fbevents.js",(h=_.getElementsByTagName(p)[0]).parentNode.insertBefore(v,h))),t[r].TT&&c&&function(e,a,i){e.TiktokAnalyticsObject=i;var n=e[i]=e[i]||[];n.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie"],n.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};for(var c=0;c<n.methods.length;c++)n.setAndDefer(n,n.methods[c]);n.instance=function(t){for(var e=n._i[t]||[],a=0;a<n.methods.length;a++)n.setAndDefer(e,n.methods[a]);return e},n.load=function(t,e){var a="https://analytics.tiktok.com/i18n/pixel/events.js";n._i=n._i||{},n._i[t]=[],n._i[t]._u=a,n._t=n._t||{},n._t[t]=+new Date,n._o=n._o||{},n._o[t]=e||{};var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=a+"?sdkid="+t+"&lib="+i;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(r,c)},n.load(t[r].TTID),n.page()}(window,document,"ttq"),t[r].PT&&c&&(!function(){if(!window.pintrk){window.pintrk=function(){window.pintrk.queue.push(Array.prototype.slice.call(arguments))};var t=window.pintrk;t.queue=[],t.version="3.0";var e=document.createElement("script");e.async=!0,e.src="https://s.pinimg.com/ct/core.js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(e,a)}}(),pintrk("load",t[r].PTID),pintrk("page")),t[r].FB&&(f=function(e,a,i,n,o){var d=function(t,e){var a={external_id:t};return Object.keys(e).length>0&&(a.em=e.email,a.fn=e.first_name,a.ln=e.last_name,a.ct=e.default_address.city,a.zp=e.default_address.zip,a.country=e.default_address.country_code),a}(n,o);t[r].FBID&&c&&(fbq("init",t[r].FBID,d),fbq("trackSingle",t[r].FBID,e,a,{eventID:i}))}),t[r].GA4&&(y=function(t,e){d("event",t,e)}),t[r].TT&&(g=function(t,e){c&&ttq.track(t,e)}),t[r].PT&&(A=function(t,e){c&&pintrk("track",t,e)});const w=()=>Math.random().toString(36).substring(2);function k(t,e){const a=new Date;a.setTime(a.getTime()+31536e6);var i="expires="+a.toUTCString();leafconnect_browser.cookie.set(e+"="+t+"; "+i+"; path=/")}async function D(){var t=await leafconnect_browser.cookie.get("connect_cid");t&&""!==t||k(w()+w(),"connect_cid")}async function T(t){return await leafconnect_browser.cookie.get(t)}function C(){return Math.floor(Date.now()/1e3)}async function G(e){var a=await T("connect_cid"),i=(await T("_ga")).split(".").splice(2,3).join("."),n="";if(t[r].GA4){var c="_ga_"+t[r].GA4ID.split("-")[1],o=await T(c);o&&o.split(".").length>3&&(n=o.split(".")[2])}var d=await T("_fbp"),u=null;d&&""!==d&&(u=d);var s=await T("_fbc"),l=null;s&&""!==s&&(l=s);var _=await async function(){var t=await T("latestETMSec"),e=C();if(!t||""===t)return k(e,"latestETMSec"),1;var a=e-t;return 0===a?1:a}();return{cid:i,ga_session_id:n,external_id:a,fbp:u,fbc:l,page_referrer:e.context.document.referrer||e.context.document.location.origin,engagement_time_msec:_,user_agent:e.context.navigator.userAgent}}function b(t){t=t.toLowerCase().split(" ");for(var e=0;e<t.length;e++)t[e]=t[e].charAt(0).toUpperCase()+t[e].slice(1);return t.join(" ")}function S(t){var e={};if(t.length>1&&t.includes("collections"))if("collections"!==t[0]){var a=t.slice(1);e.item_list_id=a.join("_"),e.item_list_name=b(a.join(" "))}else e.item_list_id=t.join("_"),e.item_list_name=b(t.join(" "));else e.item_list_id=t.join("_"),e.item_list_name=b(t.join(" "));return e}function I(t,e){var a,i=t.replace(e,""),n="";if(i.includes("?")){var r=i.indexOf("?");n=i.slice(0,r)}else n=i;return a=n.length,n.length>1&&"/"==n.charAt(a-1)?S((n=n.slice(1,-1)).split("/")):n.length<=1?{item_list_id:"home",item_list_name:"Home"}:S((n=n.slice(1)).split("/"))}function P(t,e){var a,i,n=[],r=I(t.context.document.referrer,t.context.document.location.origin);return a=r.item_list_id,i=r.item_list_name,t.data.checkout.lineItems.forEach((function(t){var r={item_id:t.variant.sku?t.variant.sku:t.variant.product.id,item_shopify_id:t.variant.product.id,item_shopify_variant:t.variant.id,item_name:t.title,item_variant:t.variant.title||"default title",currency:t.variant.price.currencyCode,price:t.variant.price.amount,item_brand:t.variant.product.vendor,item_list_id:a,item_list_name:i,image_url:t.variant.image.src,quantity:t.quantity};"custom/update_checkout"===e&&(r.sku=t.variant.sku?t.variant.sku:t.variant.product.id,r.product_id=t.variant.product.id,r.variant_id=t.variant.id,r.title=t.variant.product.title,r.variant_title=t.variant.title,r.vendor=t.variant.product.vendor),n.push(r)})),n}leafconnect_analytics.subscribe("page_viewed",(async e=>{if(!e.context.window.location.href.includes("processing")){await D();var i=await G(e),n={},o={};if(t[r].FB&&(f("PageView",n,e.id,i.external_id,o),a((()=>f("PageView",n,e.id,i.external_id,o)))),t[r].GA4){var u={page_location:e.context.window.location.href,page_title:e.context.document.title};y("page_view",u)}t[r].GADS&&null!=t[r].GADSPV&&c&&(d("set","user_data",i),d("event","conversion",{send_to:t[r].GADSID+"/"+t[r].GADSPV})),k(C(),"latestETMSec"),window.dataLayer.push({event:"page_view",event_id:e.id,external_id:i.external_id,url:e.context.document.location.href,page_title:e.context.document.title})}})),leafconnect_analytics.subscribe("product_viewed",(async e=>{var i=await G(e),n=e.data.productVariant.title;""===n&&(n="Default Title");var o=e.context.document.referrer,u=e.context.document.location.origin,s=e.context.document.location.protocol,l=e.context.document.location.href,_=I(o,u),p=_.item_list_id,m=_.item_list_name,v=s+e.data.productVariant.image.src,h=e.data.productVariant.price.currencyCode,w=e.data.productVariant.price.amount,D=e.data.productVariant.sku;""===D&&(D=e.data.productVariant.product.id);var T={currency:h,value:w,affiliation:"Online Store",items:[{item_id:D,item_shopify_id:e.data.productVariant.product.id,item_shopify_variant:e.data.productVariant.id,item_name:e.data.productVariant.product.title,item_variant:n,currency:h,price:w,item_brand:e.data.productVariant.product.vendor,item_list_id:p,item_list_name:m,image_url:v,product_url:l}]};window.dataLayer.push({pageType:"Product",event:"view_item",event_id:e.id,external_id:i.external_id,url:e.context.document.location.href,ecommerce:T});var b=[],S=e.data.productVariant.id||e.data.productVariant.sku,P={id:S,quantity:1},q=[S];b.push(P);var x={content_type:"product",currency:h,value:w,contents:b};x.content_ids=q;var L={};if(t[r].FB&&(f("ViewContent",x,e.id,i.external_id,L),a((()=>f("ViewContent",x,e.id,i.external_id,L)))),t[r].GA4){var V={...T};y("view_item",V)}if(t[r].GADS&&null!=t[r].GADSVI&&c){d("set","user_data",i);var B=[],E="shopify_GB_"+e.data.productVariant.product.id+"_"+e.data.productVariant.id;B.push({id:E,price:w,quantity:1}),d("event","conversion",{send_to:t[r].GADS+"/"+t[r].GADSVI,value:w,currency:h,items:B})}if(t[r].TT){var F=[],M={content_id:S,content_name:e.data.productVariant.product.title,quantity:1,price:w};F.push(M);var j={contents:F,content_type:"product",currency:h,value:w};g("ViewContent",j),a((()=>g("ViewContent",j)))}if(t[r].PT){var N=[],O={product_name:e.data.productVariant.product.title,product_id:e.data.productVariant.product.id,product_variant_id:S,product_variant:n,product_price:w,product_quantity:1,product_brand:e.data.productVariant.product.vendor};N.push(O);var Z={event_id:e.id,currency:h,line_items:N};A("pagevisit",Z),a((()=>A("pagevisit",Z)))}k(C(),"latestETMSec")})),leafconnect_analytics.subscribe("product_added_to_cart",(async e=>{if(""!==e.clientId){var a=await G(e),i=e.context.document.referrer,n=e.context.document.location.origin,o=n+e.data.cartLine.merchandise.product.url,u=I(i,n),s=u.item_list_id,l=u.item_list_name,_=e.data.cartLine.merchandise.price.currencyCode,p=e.data.cartLine.merchandise.price.amount,m=e.data.cartLine.cost.totalAmount.amount,v=e.data.cartLine.merchandise.sku;""===v&&(v=e.data.cartLine.merchandise.product.id);var h={currency:_,value:m,affiliation:"Online Store",items:[{item_id:v,item_shopify_id:e.data.cartLine.merchandise.product.id,item_shopify_variant:e.data.cartLine.merchandise.id,item_name:e.data.cartLine.merchandise.product.title,item_variant:"Default Variant Title",currency:_,price:p,quantity:e.data.cartLine.quantity,item_brand:e.data.cartLine.merchandise.product.vendor,item_list_id:s,item_list_name:l,image_url:e.data.cartLine.merchandise.image.src,product_url:o}]};window.dataLayer.push({pageType:"Product",event:"add_to_cart",event_id:e.id,external_id:a.external_id,url:e.context.document.location.href,ecommerce:h});var w=[],D=e.data.cartLine.merchandise.id||e.data.cartLine.merchandise.sku,T={id:D,quantity:e.data.cartLine.quantity},b=[D];w.push(T);var S={content_type:"product",currency:_,value:m,contents:w};S.content_ids=b;if(t[r].FB&&f("AddToCart",S,e.id,a.external_id,{}),t[r].GA4){var P={...h};y("add_to_cart",P)}if(t[r].GADS&&null!=t[r].GADSATC&&c){d("set","user_data",a);var q=[],x="shopify_GB_"+e.data.cartLine.merchandise.product.id+"_"+e.data.cartLine.merchandise.id;q.push({id:x,price:p,quantity:e.data.cartLine.quantity}),d("event","conversion",{send_to:t[r].GADSID+"/"+t[r].GADSATC,value:m,currency:_,items:q})}if(t[r].TT){var L=[],V={content_id:D,content_name:e.data.cartLine.merchandise.product.title,quantity:e.data.cartLine.quantity,price:p};L.push(V),g("AddToCart",{contents:L,content_type:"product",currency:_,value:m})}if(t[r].PT){var B=[],E={product_name:e.data.cartLine.merchandise.product.title,product_id:e.data.cartLine.merchandise.id,product_variant_id:e.data.cartLine.merchandise.product.id,product_variant:e.data.cartLine.merchandise.product.title,product_price:p,product_quantity:e.data.cartLine.quantity,product_brand:e.data.cartLine.merchandise.product.vendor};B.push(E);var F={event_id:e.id,currency:_,line_items:B};A("addtocart",F)}k(C(),"latestETMSec")}})),leafconnect_analytics.subscribe("checkout_started",(async e=>{var a=await G(e),i={};i.value=e.data.checkout.totalPrice.amount,i.currency=e.data.checkout.totalPrice.currencyCode,i.affiliation="Online Store";var n=P(e,"custom/begin_checkout");i.items=n;var o=e.data.checkout,u={currency:o.currencyCode,content_type:"product",value:parseFloat(o.totalPrice.amount)},s=[],l=[];o.lineItems.forEach((function(t){var e=t.variant.id?t.variant.id:t.variant.product.id;s.push({id:e,quantity:t.quantity,item_price:t.variant.price.amount}),l.push(e)})),u.contents=s,window.dataLayer.push({pageType:"Initiate Checkout",event:"initiate_checkout",event_id:e.id,external_id:a.external_id,url:e.context.document.location.href,ecommerce:{value:parseFloat(o.totalPrice.amount),currency:o.currencyCode,affiliation:"Online Store",items:n}}),u.content_ids=l;if(t[r].FB&&f("InitiateCheckout",u,e.id,a.external_id,{}),t[r].GA4){var _={...i};y("begin_checkout",_)}if(t[r].GADS&&null!=t[r].GADSIC&&c){d("set","user_data",a);var p=[];n.forEach((function(t){var e="shopify_GB_"+t.item_shopify_id+"_"+t.item_shopify_variant;p.push({id:e,price:t.price,quantity:t.quantity})})),d("event","conversion",{send_to:t[r].GADSID+"/"+t[r].GADSIC,value:parseFloat(o.totalPrice.amount),currency:o.currencyCode,items:p})}if(t[r].TT){var m=[];n.forEach((function(t){var e=t.item_shopify_variant?t.item_shopify_variant:t.item_shopify_id;m.push({content_id:e,content_name:t.item_name,price:t.price,quantity:t.quantity})}));var v={contents:m,content_type:"product",currency:o.currencyCode,value:parseFloat(o.totalPrice.amount)};g("InitiateCheckout",v)}k(C(),"latestETMSec")})),leafconnect_analytics.subscribe("checkout_completed",(async e=>{var a=e.data.checkout.billingAddress.firstName?e.data.checkout.billingAddress.firstName.toLowerCase():null,i=e.data.checkout.billingAddress.lastName?e.data.checkout.billingAddress.lastName.toLowerCase():null,n=e.data.checkout.billingAddress.city?e.data.checkout.billingAddress.city.replace(/ /g,"").toLowerCase():null,o=e.data.checkout.billingAddress.province?e.data.checkout.billingAddress.province.replace(/ /g,"").toLowerCase():null,u=e.data.checkout.billingAddress.zip?e.data.checkout.billingAddress.zip.replace(/ /g,"").replace("-","").toLowerCase():null,s=e.data.checkout.billingAddress.country?e.data.checkout.billingAddress.country.toLowerCase():null,l=await G(e),_={first_name:a,last_name:i,default_address:{full_name:a+i,first_name:a,last_name:i,address1:e.data.checkout.billingAddress.address1,city:n,province:o,province_code:e.data.checkout.billingAddress.provinceCode,zip:u,country:s,country_code:e.data.checkout.billingAddress.countryCode}};if(e.data.checkout.billingAddress.address2&&(_.default_address.address2=e.data.checkout.billingAddress.address2),e.data.checkout.email&&(_.email=e.data.checkout.email.toLowerCase()),e.data.checkout.billingAddress.phone){var p=e.data.checkout.billingAddress.phone.replace("+","");_.default_address.phone=p}var m={content_type:"product",currency:e.data.checkout.totalPrice.currencyCode,value:e.data.checkout.totalPrice.amount},v=[],h=[];e.data.checkout.lineItems.forEach((function(t){var e=t.variant.id?t.variant.id:t.variant.product.id;v.push({id:e,quantity:t.quantity}),h.push(e)})),m.contents=v;var g=e.data.checkout.order.id.split("/"),A=g[g.length-1],w="payment_method_not_available";e.data.checkout.transactions&&e.data.checkout.transactions[0]&&e.data.checkout.transactions[0].gateway&&(w=e.data.checkout.transactions[0].gateway);var D=P(e,"purchase"),T=e.data.checkout.shippingLine.price.amount?e.data.checkout.shippingLine.price.amount:0,b={transaction_number:A,transaction_id:A,affiliation:"Online Store",gateway:w,currency:e.data.checkout.totalPrice.currencyCode,value:e.data.checkout.totalPrice.amount,tax:e.data.checkout.totalTax.amount,transaction_subtotal:e.data.checkout.subtotalPrice.amount,shipping:T,items:D};if(window.dataLayer.push({pageType:"Thank You Page",event:"purchase",event_id:A,external_id:l.external_id,url:e.context.document.location.href,ecommerce:{transaction_number:A,transaction_id:A,affiliation:"Online Store",gateway:w,currency:e.data.checkout.totalPrice.currencyCode,value:e.data.checkout.totalPrice.amount,tax:e.data.checkout.totalTax.amount,transaction_subtotal:e.data.checkout.subtotalPrice.amount,shipping:T,items:D},customer:_}),m.content_ids=h,m.content_name="Thank You",t[r].FB&&f("Purchase",m,A,l.external_id,_),t[r].GA4){var S={...b};y("purchase",S)}if(t[r].GADS&&null!=t[r].GADSP&&c){d("set","user_data",l);var I=[];D.forEach((function(t){var e="shopify_GB_"+t.item_shopify_id+"_"+t.item_shopify_variant;I.push({id:e,price:t.price,quantity:t.quantity})})),d("event","conversion",{send_to:t[r].GADSID+"/"+t[r].GADSP,value:e.data.checkout.totalPrice.amount,currency:e.data.checkout.totalPrice.currencyCode,transaction_id:A,items:I})}if(t[r].TT){var q=[];D.forEach((function(t){var e=t.item_shopify_variant?t.item_shopify_variant:t.item_shopify_id;q.push({content_id:e,content_name:t.item_name,price:t.price,quantity:t.quantity})}));var x={contents:q,content_type:"product",currency:e.data.checkout.totalPrice.currencyCode,value:e.data.checkout.totalPrice.amount};ttq.track("CompletePayment",x)}if(t[r].PT){var L=[];D.forEach((function(t){L.push({product_name:t.item_name,product_id:t.item_shopify_id,product_variant_id:t.item_shopify_variant,product_variant:t.item_name,product_price:t.price,product_quantity:t.quantity,product_brand:t.item_brand})})),pintrk("track","checkout",{event_id:e.id,value:e.data.checkout.totalPrice.amount,currency:e.data.checkout.totalPrice.currencyCode,line_items:L})}k(C(),"latestETMSec")}));
"undefined"==typeof leafconnect_analytics&&(leafconnect_analytics={}),"undefined"==typeof leafconnect_browser&&(leafconnect_browser={});var t={"andrea-development-extensibility.myshopify.com":{FB:!0,FBID:"1473426379889073",GA4:!0,GA4ID:"G-QC2R6N47SR",GADS:!0,GADSID:"AW-16733937504",GADSPV:"uABpCJuF6fIZEOC-rqs-",GADSVI:"Sc7LCJ6F6fIZEOC-rqs-",GADSATC:"W-ZvCJWF6fIZEOC-rqs-",GADSIC:"HwINCJiF6fIZEOC-rqs-",GADSP:"ZRi6CJKF6fIZEOC-rqs-",PT:!0,PTID:"2613625049372",TT:!0,TTID:"C9AAA0BC77UB71TGNRA0",CMV2:!0,GTM:!0,GTMID:"GTM-KQX5BSXM"},"kev-checkout-extensibility.myshopify.com":{FB:!0,FBID:"1473426379889073",GA4:!0,GA4ID:"G-QC2R6N47SR",GADS:!0,GADSID:"AW-16733937504",GADSPV:"uABpCJuF6fIZEOC-rqs-",GADSVI:"Sc7LCJ6F6fIZEOC-rqs-",GADSATC:"W-ZvCJWF6fIZEOC-rqs-",GADSIC:"HwINCJiF6fIZEOC-rqs-",GADSP:"ZRi6CJKF6fIZEOC-rqs-",PT:!0,PTID:"2613625049372",TT:!0,TTID:"C9A087BC77UB71TGNRA0",CMV2:!0,GTM:!0,GTMID:"GTM-KQX5BSXM"},domain3:{FB:!1,FBID:"",GA4:!0,GA4ID:"G-12378988876",GADS:!0,GADSID:"AW-4444567891",GADSPV:"",GADSVI:"",GADSATC:"",GADSIC:"",GADSP:"",PT:!1,PTID:"",TT:!0,TTID:"C9A087BC77UB71TGNRA0",CMV2:!1,GTM:!0,GTMID:"GTM-234567890"}},e=[];function a(t){console.log("saving function type ",typeof t),e.push(t)}var i=init;const n=i.context?.document;var r=n.location.host;i.customerPrivacy;var c=i.customerPrivacy.marketingAllowed,o=i.customerPrivacy.analyticsProcessingAllowed;let d;if(api.customerPrivacy.subscribe("visitorConsentCollected",(t=>{var a=t.customerPrivacy;console.log("customerPrivacyStatus ... ",a),e.forEach((function(t){console.log("eventFunction ",t),t()})),e=[]})),t[r].GA4){var u="https://www.googletagmanager.com/gtag/js?id="+t[r].GA4ID;const e=document.createElement("script");e.setAttribute("src",u),e.setAttribute("async",""),document.head.appendChild(e),window.dataLayer=window.dataLayer||[],d=function(){dataLayer.push(arguments)},d("js",new Date),d("config",t[r].GA4ID,{send_page_view:!1,page_location:n?.location?.href,page_referrer:n?.referrer,page_title:n?.title})}if(t[r].CMV2&&(d("consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}),d("consent","update",{ad_storage:c?"granted":"denied",analytics_storage:o?"granted":"denied",ad_user_data:c?"granted":"denied",ad_personalization:c?"granted":"denied"})),t[r].GADS){var s="https://www.googletagmanager.com/gtag/js?id="+t[r].GADSID;const e=document.createElement("script");e.setAttribute("src",s),e.setAttribute("async",""),document.head.appendChild(e),window.dataLayer=window.dataLayer||[],d=function(){dataLayer.push(arguments)},d("js",new Date),d("config",t[r].GADSID,{page_location:n?.location?.href,page_referrer:n?.referrer,page_title:n?.title})}var l,_,p,m,v,h;let f,y,g,A;t[r].GTM&&function(t,e,a,i,n){t[i]=t[i]||[],t[i].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var r=e.getElementsByTagName(a)[0],c=e.createElement(a);c.async=!0,c.src="https://www.googletagmanager.com/gtm.js?id="+n,r.parentNode.insertBefore(c,r)}(window,document,"script","dataLayer",t[r].GTMID),t[r].FB&&c&&(l=window,_=document,p="script",l.fbq||(m=l.fbq=function(){m.callMethod?m.callMethod.apply(m,arguments):m.queue.push(arguments)},l._fbq||(l._fbq=m),m.push=m,m.loaded=!0,m.version="2.0",m.queue=[],(v=_.createElement(p)).async=!0,v.src="https://connect.facebook.net/en_US/fbevents.js",(h=_.getElementsByTagName(p)[0]).parentNode.insertBefore(v,h))),t[r].TT&&c&&function(e,a,i){e.TiktokAnalyticsObject=i;var n=e[i]=e[i]||[];n.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie"],n.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};for(var c=0;c<n.methods.length;c++)n.setAndDefer(n,n.methods[c]);n.instance=function(t){for(var e=n._i[t]||[],a=0;a<n.methods.length;a++)n.setAndDefer(e,n.methods[a]);return e},n.load=function(t,e){var a="https://analytics.tiktok.com/i18n/pixel/events.js";n._i=n._i||{},n._i[t]=[],n._i[t]._u=a,n._t=n._t||{},n._t[t]=+new Date,n._o=n._o||{},n._o[t]=e||{};var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=a+"?sdkid="+t+"&lib="+i;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(r,c)},n.load(t[r].TTID),n.page()}(window,document,"ttq"),t[r].PT&&c&&(!function(){if(!window.pintrk){window.pintrk=function(){window.pintrk.queue.push(Array.prototype.slice.call(arguments))};var t=window.pintrk;t.queue=[],t.version="3.0";var e=document.createElement("script");e.async=!0,e.src="https://s.pinimg.com/ct/core.js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(e,a)}}(),pintrk("load",t[r].PTID),pintrk("page")),t[r].FB&&(f=function(e,a,i,n,o){var d=function(t,e){var a={external_id:t};return Object.keys(e).length>0&&(a.em=e.email,a.fn=e.first_name,a.ln=e.last_name,a.ct=e.default_address.city,a.zp=e.default_address.zip,a.country=e.default_address.country_code),a}(n,o);t[r].FBID&&c&&(fbq("init",t[r].FBID,d),fbq("trackSingle",t[r].FBID,e,a,{eventID:i}))}),t[r].GA4&&(y=function(t,e){d("event",t,e)}),t[r].TT&&(g=function(t,e){c&&ttq.track(t,e)}),t[r].PT&&(A=function(t,e){c&&pintrk("track",t,e)});const w=()=>Math.random().toString(36).substring(2);function k(t,e){const a=new Date;a.setTime(a.getTime()+31536e6);var i="expires="+a.toUTCString();leafconnect_browser.cookie.set(e+"="+t+"; "+i+"; path=/")}async function D(){var t=await leafconnect_browser.cookie.get("connect_cid");t&&""!==t||k(w()+w(),"connect_cid")}async function T(t){return await leafconnect_browser.cookie.get(t)}function C(){return Math.floor(Date.now()/1e3)}async function G(e){var a=await T("connect_cid"),i=(await T("_ga")).split(".").splice(2,3).join("."),n="";if(t[r].GA4){var c="_ga_"+t[r].GA4ID.split("-")[1],o=await T(c);o&&o.split(".").length>3&&(n=o.split(".")[2])}var d=await T("_fbp"),u=null;d&&""!==d&&(u=d);var s=await T("_fbc"),l=null;s&&""!==s&&(l=s);var _=await async function(){var t=await T("latestETMSec"),e=C();if(!t||""===t)return k(e,"latestETMSec"),1;var a=e-t;return 0===a?1:a}();return{cid:i,ga_session_id:n,external_id:a,fbp:u,fbc:l,page_referrer:e.context.document.referrer||e.context.document.location.origin,engagement_time_msec:_,user_agent:e.context.navigator.userAgent}}function b(t){t=t.toLowerCase().split(" ");for(var e=0;e<t.length;e++)t[e]=t[e].charAt(0).toUpperCase()+t[e].slice(1);return t.join(" ")}function S(t){var e={};if(t.length>1&&t.includes("collections"))if("collections"!==t[0]){var a=t.slice(1);e.item_list_id=a.join("_"),e.item_list_name=b(a.join(" "))}else e.item_list_id=t.join("_"),e.item_list_name=b(t.join(" "));else e.item_list_id=t.join("_"),e.item_list_name=b(t.join(" "));return e}function I(t,e){var a,i=t.replace(e,""),n="";if(i.includes("?")){var r=i.indexOf("?");n=i.slice(0,r)}else n=i;return a=n.length,n.length>1&&"/"==n.charAt(a-1)?S((n=n.slice(1,-1)).split("/")):n.length<=1?{item_list_id:"home",item_list_name:"Home"}:S((n=n.slice(1)).split("/"))}function P(t,e){var a,i,n=[],r=I(t.context.document.referrer,t.context.document.location.origin);return a=r.item_list_id,i=r.item_list_name,t.data.checkout.lineItems.forEach((function(t){var r={item_id:t.variant.sku?t.variant.sku:t.variant.product.id,item_shopify_id:t.variant.product.id,item_shopify_variant:t.variant.id,item_name:t.title,item_variant:t.variant.title||"default title",currency:t.variant.price.currencyCode,price:t.variant.price.amount,item_brand:t.variant.product.vendor,item_list_id:a,item_list_name:i,image_url:t.variant.image.src,quantity:t.quantity};"custom/update_checkout"===e&&(r.sku=t.variant.sku?t.variant.sku:t.variant.product.id,r.product_id=t.variant.product.id,r.variant_id=t.variant.id,r.title=t.variant.product.title,r.variant_title=t.variant.title,r.vendor=t.variant.product.vendor),n.push(r)})),n}leafconnect_analytics.subscribe("page_viewed",(async e=>{if(!e.context.window.location.href.includes("processing")){await D();var i=await G(e),n={},o={};if(t[r].FB&&(f("PageView",n,e.id,i.external_id,o),a((()=>f("PageView",n,e.id,i.external_id,o)))),t[r].GA4){var u={page_location:e.context.window.location.href,page_title:e.context.document.title};y("page_view",u)}t[r].GADS&&null!=t[r].GADSPV&&c&&(d("set","user_data",i),d("event","conversion",{send_to:t[r].GADSID+"/"+t[r].GADSPV})),k(C(),"latestETMSec"),window.dataLayer.push({event:"page_view",event_id:e.id,external_id:i.external_id,url:e.context.document.location.href,page_title:e.context.document.title})}})),leafconnect_analytics.subscribe("product_viewed",(async e=>{var i=await G(e),n=e.data.productVariant.title;""===n&&(n="Default Title");var o=e.context.document.referrer,u=e.context.document.location.origin,s=e.context.document.location.protocol,l=e.context.document.location.href,_=I(o,u),p=_.item_list_id,m=_.item_list_name,v=s+e.data.productVariant.image.src,h=e.data.productVariant.price.currencyCode,w=e.data.productVariant.price.amount,D=e.data.productVariant.sku;""===D&&(D=e.data.productVariant.product.id);var T={currency:h,value:w,affiliation:"Online Store",items:[{item_id:D,item_shopify_id:e.data.productVariant.product.id,item_shopify_variant:e.data.productVariant.id,item_name:e.data.productVariant.product.title,item_variant:n,currency:h,price:w,item_brand:e.data.productVariant.product.vendor,item_list_id:p,item_list_name:m,image_url:v,product_url:l}]};window.dataLayer.push({pageType:"Product",event:"view_item",event_id:e.id,external_id:i.external_id,url:e.context.document.location.href,ecommerce:T});var b=[],S=e.data.productVariant.id||e.data.productVariant.sku,P={id:S,quantity:1},q=[S];b.push(P);var x={content_type:"product",currency:h,value:w,contents:b};x.content_ids=q;var L={};if(t[r].FB&&(f("ViewContent",x,e.id,i.external_id,L),a((()=>f("ViewContent",x,e.id,i.external_id,L)))),t[r].GA4){var V={...T};y("view_item",V)}if(t[r].GADS&&null!=t[r].GADSVI&&c){d("set","user_data",i);var B=[],E="shopify_GB_"+e.data.productVariant.product.id+"_"+e.data.productVariant.id;B.push({id:E,price:w,quantity:1}),d("event","conversion",{send_to:t[r].GADS+"/"+t[r].GADSVI,value:w,currency:h,items:B})}if(t[r].TT){var F=[],M={content_id:S,content_name:e.data.productVariant.product.title,quantity:1,price:w};F.push(M);var j={contents:F,content_type:"product",currency:h,value:w};g("ViewContent",j),a((()=>g("ViewContent",j)))}if(t[r].PT){var N=[],O={product_name:e.data.productVariant.product.title,product_id:e.data.productVariant.product.id,product_variant_id:S,product_variant:n,product_price:w,product_quantity:1,product_brand:e.data.productVariant.product.vendor};N.push(O);var Z={event_id:e.id,currency:h,line_items:N};A("pagevisit",Z),a((()=>A("pagevisit",Z)))}k(C(),"latestETMSec")})),leafconnect_analytics.subscribe("product_added_to_cart",(async e=>{if(""!==e.clientId){var a=await G(e),i=e.context.document.referrer,n=e.context.document.location.origin,o=n+e.data.cartLine.merchandise.product.url,u=I(i,n),s=u.item_list_id,l=u.item_list_name,_=e.data.cartLine.merchandise.price.currencyCode,p=e.data.cartLine.merchandise.price.amount,m=e.data.cartLine.cost.totalAmount.amount,v=e.data.cartLine.merchandise.sku;""===v&&(v=e.data.cartLine.merchandise.product.id);var h={currency:_,value:m,affiliation:"Online Store",items:[{item_id:v,item_shopify_id:e.data.cartLine.merchandise.product.id,item_shopify_variant:e.data.cartLine.merchandise.id,item_name:e.data.cartLine.merchandise.product.title,item_variant:"Default Variant Title",currency:_,price:p,quantity:e.data.cartLine.quantity,item_brand:e.data.cartLine.merchandise.product.vendor,item_list_id:s,item_list_name:l,image_url:e.data.cartLine.merchandise.image.src,product_url:o}]};window.dataLayer.push({pageType:"Product",event:"add_to_cart",event_id:e.id,external_id:a.external_id,url:e.context.document.location.href,ecommerce:h});var w=[],D=e.data.cartLine.merchandise.id||e.data.cartLine.merchandise.sku,T={id:D,quantity:e.data.cartLine.quantity},b=[D];w.push(T);var S={content_type:"product",currency:_,value:m,contents:w};S.content_ids=b;if(t[r].FB&&f("AddToCart",S,e.id,a.external_id,{}),t[r].GA4){var P={...h};y("add_to_cart",P)}if(t[r].GADS&&null!=t[r].GADSATC&&c){d("set","user_data",a);var q=[],x="shopify_GB_"+e.data.cartLine.merchandise.product.id+"_"+e.data.cartLine.merchandise.id;q.push({id:x,price:p,quantity:e.data.cartLine.quantity}),d("event","conversion",{send_to:t[r].GADSID+"/"+t[r].GADSATC,value:m,currency:_,items:q})}if(t[r].TT){var L=[],V={content_id:D,content_name:e.data.cartLine.merchandise.product.title,quantity:e.data.cartLine.quantity,price:p};L.push(V),g("AddToCart",{contents:L,content_type:"product",currency:_,value:m})}if(t[r].PT){var B=[],E={product_name:e.data.cartLine.merchandise.product.title,product_id:e.data.cartLine.merchandise.id,product_variant_id:e.data.cartLine.merchandise.product.id,product_variant:e.data.cartLine.merchandise.product.title,product_price:p,product_quantity:e.data.cartLine.quantity,product_brand:e.data.cartLine.merchandise.product.vendor};B.push(E);var F={event_id:e.id,currency:_,line_items:B};A("addtocart",F)}k(C(),"latestETMSec")}})),leafconnect_analytics.subscribe("checkout_started",(async e=>{var a=await G(e),i={};i.value=e.data.checkout.totalPrice.amount,i.currency=e.data.checkout.totalPrice.currencyCode,i.affiliation="Online Store";var n=P(e,"custom/begin_checkout");i.items=n;var o=e.data.checkout,u={currency:o.currencyCode,content_type:"product",value:parseFloat(o.totalPrice.amount)},s=[],l=[];o.lineItems.forEach((function(t){var e=t.variant.id?t.variant.id:t.variant.product.id;s.push({id:e,quantity:t.quantity,item_price:t.variant.price.amount}),l.push(e)})),u.contents=s,window.dataLayer.push({pageType:"Initiate Checkout",event:"initiate_checkout",event_id:e.id,external_id:a.external_id,url:e.context.document.location.href,ecommerce:{value:parseFloat(o.totalPrice.amount),currency:o.currencyCode,affiliation:"Online Store",items:n}}),u.content_ids=l;if(t[r].FB&&f("InitiateCheckout",u,e.id,a.external_id,{}),t[r].GA4){var _={...i};y("begin_checkout",_)}if(t[r].GADS&&null!=t[r].GADSIC&&c){d("set","user_data",a);var p=[];n.forEach((function(t){var e="shopify_GB_"+t.item_shopify_id+"_"+t.item_shopify_variant;p.push({id:e,price:t.price,quantity:t.quantity})})),d("event","conversion",{send_to:t[r].GADSID+"/"+t[r].GADSIC,value:parseFloat(o.totalPrice.amount),currency:o.currencyCode,items:p})}if(t[r].TT){var m=[];n.forEach((function(t){var e=t.item_shopify_variant?t.item_shopify_variant:t.item_shopify_id;m.push({content_id:e,content_name:t.item_name,price:t.price,quantity:t.quantity})}));var v={contents:m,content_type:"product",currency:o.currencyCode,value:parseFloat(o.totalPrice.amount)};g("InitiateCheckout",v)}k(C(),"latestETMSec")})),leafconnect_analytics.subscribe("checkout_completed",(async e=>{var a=e.data.checkout.billingAddress.firstName?e.data.checkout.billingAddress.firstName.toLowerCase():null,i=e.data.checkout.billingAddress.lastName?e.data.checkout.billingAddress.lastName.toLowerCase():null,n=e.data.checkout.billingAddress.city?e.data.checkout.billingAddress.city.replace(/ /g,"").toLowerCase():null,o=e.data.checkout.billingAddress.province?e.data.checkout.billingAddress.province.replace(/ /g,"").toLowerCase():null,u=e.data.checkout.billingAddress.zip?e.data.checkout.billingAddress.zip.replace(/ /g,"").replace("-","").toLowerCase():null,s=e.data.checkout.billingAddress.country?e.data.checkout.billingAddress.country.toLowerCase():null,l=await G(e),_={first_name:a,last_name:i,default_address:{full_name:a+i,first_name:a,last_name:i,address1:e.data.checkout.billingAddress.address1,city:n,province:o,province_code:e.data.checkout.billingAddress.provinceCode,zip:u,country:s,country_code:e.data.checkout.billingAddress.countryCode}};if(e.data.checkout.billingAddress.address2&&(_.default_address.address2=e.data.checkout.billingAddress.address2),e.data.checkout.email&&(_.email=e.data.checkout.email.toLowerCase()),e.data.checkout.billingAddress.phone){var p=e.data.checkout.billingAddress.phone.replace("+","");_.default_address.phone=p}var m={content_type:"product",currency:e.data.checkout.totalPrice.currencyCode,value:e.data.checkout.totalPrice.amount},v=[],h=[];e.data.checkout.lineItems.forEach((function(t){var e=t.variant.id?t.variant.id:t.variant.product.id;v.push({id:e,quantity:t.quantity}),h.push(e)})),m.contents=v;var g=e.data.checkout.order.id.split("/"),A=g[g.length-1],w="payment_method_not_available";e.data.checkout.transactions&&e.data.checkout.transactions[0]&&e.data.checkout.transactions[0].gateway&&(w=e.data.checkout.transactions[0].gateway);var D=P(e,"purchase"),T=e.data.checkout.shippingLine.price.amount?e.data.checkout.shippingLine.price.amount:0,b={transaction_number:A,transaction_id:A,affiliation:"Online Store",gateway:w,currency:e.data.checkout.totalPrice.currencyCode,value:e.data.checkout.totalPrice.amount,tax:e.data.checkout.totalTax.amount,transaction_subtotal:e.data.checkout.subtotalPrice.amount,shipping:T,items:D};if(window.dataLayer.push({pageType:"Thank You Page",event:"purchase",event_id:A,external_id:l.external_id,url:e.context.document.location.href,ecommerce:{transaction_number:A,transaction_id:A,affiliation:"Online Store",gateway:w,currency:e.data.checkout.totalPrice.currencyCode,value:e.data.checkout.totalPrice.amount,tax:e.data.checkout.totalTax.amount,transaction_subtotal:e.data.checkout.subtotalPrice.amount,shipping:T,items:D},customer:_}),m.content_ids=h,m.content_name="Thank You",t[r].FB&&f("Purchase",m,A,l.external_id,_),t[r].GA4){var S={...b};y("purchase",S)}if(t[r].GADS&&null!=t[r].GADSP&&c){d("set","user_data",l);var I=[];D.forEach((function(t){var e="shopify_GB_"+t.item_shopify_id+"_"+t.item_shopify_variant;I.push({id:e,price:t.price,quantity:t.quantity})})),d("event","conversion",{send_to:t[r].GADSID+"/"+t[r].GADSP,value:e.data.checkout.totalPrice.amount,currency:e.data.checkout.totalPrice.currencyCode,transaction_id:A,items:I})}if(t[r].TT){var q=[];D.forEach((function(t){var e=t.item_shopify_variant?t.item_shopify_variant:t.item_shopify_id;q.push({content_id:e,content_name:t.item_name,price:t.price,quantity:t.quantity})}));var x={contents:q,content_type:"product",currency:e.data.checkout.totalPrice.currencyCode,value:e.data.checkout.totalPrice.amount};ttq.track("CompletePayment",x)}if(t[r].PT){var L=[];D.forEach((function(t){L.push({product_name:t.item_name,product_id:t.item_shopify_id,product_variant_id:t.item_shopify_variant,product_variant:t.item_name,product_price:t.price,product_quantity:t.quantity,product_brand:t.item_brand})})),pintrk("track","checkout",{event_id:e.id,value:e.data.checkout.totalPrice.amount,currency:e.data.checkout.totalPrice.currencyCode,line_items:L})}k(C(),"latestETMSec")}));

@@ -1,1 +0,1 @@

!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){"use strict";"undefined"==typeof leafconnect_analytics&&(leafconnect_analytics={}),"undefined"==typeof leafconnect_browser&&(leafconnect_browser={});var t={"andrea-development-extensibility.myshopify.com":{FB:!0,FBID:"1473426379889073",GA4:!0,GA4ID:"G-QC2R6N47SR",GADS:!0,GADSID:"AW-16733937504",GADSPV:"uABpCJuF6fIZEOC-rqs-",GADSVI:"Sc7LCJ6F6fIZEOC-rqs-",GADSATC:"W-ZvCJWF6fIZEOC-rqs-",GADSIC:"HwINCJiF6fIZEOC-rqs-",GADSP:"ZRi6CJKF6fIZEOC-rqs-",PT:!0,PTID:"2613625049372",TT:!0,TTID:"C9AAA0BC77UB71TGNRA0",CMV2:!0,GTM:!0,GTMID:"GTM-KQX5BSXM"},"kev-checkout-extensibility.myshopify.com":{FB:!0,FBID:"1473426379889073",GA4:!0,GA4ID:"G-QC2R6N47SR",GADS:!0,GADSID:"AW-16733937504",GADSPV:"uABpCJuF6fIZEOC-rqs-",GADSVI:"Sc7LCJ6F6fIZEOC-rqs-",GADSATC:"W-ZvCJWF6fIZEOC-rqs-",GADSIC:"HwINCJiF6fIZEOC-rqs-",GADSP:"ZRi6CJKF6fIZEOC-rqs-",PT:!0,PTID:"2613625049372",TT:!0,TTID:"C9A087BC77UB71TGNRA0",CMV2:!0,GTM:!0,GTMID:"GTM-KQX5BSXM"},domain3:{FB:!1,FBID:"",GA4:!0,GA4ID:"G-12378988876",GADS:!0,GADSID:"AW-4444567891",GADSPV:"",GADSVI:"",GADSATC:"",GADSIC:"",GADSP:"",PT:!1,PTID:"",TT:!0,TTID:"C9A087BC77UB71TGNRA0",CMV2:!1,GTM:!0,GTMID:"GTM-234567890"}},e=[];function a(t){console.log("saving function type ",typeof t),e.push(t)}api.customerPrivacy.subscribe("visitorConsentCollected",(t=>{var a=t.customerPrivacy;console.log("customerPrivacyStatus ... ",a),e.forEach((function(t){console.log("eventFunction ",t),t()})),e=[]}));var i=init;const n=i.context?.document;var r=n.location.host;i.customerPrivacy;var c=i.customerPrivacy.marketingAllowed,o=i.customerPrivacy.analyticsProcessingAllowed;let d;if(t[r].GA4){var u="https://www.googletagmanager.com/gtag/js?id="+t[r].GA4ID;const e=document.createElement("script");e.setAttribute("src",u),e.setAttribute("async",""),document.head.appendChild(e),window.dataLayer=window.dataLayer||[],d=function(){dataLayer.push(arguments)},d("js",new Date),d("config",t[r].GA4ID,{send_page_view:!1,page_location:n?.location?.href,page_referrer:n?.referrer,page_title:n?.title})}if(t[r].CMV2&&(d("consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}),d("consent","update",{ad_storage:c?"granted":"denied",analytics_storage:o?"granted":"denied",ad_user_data:c?"granted":"denied",ad_personalization:c?"granted":"denied"})),t[r].GADS){var s="https://www.googletagmanager.com/gtag/js?id="+t[r].GADSID;const e=document.createElement("script");e.setAttribute("src",s),e.setAttribute("async",""),document.head.appendChild(e),window.dataLayer=window.dataLayer||[],d=function(){dataLayer.push(arguments)},d("js",new Date),d("config",t[r].GADSID,{page_location:n?.location?.href,page_referrer:n?.referrer,page_title:n?.title})}var l,_,p,m,v,f;let h,y,g,A;t[r].GTM&&function(t,e,a,i,n){t[i]=t[i]||[],t[i].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var r=e.getElementsByTagName(a)[0],c=e.createElement(a);c.async=!0,c.src="https://www.googletagmanager.com/gtm.js?id="+n,r.parentNode.insertBefore(c,r)}(window,document,"script","dataLayer",t[r].GTMID),t[r].FB&&c&&(l=window,_=document,p="script",l.fbq||(m=l.fbq=function(){m.callMethod?m.callMethod.apply(m,arguments):m.queue.push(arguments)},l._fbq||(l._fbq=m),m.push=m,m.loaded=!0,m.version="2.0",m.queue=[],(v=_.createElement(p)).async=!0,v.src="https://connect.facebook.net/en_US/fbevents.js",(f=_.getElementsByTagName(p)[0]).parentNode.insertBefore(v,f))),t[r].TT&&c&&function(e,a,i){e.TiktokAnalyticsObject=i;var n=e[i]=e[i]||[];n.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie"],n.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};for(var c=0;c<n.methods.length;c++)n.setAndDefer(n,n.methods[c]);n.instance=function(t){for(var e=n._i[t]||[],a=0;a<n.methods.length;a++)n.setAndDefer(e,n.methods[a]);return e},n.load=function(t,e){var a="https://analytics.tiktok.com/i18n/pixel/events.js";n._i=n._i||{},n._i[t]=[],n._i[t]._u=a,n._t=n._t||{},n._t[t]=+new Date,n._o=n._o||{},n._o[t]=e||{};var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=a+"?sdkid="+t+"&lib="+i;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(r,c)},n.load(t[r].TTID),n.page()}(window,document,"ttq"),t[r].PT&&c&&(!function(){if(!window.pintrk){window.pintrk=function(){window.pintrk.queue.push(Array.prototype.slice.call(arguments))};var t=window.pintrk;t.queue=[],t.version="3.0";var e=document.createElement("script");e.async=!0,e.src="https://s.pinimg.com/ct/core.js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(e,a)}}(),pintrk("load",t[r].PTID),pintrk("page")),t[r].FB&&(h=function(e,a,i,n,o){var d=function(t,e){var a={external_id:t};return Object.keys(e).length>0&&(a.em=e.email,a.fn=e.first_name,a.ln=e.last_name,a.ct=e.default_address.city,a.zp=e.default_address.zip,a.country=e.default_address.country_code),a}(n,o);t[r].FBID&&c&&(fbq("init",t[r].FBID,d),fbq("trackSingle",t[r].FBID,e,a,{eventID:i}))}),t[r].GA4&&(y=function(t,e){d("event",t,e)}),t[r].TT&&(g=function(t,e){c&&ttq.track(t,e)}),t[r].PT&&(A=function(t,e){c&&pintrk("track",t,e)});const w=()=>Math.random().toString(36).substring(2);function k(t,e){const a=new Date;a.setTime(a.getTime()+31536e6);var i="expires="+a.toUTCString();leafconnect_browser.cookie.set(e+"="+t+"; "+i+"; path=/")}async function D(){var t=await leafconnect_browser.cookie.get("connect_cid");t&&""!==t||k(w()+w(),"connect_cid")}async function T(t){return await leafconnect_browser.cookie.get(t)}function C(){return Math.floor(Date.now()/1e3)}async function G(e){var a=await T("connect_cid"),i=(await T("_ga")).split(".").splice(2,3).join("."),n="";if(t[r].GA4){var c="_ga_"+t[r].GA4ID.split("-")[1],o=await T(c);o&&o.split(".").length>3&&(n=o.split(".")[2])}var d=await T("_fbp"),u=null;d&&""!==d&&(u=d);var s=await T("_fbc"),l=null;s&&""!==s&&(l=s);var _=await async function(){var t=await T("latestETMSec"),e=C();if(!t||""===t)return k(e,"latestETMSec"),1;var a=e-t;return 0===a?1:a}();return{cid:i,ga_session_id:n,external_id:a,fbp:u,fbc:l,page_referrer:e.context.document.referrer||e.context.document.location.origin,engagement_time_msec:_,user_agent:e.context.navigator.userAgent}}function b(t){t=t.toLowerCase().split(" ");for(var e=0;e<t.length;e++)t[e]=t[e].charAt(0).toUpperCase()+t[e].slice(1);return t.join(" ")}function S(t){var e={};if(t.length>1&&t.includes("collections"))if("collections"!==t[0]){var a=t.slice(1);e.item_list_id=a.join("_"),e.item_list_name=b(a.join(" "))}else e.item_list_id=t.join("_"),e.item_list_name=b(t.join(" "));else e.item_list_id=t.join("_"),e.item_list_name=b(t.join(" "));return e}function I(t,e){var a,i=t.replace(e,""),n="";if(i.includes("?")){var r=i.indexOf("?");n=i.slice(0,r)}else n=i;return a=n.length,n.length>1&&"/"==n.charAt(a-1)?S((n=n.slice(1,-1)).split("/")):n.length<=1?{item_list_id:"home",item_list_name:"Home"}:S((n=n.slice(1)).split("/"))}function P(t,e){var a,i,n=[],r=I(t.context.document.referrer,t.context.document.location.origin);return a=r.item_list_id,i=r.item_list_name,t.data.checkout.lineItems.forEach((function(t){var r={item_id:t.variant.sku?t.variant.sku:t.variant.product.id,item_shopify_id:t.variant.product.id,item_shopify_variant:t.variant.id,item_name:t.title,item_variant:t.variant.title||"default title",currency:t.variant.price.currencyCode,price:t.variant.price.amount,item_brand:t.variant.product.vendor,item_list_id:a,item_list_name:i,image_url:t.variant.image.src,quantity:t.quantity};"custom/update_checkout"===e&&(r.sku=t.variant.sku?t.variant.sku:t.variant.product.id,r.product_id=t.variant.product.id,r.variant_id=t.variant.id,r.title=t.variant.product.title,r.variant_title=t.variant.title,r.vendor=t.variant.product.vendor),n.push(r)})),n}leafconnect_analytics.subscribe("page_viewed",(async e=>{if(!e.context.window.location.href.includes("processing")){await D();var i=await G(e),n={},o={};if(t[r].FB&&(h("PageView",n,e.id,i.external_id,o),a((()=>h("PageView",n,e.id,i.external_id,o)))),t[r].GA4){var u={page_location:e.context.window.location.href,page_title:e.context.document.title};y("page_view",u)}t[r].GADS&&null!=t[r].GADSPV&&c&&(d("set","user_data",i),d("event","conversion",{send_to:t[r].GADSID+"/"+t[r].GADSPV})),k(C(),"latestETMSec"),window.dataLayer.push({event:"page_view",event_id:e.id,external_id:i.external_id,url:e.context.document.location.href,page_title:e.context.document.title})}})),leafconnect_analytics.subscribe("product_viewed",(async e=>{var i=await G(e),n=e.data.productVariant.title;""===n&&(n="Default Title");var o=e.context.document.referrer,u=e.context.document.location.origin,s=e.context.document.location.protocol,l=e.context.document.location.href,_=I(o,u),p=_.item_list_id,m=_.item_list_name,v=s+e.data.productVariant.image.src,f=e.data.productVariant.price.currencyCode,w=e.data.productVariant.price.amount,D=e.data.productVariant.sku;""===D&&(D=e.data.productVariant.product.id);var T={currency:f,value:w,affiliation:"Online Store",items:[{item_id:D,item_shopify_id:e.data.productVariant.product.id,item_shopify_variant:e.data.productVariant.id,item_name:e.data.productVariant.product.title,item_variant:n,currency:f,price:w,item_brand:e.data.productVariant.product.vendor,item_list_id:p,item_list_name:m,image_url:v,product_url:l}]};window.dataLayer.push({pageType:"Product",event:"view_item",event_id:e.id,external_id:i.external_id,url:e.context.document.location.href,ecommerce:T});var b=[],S=e.data.productVariant.id||e.data.productVariant.sku,P={id:S,quantity:1},q=[S];b.push(P);var x={content_type:"product",currency:f,value:w,contents:b};x.content_ids=q;var L={};if(t[r].FB&&(h("ViewContent",x,e.id,i.external_id,L),a((()=>h("ViewContent",x,e.id,i.external_id,L)))),t[r].GA4){var V={...T};y("view_item",V)}if(t[r].GADS&&null!=t[r].GADSVI&&c){d("set","user_data",i);var B=[],E="shopify_GB_"+e.data.productVariant.product.id+"_"+e.data.productVariant.id;B.push({id:E,price:w,quantity:1}),d("event","conversion",{send_to:t[r].GADS+"/"+t[r].GADSVI,value:w,currency:f,items:B})}if(t[r].TT){var F=[],M={content_id:S,content_name:e.data.productVariant.product.title,quantity:1,price:w};F.push(M);var j={contents:F,content_type:"product",currency:f,value:w};g("ViewContent",j),a((()=>g("ViewContent",j)))}if(t[r].PT){var N=[],O={product_name:e.data.productVariant.product.title,product_id:e.data.productVariant.product.id,product_variant_id:S,product_variant:n,product_price:w,product_quantity:1,product_brand:e.data.productVariant.product.vendor};N.push(O);var Z={event_id:e.id,currency:f,line_items:N};A("pagevisit",Z),a((()=>A("pagevisit",Z)))}k(C(),"latestETMSec")})),leafconnect_analytics.subscribe("product_added_to_cart",(async e=>{if(""!==e.clientId){var a=await G(e),i=e.context.document.referrer,n=e.context.document.location.origin,o=n+e.data.cartLine.merchandise.product.url,u=I(i,n),s=u.item_list_id,l=u.item_list_name,_=e.data.cartLine.merchandise.price.currencyCode,p=e.data.cartLine.merchandise.price.amount,m=e.data.cartLine.cost.totalAmount.amount,v=e.data.cartLine.merchandise.sku;""===v&&(v=e.data.cartLine.merchandise.product.id);var f={currency:_,value:m,affiliation:"Online Store",items:[{item_id:v,item_shopify_id:e.data.cartLine.merchandise.product.id,item_shopify_variant:e.data.cartLine.merchandise.id,item_name:e.data.cartLine.merchandise.product.title,item_variant:"Default Variant Title",currency:_,price:p,quantity:e.data.cartLine.quantity,item_brand:e.data.cartLine.merchandise.product.vendor,item_list_id:s,item_list_name:l,image_url:e.data.cartLine.merchandise.image.src,product_url:o}]};window.dataLayer.push({pageType:"Product",event:"add_to_cart",event_id:e.id,external_id:a.external_id,url:e.context.document.location.href,ecommerce:f});var w=[],D=e.data.cartLine.merchandise.id||e.data.cartLine.merchandise.sku,T={id:D,quantity:e.data.cartLine.quantity},b=[D];w.push(T);var S={content_type:"product",currency:_,value:m,contents:w};S.content_ids=b;if(t[r].FB&&h("AddToCart",S,e.id,a.external_id,{}),t[r].GA4){var P={...f};y("add_to_cart",P)}if(t[r].GADS&&null!=t[r].GADSATC&&c){d("set","user_data",a);var q=[],x="shopify_GB_"+e.data.cartLine.merchandise.product.id+"_"+e.data.cartLine.merchandise.id;q.push({id:x,price:p,quantity:e.data.cartLine.quantity}),d("event","conversion",{send_to:t[r].GADSID+"/"+t[r].GADSATC,value:m,currency:_,items:q})}if(t[r].TT){var L=[],V={content_id:D,content_name:e.data.cartLine.merchandise.product.title,quantity:e.data.cartLine.quantity,price:p};L.push(V),g("AddToCart",{contents:L,content_type:"product",currency:_,value:m})}if(t[r].PT){var B=[],E={product_name:e.data.cartLine.merchandise.product.title,product_id:e.data.cartLine.merchandise.id,product_variant_id:e.data.cartLine.merchandise.product.id,product_variant:e.data.cartLine.merchandise.product.title,product_price:p,product_quantity:e.data.cartLine.quantity,product_brand:e.data.cartLine.merchandise.product.vendor};B.push(E);var F={event_id:e.id,currency:_,line_items:B};A("addtocart",F)}k(C(),"latestETMSec")}})),leafconnect_analytics.subscribe("checkout_started",(async e=>{var a=await G(e),i={};i.value=e.data.checkout.totalPrice.amount,i.currency=e.data.checkout.totalPrice.currencyCode,i.affiliation="Online Store";var n=P(e,"custom/begin_checkout");i.items=n;var o=e.data.checkout,u={currency:o.currencyCode,content_type:"product",value:parseFloat(o.totalPrice.amount)},s=[],l=[];o.lineItems.forEach((function(t){var e=t.variant.id?t.variant.id:t.variant.product.id;s.push({id:e,quantity:t.quantity,item_price:t.variant.price.amount}),l.push(e)})),u.contents=s,window.dataLayer.push({pageType:"Initiate Checkout",event:"initiate_checkout",event_id:e.id,external_id:a.external_id,url:e.context.document.location.href,ecommerce:{value:parseFloat(o.totalPrice.amount),currency:o.currencyCode,affiliation:"Online Store",items:n}}),u.content_ids=l;if(t[r].FB&&h("InitiateCheckout",u,e.id,a.external_id,{}),t[r].GA4){var _={...i};y("begin_checkout",_)}if(t[r].GADS&&null!=t[r].GADSIC&&c){d("set","user_data",a);var p=[];n.forEach((function(t){var e="shopify_GB_"+t.item_shopify_id+"_"+t.item_shopify_variant;p.push({id:e,price:t.price,quantity:t.quantity})})),d("event","conversion",{send_to:t[r].GADSID+"/"+t[r].GADSIC,value:parseFloat(o.totalPrice.amount),currency:o.currencyCode,items:p})}if(t[r].TT){var m=[];n.forEach((function(t){var e=t.item_shopify_variant?t.item_shopify_variant:t.item_shopify_id;m.push({content_id:e,content_name:t.item_name,price:t.price,quantity:t.quantity})}));var v={contents:m,content_type:"product",currency:o.currencyCode,value:parseFloat(o.totalPrice.amount)};g("InitiateCheckout",v)}k(C(),"latestETMSec")})),leafconnect_analytics.subscribe("checkout_completed",(async e=>{var a=e.data.checkout.billingAddress.firstName?e.data.checkout.billingAddress.firstName.toLowerCase():null,i=e.data.checkout.billingAddress.lastName?e.data.checkout.billingAddress.lastName.toLowerCase():null,n=e.data.checkout.billingAddress.city?e.data.checkout.billingAddress.city.replace(/ /g,"").toLowerCase():null,o=e.data.checkout.billingAddress.province?e.data.checkout.billingAddress.province.replace(/ /g,"").toLowerCase():null,u=e.data.checkout.billingAddress.zip?e.data.checkout.billingAddress.zip.replace(/ /g,"").replace("-","").toLowerCase():null,s=e.data.checkout.billingAddress.country?e.data.checkout.billingAddress.country.toLowerCase():null,l=await G(e),_={first_name:a,last_name:i,default_address:{full_name:a+i,first_name:a,last_name:i,address1:e.data.checkout.billingAddress.address1,city:n,province:o,province_code:e.data.checkout.billingAddress.provinceCode,zip:u,country:s,country_code:e.data.checkout.billingAddress.countryCode}};if(e.data.checkout.billingAddress.address2&&(_.default_address.address2=e.data.checkout.billingAddress.address2),e.data.checkout.email&&(_.email=e.data.checkout.email.toLowerCase()),e.data.checkout.billingAddress.phone){var p=e.data.checkout.billingAddress.phone.replace("+","");_.default_address.phone=p}var m={content_type:"product",currency:e.data.checkout.totalPrice.currencyCode,value:e.data.checkout.totalPrice.amount},v=[],f=[];e.data.checkout.lineItems.forEach((function(t){var e=t.variant.id?t.variant.id:t.variant.product.id;v.push({id:e,quantity:t.quantity}),f.push(e)})),m.contents=v;var g=e.data.checkout.order.id.split("/"),A=g[g.length-1],w="payment_method_not_available";e.data.checkout.transactions&&e.data.checkout.transactions[0]&&e.data.checkout.transactions[0].gateway&&(w=e.data.checkout.transactions[0].gateway);var D=P(e,"purchase"),T=e.data.checkout.shippingLine.price.amount?e.data.checkout.shippingLine.price.amount:0,b={transaction_number:A,transaction_id:A,affiliation:"Online Store",gateway:w,currency:e.data.checkout.totalPrice.currencyCode,value:e.data.checkout.totalPrice.amount,tax:e.data.checkout.totalTax.amount,transaction_subtotal:e.data.checkout.subtotalPrice.amount,shipping:T,items:D};if(window.dataLayer.push({pageType:"Thank You Page",event:"purchase",event_id:A,external_id:l.external_id,url:e.context.document.location.href,ecommerce:{transaction_number:A,transaction_id:A,affiliation:"Online Store",gateway:w,currency:e.data.checkout.totalPrice.currencyCode,value:e.data.checkout.totalPrice.amount,tax:e.data.checkout.totalTax.amount,transaction_subtotal:e.data.checkout.subtotalPrice.amount,shipping:T,items:D},customer:_}),m.content_ids=f,m.content_name="Thank You",t[r].FB&&h("Purchase",m,A,l.external_id,_),t[r].GA4){var S={...b};y("purchase",S)}if(t[r].GADS&&null!=t[r].GADSP&&c){d("set","user_data",l);var I=[];D.forEach((function(t){var e="shopify_GB_"+t.item_shopify_id+"_"+t.item_shopify_variant;I.push({id:e,price:t.price,quantity:t.quantity})})),d("event","conversion",{send_to:t[r].GADSID+"/"+t[r].GADSP,value:e.data.checkout.totalPrice.amount,currency:e.data.checkout.totalPrice.currencyCode,transaction_id:A,items:I})}if(t[r].TT){var q=[];D.forEach((function(t){var e=t.item_shopify_variant?t.item_shopify_variant:t.item_shopify_id;q.push({content_id:e,content_name:t.item_name,price:t.price,quantity:t.quantity})}));var x={contents:q,content_type:"product",currency:e.data.checkout.totalPrice.currencyCode,value:e.data.checkout.totalPrice.amount};ttq.track("CompletePayment",x)}if(t[r].PT){var L=[];D.forEach((function(t){L.push({product_name:t.item_name,product_id:t.item_shopify_id,product_variant_id:t.item_shopify_variant,product_variant:t.item_name,product_price:t.price,product_quantity:t.quantity,product_brand:t.item_brand})})),pintrk("track","checkout",{event_id:e.id,value:e.data.checkout.totalPrice.amount,currency:e.data.checkout.totalPrice.currencyCode,line_items:L})}k(C(),"latestETMSec")}))}));
!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){"use strict";"undefined"==typeof leafconnect_analytics&&(leafconnect_analytics={}),"undefined"==typeof leafconnect_browser&&(leafconnect_browser={});var t={"andrea-development-extensibility.myshopify.com":{FB:!0,FBID:"1473426379889073",GA4:!0,GA4ID:"G-QC2R6N47SR",GADS:!0,GADSID:"AW-16733937504",GADSPV:"uABpCJuF6fIZEOC-rqs-",GADSVI:"Sc7LCJ6F6fIZEOC-rqs-",GADSATC:"W-ZvCJWF6fIZEOC-rqs-",GADSIC:"HwINCJiF6fIZEOC-rqs-",GADSP:"ZRi6CJKF6fIZEOC-rqs-",PT:!0,PTID:"2613625049372",TT:!0,TTID:"C9AAA0BC77UB71TGNRA0",CMV2:!0,GTM:!0,GTMID:"GTM-KQX5BSXM"},"kev-checkout-extensibility.myshopify.com":{FB:!0,FBID:"1473426379889073",GA4:!0,GA4ID:"G-QC2R6N47SR",GADS:!0,GADSID:"AW-16733937504",GADSPV:"uABpCJuF6fIZEOC-rqs-",GADSVI:"Sc7LCJ6F6fIZEOC-rqs-",GADSATC:"W-ZvCJWF6fIZEOC-rqs-",GADSIC:"HwINCJiF6fIZEOC-rqs-",GADSP:"ZRi6CJKF6fIZEOC-rqs-",PT:!0,PTID:"2613625049372",TT:!0,TTID:"C9A087BC77UB71TGNRA0",CMV2:!0,GTM:!0,GTMID:"GTM-KQX5BSXM"},domain3:{FB:!1,FBID:"",GA4:!0,GA4ID:"G-12378988876",GADS:!0,GADSID:"AW-4444567891",GADSPV:"",GADSVI:"",GADSATC:"",GADSIC:"",GADSP:"",PT:!1,PTID:"",TT:!0,TTID:"C9A087BC77UB71TGNRA0",CMV2:!1,GTM:!0,GTMID:"GTM-234567890"}},e=[];function a(t){console.log("saving function type ",typeof t),e.push(t)}var i=init;const n=i.context?.document;var r=n.location.host;i.customerPrivacy;var c=i.customerPrivacy.marketingAllowed,o=i.customerPrivacy.analyticsProcessingAllowed;let d;if(api.customerPrivacy.subscribe("visitorConsentCollected",(t=>{var a=t.customerPrivacy;console.log("customerPrivacyStatus ... ",a),e.forEach((function(t){console.log("eventFunction ",t),t()})),e=[]})),t[r].GA4){var u="https://www.googletagmanager.com/gtag/js?id="+t[r].GA4ID;const e=document.createElement("script");e.setAttribute("src",u),e.setAttribute("async",""),document.head.appendChild(e),window.dataLayer=window.dataLayer||[],d=function(){dataLayer.push(arguments)},d("js",new Date),d("config",t[r].GA4ID,{send_page_view:!1,page_location:n?.location?.href,page_referrer:n?.referrer,page_title:n?.title})}if(t[r].CMV2&&(d("consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}),d("consent","update",{ad_storage:c?"granted":"denied",analytics_storage:o?"granted":"denied",ad_user_data:c?"granted":"denied",ad_personalization:c?"granted":"denied"})),t[r].GADS){var s="https://www.googletagmanager.com/gtag/js?id="+t[r].GADSID;const e=document.createElement("script");e.setAttribute("src",s),e.setAttribute("async",""),document.head.appendChild(e),window.dataLayer=window.dataLayer||[],d=function(){dataLayer.push(arguments)},d("js",new Date),d("config",t[r].GADSID,{page_location:n?.location?.href,page_referrer:n?.referrer,page_title:n?.title})}var l,_,p,m,v,f;let h,y,g,A;t[r].GTM&&function(t,e,a,i,n){t[i]=t[i]||[],t[i].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var r=e.getElementsByTagName(a)[0],c=e.createElement(a);c.async=!0,c.src="https://www.googletagmanager.com/gtm.js?id="+n,r.parentNode.insertBefore(c,r)}(window,document,"script","dataLayer",t[r].GTMID),t[r].FB&&c&&(l=window,_=document,p="script",l.fbq||(m=l.fbq=function(){m.callMethod?m.callMethod.apply(m,arguments):m.queue.push(arguments)},l._fbq||(l._fbq=m),m.push=m,m.loaded=!0,m.version="2.0",m.queue=[],(v=_.createElement(p)).async=!0,v.src="https://connect.facebook.net/en_US/fbevents.js",(f=_.getElementsByTagName(p)[0]).parentNode.insertBefore(v,f))),t[r].TT&&c&&function(e,a,i){e.TiktokAnalyticsObject=i;var n=e[i]=e[i]||[];n.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie"],n.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};for(var c=0;c<n.methods.length;c++)n.setAndDefer(n,n.methods[c]);n.instance=function(t){for(var e=n._i[t]||[],a=0;a<n.methods.length;a++)n.setAndDefer(e,n.methods[a]);return e},n.load=function(t,e){var a="https://analytics.tiktok.com/i18n/pixel/events.js";n._i=n._i||{},n._i[t]=[],n._i[t]._u=a,n._t=n._t||{},n._t[t]=+new Date,n._o=n._o||{},n._o[t]=e||{};var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=a+"?sdkid="+t+"&lib="+i;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(r,c)},n.load(t[r].TTID),n.page()}(window,document,"ttq"),t[r].PT&&c&&(!function(){if(!window.pintrk){window.pintrk=function(){window.pintrk.queue.push(Array.prototype.slice.call(arguments))};var t=window.pintrk;t.queue=[],t.version="3.0";var e=document.createElement("script");e.async=!0,e.src="https://s.pinimg.com/ct/core.js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(e,a)}}(),pintrk("load",t[r].PTID),pintrk("page")),t[r].FB&&(h=function(e,a,i,n,o){var d=function(t,e){var a={external_id:t};return Object.keys(e).length>0&&(a.em=e.email,a.fn=e.first_name,a.ln=e.last_name,a.ct=e.default_address.city,a.zp=e.default_address.zip,a.country=e.default_address.country_code),a}(n,o);t[r].FBID&&c&&(fbq("init",t[r].FBID,d),fbq("trackSingle",t[r].FBID,e,a,{eventID:i}))}),t[r].GA4&&(y=function(t,e){d("event",t,e)}),t[r].TT&&(g=function(t,e){c&&ttq.track(t,e)}),t[r].PT&&(A=function(t,e){c&&pintrk("track",t,e)});const w=()=>Math.random().toString(36).substring(2);function k(t,e){const a=new Date;a.setTime(a.getTime()+31536e6);var i="expires="+a.toUTCString();leafconnect_browser.cookie.set(e+"="+t+"; "+i+"; path=/")}async function D(){var t=await leafconnect_browser.cookie.get("connect_cid");t&&""!==t||k(w()+w(),"connect_cid")}async function T(t){return await leafconnect_browser.cookie.get(t)}function C(){return Math.floor(Date.now()/1e3)}async function G(e){var a=await T("connect_cid"),i=(await T("_ga")).split(".").splice(2,3).join("."),n="";if(t[r].GA4){var c="_ga_"+t[r].GA4ID.split("-")[1],o=await T(c);o&&o.split(".").length>3&&(n=o.split(".")[2])}var d=await T("_fbp"),u=null;d&&""!==d&&(u=d);var s=await T("_fbc"),l=null;s&&""!==s&&(l=s);var _=await async function(){var t=await T("latestETMSec"),e=C();if(!t||""===t)return k(e,"latestETMSec"),1;var a=e-t;return 0===a?1:a}();return{cid:i,ga_session_id:n,external_id:a,fbp:u,fbc:l,page_referrer:e.context.document.referrer||e.context.document.location.origin,engagement_time_msec:_,user_agent:e.context.navigator.userAgent}}function b(t){t=t.toLowerCase().split(" ");for(var e=0;e<t.length;e++)t[e]=t[e].charAt(0).toUpperCase()+t[e].slice(1);return t.join(" ")}function S(t){var e={};if(t.length>1&&t.includes("collections"))if("collections"!==t[0]){var a=t.slice(1);e.item_list_id=a.join("_"),e.item_list_name=b(a.join(" "))}else e.item_list_id=t.join("_"),e.item_list_name=b(t.join(" "));else e.item_list_id=t.join("_"),e.item_list_name=b(t.join(" "));return e}function I(t,e){var a,i=t.replace(e,""),n="";if(i.includes("?")){var r=i.indexOf("?");n=i.slice(0,r)}else n=i;return a=n.length,n.length>1&&"/"==n.charAt(a-1)?S((n=n.slice(1,-1)).split("/")):n.length<=1?{item_list_id:"home",item_list_name:"Home"}:S((n=n.slice(1)).split("/"))}function P(t,e){var a,i,n=[],r=I(t.context.document.referrer,t.context.document.location.origin);return a=r.item_list_id,i=r.item_list_name,t.data.checkout.lineItems.forEach((function(t){var r={item_id:t.variant.sku?t.variant.sku:t.variant.product.id,item_shopify_id:t.variant.product.id,item_shopify_variant:t.variant.id,item_name:t.title,item_variant:t.variant.title||"default title",currency:t.variant.price.currencyCode,price:t.variant.price.amount,item_brand:t.variant.product.vendor,item_list_id:a,item_list_name:i,image_url:t.variant.image.src,quantity:t.quantity};"custom/update_checkout"===e&&(r.sku=t.variant.sku?t.variant.sku:t.variant.product.id,r.product_id=t.variant.product.id,r.variant_id=t.variant.id,r.title=t.variant.product.title,r.variant_title=t.variant.title,r.vendor=t.variant.product.vendor),n.push(r)})),n}leafconnect_analytics.subscribe("page_viewed",(async e=>{if(!e.context.window.location.href.includes("processing")){await D();var i=await G(e),n={},o={};if(t[r].FB&&(h("PageView",n,e.id,i.external_id,o),a((()=>h("PageView",n,e.id,i.external_id,o)))),t[r].GA4){var u={page_location:e.context.window.location.href,page_title:e.context.document.title};y("page_view",u)}t[r].GADS&&null!=t[r].GADSPV&&c&&(d("set","user_data",i),d("event","conversion",{send_to:t[r].GADSID+"/"+t[r].GADSPV})),k(C(),"latestETMSec"),window.dataLayer.push({event:"page_view",event_id:e.id,external_id:i.external_id,url:e.context.document.location.href,page_title:e.context.document.title})}})),leafconnect_analytics.subscribe("product_viewed",(async e=>{var i=await G(e),n=e.data.productVariant.title;""===n&&(n="Default Title");var o=e.context.document.referrer,u=e.context.document.location.origin,s=e.context.document.location.protocol,l=e.context.document.location.href,_=I(o,u),p=_.item_list_id,m=_.item_list_name,v=s+e.data.productVariant.image.src,f=e.data.productVariant.price.currencyCode,w=e.data.productVariant.price.amount,D=e.data.productVariant.sku;""===D&&(D=e.data.productVariant.product.id);var T={currency:f,value:w,affiliation:"Online Store",items:[{item_id:D,item_shopify_id:e.data.productVariant.product.id,item_shopify_variant:e.data.productVariant.id,item_name:e.data.productVariant.product.title,item_variant:n,currency:f,price:w,item_brand:e.data.productVariant.product.vendor,item_list_id:p,item_list_name:m,image_url:v,product_url:l}]};window.dataLayer.push({pageType:"Product",event:"view_item",event_id:e.id,external_id:i.external_id,url:e.context.document.location.href,ecommerce:T});var b=[],S=e.data.productVariant.id||e.data.productVariant.sku,P={id:S,quantity:1},q=[S];b.push(P);var x={content_type:"product",currency:f,value:w,contents:b};x.content_ids=q;var L={};if(t[r].FB&&(h("ViewContent",x,e.id,i.external_id,L),a((()=>h("ViewContent",x,e.id,i.external_id,L)))),t[r].GA4){var V={...T};y("view_item",V)}if(t[r].GADS&&null!=t[r].GADSVI&&c){d("set","user_data",i);var B=[],E="shopify_GB_"+e.data.productVariant.product.id+"_"+e.data.productVariant.id;B.push({id:E,price:w,quantity:1}),d("event","conversion",{send_to:t[r].GADS+"/"+t[r].GADSVI,value:w,currency:f,items:B})}if(t[r].TT){var F=[],M={content_id:S,content_name:e.data.productVariant.product.title,quantity:1,price:w};F.push(M);var j={contents:F,content_type:"product",currency:f,value:w};g("ViewContent",j),a((()=>g("ViewContent",j)))}if(t[r].PT){var N=[],O={product_name:e.data.productVariant.product.title,product_id:e.data.productVariant.product.id,product_variant_id:S,product_variant:n,product_price:w,product_quantity:1,product_brand:e.data.productVariant.product.vendor};N.push(O);var Z={event_id:e.id,currency:f,line_items:N};A("pagevisit",Z),a((()=>A("pagevisit",Z)))}k(C(),"latestETMSec")})),leafconnect_analytics.subscribe("product_added_to_cart",(async e=>{if(""!==e.clientId){var a=await G(e),i=e.context.document.referrer,n=e.context.document.location.origin,o=n+e.data.cartLine.merchandise.product.url,u=I(i,n),s=u.item_list_id,l=u.item_list_name,_=e.data.cartLine.merchandise.price.currencyCode,p=e.data.cartLine.merchandise.price.amount,m=e.data.cartLine.cost.totalAmount.amount,v=e.data.cartLine.merchandise.sku;""===v&&(v=e.data.cartLine.merchandise.product.id);var f={currency:_,value:m,affiliation:"Online Store",items:[{item_id:v,item_shopify_id:e.data.cartLine.merchandise.product.id,item_shopify_variant:e.data.cartLine.merchandise.id,item_name:e.data.cartLine.merchandise.product.title,item_variant:"Default Variant Title",currency:_,price:p,quantity:e.data.cartLine.quantity,item_brand:e.data.cartLine.merchandise.product.vendor,item_list_id:s,item_list_name:l,image_url:e.data.cartLine.merchandise.image.src,product_url:o}]};window.dataLayer.push({pageType:"Product",event:"add_to_cart",event_id:e.id,external_id:a.external_id,url:e.context.document.location.href,ecommerce:f});var w=[],D=e.data.cartLine.merchandise.id||e.data.cartLine.merchandise.sku,T={id:D,quantity:e.data.cartLine.quantity},b=[D];w.push(T);var S={content_type:"product",currency:_,value:m,contents:w};S.content_ids=b;if(t[r].FB&&h("AddToCart",S,e.id,a.external_id,{}),t[r].GA4){var P={...f};y("add_to_cart",P)}if(t[r].GADS&&null!=t[r].GADSATC&&c){d("set","user_data",a);var q=[],x="shopify_GB_"+e.data.cartLine.merchandise.product.id+"_"+e.data.cartLine.merchandise.id;q.push({id:x,price:p,quantity:e.data.cartLine.quantity}),d("event","conversion",{send_to:t[r].GADSID+"/"+t[r].GADSATC,value:m,currency:_,items:q})}if(t[r].TT){var L=[],V={content_id:D,content_name:e.data.cartLine.merchandise.product.title,quantity:e.data.cartLine.quantity,price:p};L.push(V),g("AddToCart",{contents:L,content_type:"product",currency:_,value:m})}if(t[r].PT){var B=[],E={product_name:e.data.cartLine.merchandise.product.title,product_id:e.data.cartLine.merchandise.id,product_variant_id:e.data.cartLine.merchandise.product.id,product_variant:e.data.cartLine.merchandise.product.title,product_price:p,product_quantity:e.data.cartLine.quantity,product_brand:e.data.cartLine.merchandise.product.vendor};B.push(E);var F={event_id:e.id,currency:_,line_items:B};A("addtocart",F)}k(C(),"latestETMSec")}})),leafconnect_analytics.subscribe("checkout_started",(async e=>{var a=await G(e),i={};i.value=e.data.checkout.totalPrice.amount,i.currency=e.data.checkout.totalPrice.currencyCode,i.affiliation="Online Store";var n=P(e,"custom/begin_checkout");i.items=n;var o=e.data.checkout,u={currency:o.currencyCode,content_type:"product",value:parseFloat(o.totalPrice.amount)},s=[],l=[];o.lineItems.forEach((function(t){var e=t.variant.id?t.variant.id:t.variant.product.id;s.push({id:e,quantity:t.quantity,item_price:t.variant.price.amount}),l.push(e)})),u.contents=s,window.dataLayer.push({pageType:"Initiate Checkout",event:"initiate_checkout",event_id:e.id,external_id:a.external_id,url:e.context.document.location.href,ecommerce:{value:parseFloat(o.totalPrice.amount),currency:o.currencyCode,affiliation:"Online Store",items:n}}),u.content_ids=l;if(t[r].FB&&h("InitiateCheckout",u,e.id,a.external_id,{}),t[r].GA4){var _={...i};y("begin_checkout",_)}if(t[r].GADS&&null!=t[r].GADSIC&&c){d("set","user_data",a);var p=[];n.forEach((function(t){var e="shopify_GB_"+t.item_shopify_id+"_"+t.item_shopify_variant;p.push({id:e,price:t.price,quantity:t.quantity})})),d("event","conversion",{send_to:t[r].GADSID+"/"+t[r].GADSIC,value:parseFloat(o.totalPrice.amount),currency:o.currencyCode,items:p})}if(t[r].TT){var m=[];n.forEach((function(t){var e=t.item_shopify_variant?t.item_shopify_variant:t.item_shopify_id;m.push({content_id:e,content_name:t.item_name,price:t.price,quantity:t.quantity})}));var v={contents:m,content_type:"product",currency:o.currencyCode,value:parseFloat(o.totalPrice.amount)};g("InitiateCheckout",v)}k(C(),"latestETMSec")})),leafconnect_analytics.subscribe("checkout_completed",(async e=>{var a=e.data.checkout.billingAddress.firstName?e.data.checkout.billingAddress.firstName.toLowerCase():null,i=e.data.checkout.billingAddress.lastName?e.data.checkout.billingAddress.lastName.toLowerCase():null,n=e.data.checkout.billingAddress.city?e.data.checkout.billingAddress.city.replace(/ /g,"").toLowerCase():null,o=e.data.checkout.billingAddress.province?e.data.checkout.billingAddress.province.replace(/ /g,"").toLowerCase():null,u=e.data.checkout.billingAddress.zip?e.data.checkout.billingAddress.zip.replace(/ /g,"").replace("-","").toLowerCase():null,s=e.data.checkout.billingAddress.country?e.data.checkout.billingAddress.country.toLowerCase():null,l=await G(e),_={first_name:a,last_name:i,default_address:{full_name:a+i,first_name:a,last_name:i,address1:e.data.checkout.billingAddress.address1,city:n,province:o,province_code:e.data.checkout.billingAddress.provinceCode,zip:u,country:s,country_code:e.data.checkout.billingAddress.countryCode}};if(e.data.checkout.billingAddress.address2&&(_.default_address.address2=e.data.checkout.billingAddress.address2),e.data.checkout.email&&(_.email=e.data.checkout.email.toLowerCase()),e.data.checkout.billingAddress.phone){var p=e.data.checkout.billingAddress.phone.replace("+","");_.default_address.phone=p}var m={content_type:"product",currency:e.data.checkout.totalPrice.currencyCode,value:e.data.checkout.totalPrice.amount},v=[],f=[];e.data.checkout.lineItems.forEach((function(t){var e=t.variant.id?t.variant.id:t.variant.product.id;v.push({id:e,quantity:t.quantity}),f.push(e)})),m.contents=v;var g=e.data.checkout.order.id.split("/"),A=g[g.length-1],w="payment_method_not_available";e.data.checkout.transactions&&e.data.checkout.transactions[0]&&e.data.checkout.transactions[0].gateway&&(w=e.data.checkout.transactions[0].gateway);var D=P(e,"purchase"),T=e.data.checkout.shippingLine.price.amount?e.data.checkout.shippingLine.price.amount:0,b={transaction_number:A,transaction_id:A,affiliation:"Online Store",gateway:w,currency:e.data.checkout.totalPrice.currencyCode,value:e.data.checkout.totalPrice.amount,tax:e.data.checkout.totalTax.amount,transaction_subtotal:e.data.checkout.subtotalPrice.amount,shipping:T,items:D};if(window.dataLayer.push({pageType:"Thank You Page",event:"purchase",event_id:A,external_id:l.external_id,url:e.context.document.location.href,ecommerce:{transaction_number:A,transaction_id:A,affiliation:"Online Store",gateway:w,currency:e.data.checkout.totalPrice.currencyCode,value:e.data.checkout.totalPrice.amount,tax:e.data.checkout.totalTax.amount,transaction_subtotal:e.data.checkout.subtotalPrice.amount,shipping:T,items:D},customer:_}),m.content_ids=f,m.content_name="Thank You",t[r].FB&&h("Purchase",m,A,l.external_id,_),t[r].GA4){var S={...b};y("purchase",S)}if(t[r].GADS&&null!=t[r].GADSP&&c){d("set","user_data",l);var I=[];D.forEach((function(t){var e="shopify_GB_"+t.item_shopify_id+"_"+t.item_shopify_variant;I.push({id:e,price:t.price,quantity:t.quantity})})),d("event","conversion",{send_to:t[r].GADSID+"/"+t[r].GADSP,value:e.data.checkout.totalPrice.amount,currency:e.data.checkout.totalPrice.currencyCode,transaction_id:A,items:I})}if(t[r].TT){var q=[];D.forEach((function(t){var e=t.item_shopify_variant?t.item_shopify_variant:t.item_shopify_id;q.push({content_id:e,content_name:t.item_name,price:t.price,quantity:t.quantity})}));var x={contents:q,content_type:"product",currency:e.data.checkout.totalPrice.currencyCode,value:e.data.checkout.totalPrice.amount};ttq.track("CompletePayment",x)}if(t[r].PT){var L=[];D.forEach((function(t){L.push({product_name:t.item_name,product_id:t.item_shopify_id,product_variant_id:t.item_shopify_variant,product_variant:t.item_name,product_price:t.price,product_quantity:t.quantity,product_brand:t.item_brand})})),pintrk("track","checkout",{event_id:e.id,value:e.data.checkout.totalPrice.amount,currency:e.data.checkout.totalPrice.currencyCode,line_items:L})}k(C(),"latestETMSec")}))}));
{
"name": "@leaffm/automatic-script-test",
"version": "1.0.1",
"version": "1.0.2",
"description": "Leaf's tracking script",

@@ -5,0 +5,0 @@ "module": "dist/index.esm.min.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc