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
1
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.4 to 1.0.5

2

dist/index.esm.min.js

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

"undefined"==typeof leafconnect_analytics&&(leafconnect_analytics={}),"undefined"==typeof leafconnect_browser&&(leafconnect_browser={}),"undefined"==typeof leafconnect_init&&(leafconnect_init={}),"undefined"==typeof leafconnect_api&&(leafconnect_api={});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)}const i=leafconnect_init.context?.document;var n=i.location.host;leafconnect_init.customerPrivacy;var r=leafconnect_init.customerPrivacy.marketingAllowed,c=leafconnect_init.customerPrivacy.analyticsProcessingAllowed;let o;if(leafconnect_api.customerPrivacy.subscribe("visitorConsentCollected",(t=>{var a=t.customerPrivacy;console.log("customerPrivacyStatus ... ",a),e.forEach((function(t){console.log("eventFunction ",t),t()})),e=[]})),t[n].GA4){var d="https://www.googletagmanager.com/gtag/js?id="+t[n].GA4ID;const e=document.createElement("script");e.setAttribute("src",d),e.setAttribute("async",""),document.head.appendChild(e),window.dataLayer=window.dataLayer||[],o=function(){dataLayer.push(arguments)},o("js",new Date),o("config",t[n].GA4ID,{send_page_view:!1,page_location:i?.location?.href,page_referrer:i?.referrer,page_title:i?.title})}if(t[n].CMV2&&(o("consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}),o("consent","update",{ad_storage:r?"granted":"denied",analytics_storage:c?"granted":"denied",ad_user_data:r?"granted":"denied",ad_personalization:r?"granted":"denied"})),t[n].GADS){var u="https://www.googletagmanager.com/gtag/js?id="+t[n].GADSID;const e=document.createElement("script");e.setAttribute("src",u),e.setAttribute("async",""),document.head.appendChild(e),window.dataLayer=window.dataLayer||[],o=function(){dataLayer.push(arguments)},o("js",new Date),o("config",t[n].GADSID,{page_location:i?.location?.href,page_referrer:i?.referrer,page_title:i?.title})}var s,l,_,p,m,f;let v,h,y,g;t[n].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[n].GTMID),t[n].FB&&r&&(s=window,l=document,_="script",s.fbq||(p=s.fbq=function(){p.callMethod?p.callMethod.apply(p,arguments):p.queue.push(arguments)},s._fbq||(s._fbq=p),p.push=p,p.loaded=!0,p.version="2.0",p.queue=[],(m=l.createElement(_)).async=!0,m.src="https://connect.facebook.net/en_US/fbevents.js",(f=l.getElementsByTagName(_)[0]).parentNode.insertBefore(m,f))),t[n].TT&&r&&function(e,a,i){e.TiktokAnalyticsObject=i;var r=e[i]=e[i]||[];r.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie"],r.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};for(var c=0;c<r.methods.length;c++)r.setAndDefer(r,r.methods[c]);r.instance=function(t){for(var e=r._i[t]||[],a=0;a<r.methods.length;a++)r.setAndDefer(e,r.methods[a]);return e},r.load=function(t,e){var a="https://analytics.tiktok.com/i18n/pixel/events.js";r._i=r._i||{},r._i[t]=[],r._i[t]._u=a,r._t=r._t||{},r._t[t]=+new Date,r._o=r._o||{},r._o[t]=e||{};var n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src=a+"?sdkid="+t+"&lib="+i;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(n,c)},r.load(t[n].TTID),r.page()}(window,document,"ttq"),t[n].PT&&r&&(!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[n].PTID),pintrk("page")),t[n].FB&&(v=function(e,a,i,c,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}(c,o);t[n].FBID&&r&&(fbq("init",t[n].FBID,d),fbq("trackSingle",t[n].FBID,e,a,{eventID:i}))}),t[n].GA4&&(h=function(t,e){o("event",t,e)}),t[n].TT&&(y=function(t,e){r&&ttq.track(t,e)}),t[n].PT&&(g=function(t,e){r&&pintrk("track",t,e)});const A=()=>Math.random().toString(36).substring(2);function w(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 k(){var t=await leafconnect_browser.cookie.get("connect_cid");t&&""!==t||w(A()+A(),"connect_cid")}async function D(t){return await leafconnect_browser.cookie.get(t)}function T(){return Math.floor(Date.now()/1e3)}async function C(e){var a=await D("connect_cid"),i=(await D("_ga")).split(".").splice(2,3).join("."),r="";if(t[n].GA4){var c="_ga_"+t[n].GA4ID.split("-")[1],o=await D(c);o&&o.split(".").length>3&&(r=o.split(".")[2])}var d=await D("_fbp"),u=null;d&&""!==d&&(u=d);var s=await D("_fbc"),l=null;s&&""!==s&&(l=s);var _=await async function(){var t=await D("latestETMSec"),e=T();if(!t||""===t)return w(e,"latestETMSec"),1;var a=e-t;return 0===a?1:a}();return{cid:i,ga_session_id:r,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 G(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 b(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=G(a.join(" "))}else e.item_list_id=t.join("_"),e.item_list_name=G(t.join(" "));else e.item_list_id=t.join("_"),e.item_list_name=G(t.join(" "));return e}function S(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)?b((n=n.slice(1,-1)).split("/")):n.length<=1?{item_list_id:"home",item_list_name:"Home"}:b((n=n.slice(1)).split("/"))}function I(t,e){var a,i,n=[],r=S(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 k();var i=await C(e),c={},d={};if(t[n].FB&&(v("PageView",c,e.id,i.external_id,d),a((()=>v("PageView",c,e.id,i.external_id,d)))),t[n].GA4){var u={page_location:e.context.window.location.href,page_title:e.context.document.title};h("page_view",u)}t[n].GADS&&null!=t[n].GADSPV&&r&&(o("set","user_data",i),o("event","conversion",{send_to:t[n].GADSID+"/"+t[n].GADSPV})),w(T(),"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 C(e),c=e.data.productVariant.title;""===c&&(c="Default Title");var d=e.context.document.referrer,u=e.context.document.location.origin,s=e.context.document.location.protocol,l=e.context.document.location.href,_=S(d,u),p=_.item_list_id,m=_.item_list_name,f=s+e.data.productVariant.image.src,A=e.data.productVariant.price.currencyCode,k=e.data.productVariant.price.amount,D=e.data.productVariant.sku;""===D&&(D=e.data.productVariant.product.id);var G={currency:A,value:k,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:c,currency:A,price:k,item_brand:e.data.productVariant.product.vendor,item_list_id:p,item_list_name:m,image_url:f,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:G});var b=[],I=e.data.productVariant.id||e.data.productVariant.sku,P={id:I,quantity:1},q=[I];b.push(P);var x={content_type:"product",currency:A,value:k,contents:b};x.content_ids=q;var L={};if(t[n].FB&&(v("ViewContent",x,e.id,i.external_id,L),a((()=>v("ViewContent",x,e.id,i.external_id,L)))),t[n].GA4){var V={...G};h("view_item",V)}if(t[n].GADS&&null!=t[n].GADSVI&&r){o("set","user_data",i);var B=[],E="shopify_GB_"+e.data.productVariant.product.id+"_"+e.data.productVariant.id;B.push({id:E,price:k,quantity:1}),o("event","conversion",{send_to:t[n].GADS+"/"+t[n].GADSVI,value:k,currency:A,items:B})}if(t[n].TT){var F=[],M={content_id:I,content_name:e.data.productVariant.product.title,quantity:1,price:k};F.push(M);var j={contents:F,content_type:"product",currency:A,value:k};y("ViewContent",j),a((()=>y("ViewContent",j)))}if(t[n].PT){var N=[],O={product_name:e.data.productVariant.product.title,product_id:e.data.productVariant.product.id,product_variant_id:I,product_variant:c,product_price:k,product_quantity:1,product_brand:e.data.productVariant.product.vendor};N.push(O);var Z={event_id:e.id,currency:A,line_items:N};g("pagevisit",Z),a((()=>g("pagevisit",Z)))}w(T(),"latestETMSec")})),leafconnect_analytics.subscribe("product_added_to_cart",(async e=>{if(""!==e.clientId){var a=await C(e),i=e.context.document.referrer,c=e.context.document.location.origin,d=c+e.data.cartLine.merchandise.product.url,u=S(i,c),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,f=e.data.cartLine.merchandise.sku;""===f&&(f=e.data.cartLine.merchandise.product.id);var A={currency:_,value:m,affiliation:"Online Store",items:[{item_id:f,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:d}]};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:A});var k=[],D=e.data.cartLine.merchandise.id||e.data.cartLine.merchandise.sku,G={id:D,quantity:e.data.cartLine.quantity},b=[D];k.push(G);var I={content_type:"product",currency:_,value:m,contents:k};I.content_ids=b;if(t[n].FB&&v("AddToCart",I,e.id,a.external_id,{}),t[n].GA4){var P={...A};h("add_to_cart",P)}if(t[n].GADS&&null!=t[n].GADSATC&&r){o("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}),o("event","conversion",{send_to:t[n].GADSID+"/"+t[n].GADSATC,value:m,currency:_,items:q})}if(t[n].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),y("AddToCart",{contents:L,content_type:"product",currency:_,value:m})}if(t[n].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};g("addtocart",F)}w(T(),"latestETMSec")}})),leafconnect_analytics.subscribe("checkout_started",(async e=>{var a=await C(e),i={};i.value=e.data.checkout.totalPrice.amount,i.currency=e.data.checkout.totalPrice.currencyCode,i.affiliation="Online Store";var c=I(e,"custom/begin_checkout");i.items=c;var d=e.data.checkout,u={currency:d.currencyCode,content_type:"product",value:parseFloat(d.totalPrice.amount)},s=[],l=[];d.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(d.totalPrice.amount),currency:d.currencyCode,affiliation:"Online Store",items:c}}),u.content_ids=l;if(t[n].FB&&v("InitiateCheckout",u,e.id,a.external_id,{}),t[n].GA4){var _={...i};h("begin_checkout",_)}if(t[n].GADS&&null!=t[n].GADSIC&&r){o("set","user_data",a);var p=[];c.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})})),o("event","conversion",{send_to:t[n].GADSID+"/"+t[n].GADSIC,value:parseFloat(d.totalPrice.amount),currency:d.currencyCode,items:p})}if(t[n].TT){var m=[];c.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 f={contents:m,content_type:"product",currency:d.currencyCode,value:parseFloat(d.totalPrice.amount)};y("InitiateCheckout",f)}w(T(),"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,c=e.data.checkout.billingAddress.city?e.data.checkout.billingAddress.city.replace(/ /g,"").toLowerCase():null,d=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 C(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:c,province:d,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},f=[],y=[];e.data.checkout.lineItems.forEach((function(t){var e=t.variant.id?t.variant.id:t.variant.product.id;f.push({id:e,quantity:t.quantity}),y.push(e)})),m.contents=f;var g=e.data.checkout.order.id.split("/"),A=g[g.length-1],k="payment_method_not_available";e.data.checkout.transactions&&e.data.checkout.transactions[0]&&e.data.checkout.transactions[0].gateway&&(k=e.data.checkout.transactions[0].gateway);var D=I(e,"purchase"),G=e.data.checkout.shippingLine.price.amount?e.data.checkout.shippingLine.price.amount:0,b={transaction_number:A,transaction_id:A,affiliation:"Online Store",gateway:k,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:G,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:k,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:G,items:D},customer:_}),m.content_ids=y,m.content_name="Thank You",t[n].FB&&v("Purchase",m,A,l.external_id,_),t[n].GA4){var S={...b};h("purchase",S)}if(t[n].GADS&&null!=t[n].GADSP&&r){o("set","user_data",l);var P=[];D.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})})),o("event","conversion",{send_to:t[n].GADSID+"/"+t[n].GADSP,value:e.data.checkout.totalPrice.amount,currency:e.data.checkout.totalPrice.currencyCode,transaction_id:A,items:P})}if(t[n].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[n].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})}w(T(),"latestETMSec")}));
"undefined"==typeof leafconnect_analytics&&(leafconnect_analytics={}),"undefined"==typeof leafconnect_browser&&(leafconnect_browser={}),"undefined"==typeof leafconnect_init&&(leafconnect_init={}),"undefined"==typeof leafconnect_api&&(leafconnect_api={});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:"C9A087BC77UB71TGNRA0",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:!0,FBID:"1234526379889073",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"}},e=[];function a(t){console.log("saving function type ",typeof t),e.push(t)}const i=leafconnect_init.context?.document;var n=i.location.host;leafconnect_init.customerPrivacy;var r=leafconnect_init.customerPrivacy.marketingAllowed,c=leafconnect_init.customerPrivacy.analyticsProcessingAllowed;leafconnect_api.customerPrivacy.subscribe("visitorConsentCollected",(t=>{var a=t.customerPrivacy;console.log("customerPrivacyStatus ... ",a),e.forEach((function(t){console.log("eventFunction ",t),t()})),e=[]}));var o="https://www.googletagmanager.com/gtag/js?id="+t[n].GA4ID;const d=document.createElement("script");function u(){dataLayer.push(arguments)}d.setAttribute("src",o),d.setAttribute("async",""),document.head.appendChild(d),window.dataLayer=window.dataLayer||[],u("js",new Date),u("config",t[n].GA4ID,{send_page_view:!1,page_location:i?.location?.href,page_referrer:i?.referrer,page_title:i?.title}),t[n].CMV2&&(u("consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}),u("consent","update",{ad_storage:r?"granted":"denied",analytics_storage:c?"granted":"denied",ad_user_data:r?"granted":"denied",ad_personalization:r?"granted":"denied"}));var s="https://www.googletagmanager.com/gtag/js?id="+t[n].GADSID;const l=document.createElement("script");var _,p,m,f,v,h;function y(e,a,i,c,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}(c,o);t[n].FBID&&r&&(fbq("init",t[n].FBID,d),fbq("trackSingle",t[n].FBID,e,a,{eventID:i}))}function g(t,e){u("event",t,e)}function A(t,e){r&&ttq.track(t,e)}function k(t,e){r&&pintrk("track",t,e)}l.setAttribute("src",s),l.setAttribute("async",""),document.head.appendChild(l),u("js",new Date),u("config",t[n].GADSID,{page_location:i?.location?.href,page_referrer:i?.referrer,page_title:i?.title}),t[n].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[n].GTMID),_=window,p=document,m="script",_.fbq||(f=_.fbq=function(){f.callMethod?f.callMethod.apply(f,arguments):f.queue.push(arguments)},_._fbq||(_._fbq=f),f.push=f,f.loaded=!0,f.version="2.0",f.queue=[],(v=p.createElement(m)).async=!0,v.src="https://connect.facebook.net/en_US/fbevents.js",(h=p.getElementsByTagName(m)[0]).parentNode.insertBefore(v,h)),t[n].TT&&r&&function(e,a,i){e.TiktokAnalyticsObject=i;var r=e[i]=e[i]||[];r.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie"],r.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};for(var c=0;c<r.methods.length;c++)r.setAndDefer(r,r.methods[c]);r.instance=function(t){for(var e=r._i[t]||[],a=0;a<r.methods.length;a++)r.setAndDefer(e,r.methods[a]);return e},r.load=function(t,e){var a="https://analytics.tiktok.com/i18n/pixel/events.js";r._i=r._i||{},r._i[t]=[],r._i[t]._u=a,r._t=r._t||{},r._t[t]=+new Date,r._o=r._o||{},r._o[t]=e||{};var n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src=a+"?sdkid="+t+"&lib="+i;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(n,c)},r.load(t[n].TTID),r.page()}(window,document,"ttq"),t[n].PT&&r&&(!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[n].PTID),pintrk("page"));const w=()=>Math.random().toString(36).substring(2);function C(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||C(w()+w(),"connect_cid")}async function T(t){return await leafconnect_browser.cookie.get(t)}function G(){return Math.floor(Date.now()/1e3)}async function b(e){var a=await T("connect_cid"),i=(await T("_ga")).split(".").splice(2,3).join("."),r="";if(t[n].GA4){var c="_ga_"+t[n].GA4ID.split("-")[1],o=await T(c);o&&o.split(".").length>3&&(r=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=G();if(!t||""===t)return C(e,"latestETMSec"),1;var a=e-t;return 0===a?1:a}();return{cid:i,ga_session_id:r,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 S(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 I(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=S(a.join(" "))}else e.item_list_id=t.join("_"),e.item_list_name=S(t.join(" "));else e.item_list_id=t.join("_"),e.item_list_name=S(t.join(" "));return e}function q(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)?I((n=n.slice(1,-1)).split("/")):n.length<=1?{item_list_id:"home",item_list_name:"Home"}:I((n=n.slice(1)).split("/"))}function P(t,e){var a,i,n=[],r=q(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 b(e),c={},o={};if(t[n].FB&&(y("PageView",c,e.id,i.external_id,o),a((()=>y("PageView",c,e.id,i.external_id,o)))),t[n].GA4)g("page_view",{page_location:e.context.window.location.href,page_title:e.context.document.title});t[n].GADS&&null!=t[n].GADSPV&&r&&(u("set","user_data",i),u("event","conversion",{send_to:t[n].GADSID+"/"+t[n].GADSPV})),C(G(),"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 b(e),c=e.data.productVariant.title;""===c&&(c="Default Title");var o=e.context.document.referrer,d=e.context.document.location.origin,s=e.context.document.location.protocol,l=e.context.document.location.href,_=q(o,d),p=_.item_list_id,m=_.item_list_name,f=s+e.data.productVariant.image.src,v=e.data.productVariant.price.currencyCode,h=e.data.productVariant.price.amount,w=e.data.productVariant.sku;""===w&&(w=e.data.productVariant.product.id);var D={currency:v,value:h,affiliation:"Online Store",items:[{item_id:w,item_shopify_id:e.data.productVariant.product.id,item_shopify_variant:e.data.productVariant.id,item_name:e.data.productVariant.product.title,item_variant:c,currency:v,price:h,item_brand:e.data.productVariant.product.vendor,item_list_id:p,item_list_name:m,image_url:f,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:D});var T=[],S=e.data.productVariant.id||e.data.productVariant.sku,I={id:S,quantity:1},P=[S];T.push(I);var x={content_type:"product",currency:v,value:h,contents:T};x.content_ids=P;var L={};(t[n].FB&&(y("ViewContent",x,e.id,i.external_id,L),a((()=>y("ViewContent",x,e.id,i.external_id,L)))),t[n].GA4)&&g("view_item",{...D});if(t[n].GADS&&null!=t[n].GADSVI&&r){u("set","user_data",i);var E=[],V="shopify_GB_"+e.data.productVariant.product.id+"_"+e.data.productVariant.id;E.push({id:V,price:h,quantity:1}),u("event","conversion",{send_to:t[n].GADS+"/"+t[n].GADSVI,value:h,currency:v,items:E})}if(t[n].TT){var B=[],F={content_id:S,content_name:e.data.productVariant.product.title,quantity:1,price:h};B.push(F);var M={contents:B,content_type:"product",currency:v,value:h};A("ViewContent",M),a((()=>A("ViewContent",M)))}if(t[n].PT){var O=[],N={product_name:e.data.productVariant.product.title,product_id:e.data.productVariant.product.id,product_variant_id:S,product_variant:c,product_price:h,product_quantity:1,product_brand:e.data.productVariant.product.vendor};O.push(N);var Z={event_id:e.id,currency:v,line_items:O};k("pagevisit",Z),a((()=>k("pagevisit",Z)))}C(G(),"latestETMSec")})),leafconnect_analytics.subscribe("product_added_to_cart",(async e=>{if(""!==e.clientId){var a=await b(e),i=e.context.document.referrer,c=e.context.document.location.origin,o=c+e.data.cartLine.merchandise.product.url,d=q(i,c),s=d.item_list_id,l=d.item_list_name,_=e.data.cartLine.merchandise.price.currencyCode,p=e.data.cartLine.merchandise.price.amount,m=e.data.cartLine.cost.totalAmount.amount,f=e.data.cartLine.merchandise.sku;""===f&&(f=e.data.cartLine.merchandise.product.id);var v={currency:_,value:m,affiliation:"Online Store",items:[{item_id:f,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:v});var h=[],w=e.data.cartLine.merchandise.id||e.data.cartLine.merchandise.sku,D={id:w,quantity:e.data.cartLine.quantity},T=[w];h.push(D);var S={content_type:"product",currency:_,value:m,contents:h};S.content_ids=T;if(t[n].FB&&y("AddToCart",S,e.id,a.external_id,{}),t[n].GA4)g("add_to_cart",{...v});if(t[n].GADS&&null!=t[n].GADSATC&&r){u("set","user_data",a);var I=[],P="shopify_GB_"+e.data.cartLine.merchandise.product.id+"_"+e.data.cartLine.merchandise.id;I.push({id:P,price:p,quantity:e.data.cartLine.quantity}),u("event","conversion",{send_to:t[n].GADSID+"/"+t[n].GADSATC,value:m,currency:_,items:I})}if(t[n].TT){var x=[],L={content_id:w,content_name:e.data.cartLine.merchandise.product.title,quantity:e.data.cartLine.quantity,price:p};x.push(L),A("AddToCart",{contents:x,content_type:"product",currency:_,value:m})}if(t[n].PT){var E=[],V={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};E.push(V),k("addtocart",{event_id:e.id,currency:_,line_items:E})}C(G(),"latestETMSec")}})),leafconnect_analytics.subscribe("checkout_started",(async e=>{var a=await b(e),i={};i.value=e.data.checkout.totalPrice.amount,i.currency=e.data.checkout.totalPrice.currencyCode,i.affiliation="Online Store";var c=P(e,"custom/begin_checkout");i.items=c;var o=e.data.checkout,d={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)})),d.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:c}}),d.content_ids=l;(t[n].FB&&y("InitiateCheckout",d,e.id,a.external_id,{}),t[n].GA4)&&g("begin_checkout",{...i});if(t[n].GADS&&null!=t[n].GADSIC&&r){u("set","user_data",a);var _=[];c.forEach((function(t){var e="shopify_GB_"+t.item_shopify_id+"_"+t.item_shopify_variant;_.push({id:e,price:t.price,quantity:t.quantity})})),u("event","conversion",{send_to:t[n].GADSID+"/"+t[n].GADSIC,value:parseFloat(o.totalPrice.amount),currency:o.currencyCode,items:_})}if(t[n].TT){var p=[];c.forEach((function(t){var e=t.item_shopify_variant?t.item_shopify_variant:t.item_shopify_id;p.push({content_id:e,content_name:t.item_name,price:t.price,quantity:t.quantity})})),A("InitiateCheckout",{contents:p,content_type:"product",currency:o.currencyCode,value:parseFloat(o.totalPrice.amount)})}C(G(),"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,c=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,d=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 b(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:c,province:o,province_code:e.data.checkout.billingAddress.provinceCode,zip:d,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},f=[],v=[];e.data.checkout.lineItems.forEach((function(t){var e=t.variant.id?t.variant.id:t.variant.product.id;f.push({id:e,quantity:t.quantity}),v.push(e)})),m.contents=f;var h=e.data.checkout.order.id.split("/"),A=h[h.length-1],k="payment_method_not_available";e.data.checkout.transactions&&e.data.checkout.transactions[0]&&e.data.checkout.transactions[0].gateway&&(k=e.data.checkout.transactions[0].gateway);var w=P(e,"purchase"),D=e.data.checkout.shippingLine.price.amount?e.data.checkout.shippingLine.price.amount:0,T={transaction_number:A,transaction_id:A,affiliation:"Online Store",gateway:k,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:D,items:w};(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:k,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:D,items:w},customer:_}),m.content_ids=v,m.content_name="Thank You",t[n].FB&&y("Purchase",m,A,l.external_id,_),t[n].GA4)&&g("purchase",{...T});if(t[n].GADS&&null!=t[n].GADSP&&r){u("set","user_data",l);var S=[];w.forEach((function(t){var e="shopify_GB_"+t.item_shopify_id+"_"+t.item_shopify_variant;S.push({id:e,price:t.price,quantity:t.quantity})})),u("event","conversion",{send_to:t[n].GADSID+"/"+t[n].GADSP,value:e.data.checkout.totalPrice.amount,currency:e.data.checkout.totalPrice.currencyCode,transaction_id:A,items:S})}if(t[n].TT){var I=[];w.forEach((function(t){var e=t.item_shopify_variant?t.item_shopify_variant:t.item_shopify_id;I.push({content_id:e,content_name:t.item_name,price:t.price,quantity:t.quantity})}));var q={contents:I,content_type:"product",currency:e.data.checkout.totalPrice.currencyCode,value:e.data.checkout.totalPrice.amount};ttq.track("CompletePayment",q)}if(t[n].PT){var x=[];w.forEach((function(t){x.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:x})}C(G(),"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={}),"undefined"==typeof leafconnect_init&&(leafconnect_init={}),"undefined"==typeof leafconnect_api&&(leafconnect_api={});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)}const i=leafconnect_init.context?.document;var n=i.location.host;leafconnect_init.customerPrivacy;var r=leafconnect_init.customerPrivacy.marketingAllowed,c=leafconnect_init.customerPrivacy.analyticsProcessingAllowed;let o;if(leafconnect_api.customerPrivacy.subscribe("visitorConsentCollected",(t=>{var a=t.customerPrivacy;console.log("customerPrivacyStatus ... ",a),e.forEach((function(t){console.log("eventFunction ",t),t()})),e=[]})),t[n].GA4){var d="https://www.googletagmanager.com/gtag/js?id="+t[n].GA4ID;const e=document.createElement("script");e.setAttribute("src",d),e.setAttribute("async",""),document.head.appendChild(e),window.dataLayer=window.dataLayer||[],o=function(){dataLayer.push(arguments)},o("js",new Date),o("config",t[n].GA4ID,{send_page_view:!1,page_location:i?.location?.href,page_referrer:i?.referrer,page_title:i?.title})}if(t[n].CMV2&&(o("consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}),o("consent","update",{ad_storage:r?"granted":"denied",analytics_storage:c?"granted":"denied",ad_user_data:r?"granted":"denied",ad_personalization:r?"granted":"denied"})),t[n].GADS){var u="https://www.googletagmanager.com/gtag/js?id="+t[n].GADSID;const e=document.createElement("script");e.setAttribute("src",u),e.setAttribute("async",""),document.head.appendChild(e),window.dataLayer=window.dataLayer||[],o=function(){dataLayer.push(arguments)},o("js",new Date),o("config",t[n].GADSID,{page_location:i?.location?.href,page_referrer:i?.referrer,page_title:i?.title})}var s,l,_,p,m,f;let v,h,y,g;t[n].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[n].GTMID),t[n].FB&&r&&(s=window,l=document,_="script",s.fbq||(p=s.fbq=function(){p.callMethod?p.callMethod.apply(p,arguments):p.queue.push(arguments)},s._fbq||(s._fbq=p),p.push=p,p.loaded=!0,p.version="2.0",p.queue=[],(m=l.createElement(_)).async=!0,m.src="https://connect.facebook.net/en_US/fbevents.js",(f=l.getElementsByTagName(_)[0]).parentNode.insertBefore(m,f))),t[n].TT&&r&&function(e,a,i){e.TiktokAnalyticsObject=i;var r=e[i]=e[i]||[];r.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie"],r.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};for(var c=0;c<r.methods.length;c++)r.setAndDefer(r,r.methods[c]);r.instance=function(t){for(var e=r._i[t]||[],a=0;a<r.methods.length;a++)r.setAndDefer(e,r.methods[a]);return e},r.load=function(t,e){var a="https://analytics.tiktok.com/i18n/pixel/events.js";r._i=r._i||{},r._i[t]=[],r._i[t]._u=a,r._t=r._t||{},r._t[t]=+new Date,r._o=r._o||{},r._o[t]=e||{};var n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src=a+"?sdkid="+t+"&lib="+i;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(n,c)},r.load(t[n].TTID),r.page()}(window,document,"ttq"),t[n].PT&&r&&(!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[n].PTID),pintrk("page")),t[n].FB&&(v=function(e,a,i,c,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}(c,o);t[n].FBID&&r&&(fbq("init",t[n].FBID,d),fbq("trackSingle",t[n].FBID,e,a,{eventID:i}))}),t[n].GA4&&(h=function(t,e){o("event",t,e)}),t[n].TT&&(y=function(t,e){r&&ttq.track(t,e)}),t[n].PT&&(g=function(t,e){r&&pintrk("track",t,e)});const A=()=>Math.random().toString(36).substring(2);function w(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 k(){var t=await leafconnect_browser.cookie.get("connect_cid");t&&""!==t||w(A()+A(),"connect_cid")}async function D(t){return await leafconnect_browser.cookie.get(t)}function T(){return Math.floor(Date.now()/1e3)}async function C(e){var a=await D("connect_cid"),i=(await D("_ga")).split(".").splice(2,3).join("."),r="";if(t[n].GA4){var c="_ga_"+t[n].GA4ID.split("-")[1],o=await D(c);o&&o.split(".").length>3&&(r=o.split(".")[2])}var d=await D("_fbp"),u=null;d&&""!==d&&(u=d);var s=await D("_fbc"),l=null;s&&""!==s&&(l=s);var _=await async function(){var t=await D("latestETMSec"),e=T();if(!t||""===t)return w(e,"latestETMSec"),1;var a=e-t;return 0===a?1:a}();return{cid:i,ga_session_id:r,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 G(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 b(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=G(a.join(" "))}else e.item_list_id=t.join("_"),e.item_list_name=G(t.join(" "));else e.item_list_id=t.join("_"),e.item_list_name=G(t.join(" "));return e}function S(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)?b((n=n.slice(1,-1)).split("/")):n.length<=1?{item_list_id:"home",item_list_name:"Home"}:b((n=n.slice(1)).split("/"))}function I(t,e){var a,i,n=[],r=S(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 k();var i=await C(e),c={},d={};if(t[n].FB&&(v("PageView",c,e.id,i.external_id,d),a((()=>v("PageView",c,e.id,i.external_id,d)))),t[n].GA4){var u={page_location:e.context.window.location.href,page_title:e.context.document.title};h("page_view",u)}t[n].GADS&&null!=t[n].GADSPV&&r&&(o("set","user_data",i),o("event","conversion",{send_to:t[n].GADSID+"/"+t[n].GADSPV})),w(T(),"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 C(e),c=e.data.productVariant.title;""===c&&(c="Default Title");var d=e.context.document.referrer,u=e.context.document.location.origin,s=e.context.document.location.protocol,l=e.context.document.location.href,_=S(d,u),p=_.item_list_id,m=_.item_list_name,f=s+e.data.productVariant.image.src,A=e.data.productVariant.price.currencyCode,k=e.data.productVariant.price.amount,D=e.data.productVariant.sku;""===D&&(D=e.data.productVariant.product.id);var G={currency:A,value:k,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:c,currency:A,price:k,item_brand:e.data.productVariant.product.vendor,item_list_id:p,item_list_name:m,image_url:f,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:G});var b=[],I=e.data.productVariant.id||e.data.productVariant.sku,P={id:I,quantity:1},q=[I];b.push(P);var x={content_type:"product",currency:A,value:k,contents:b};x.content_ids=q;var L={};if(t[n].FB&&(v("ViewContent",x,e.id,i.external_id,L),a((()=>v("ViewContent",x,e.id,i.external_id,L)))),t[n].GA4){var V={...G};h("view_item",V)}if(t[n].GADS&&null!=t[n].GADSVI&&r){o("set","user_data",i);var B=[],E="shopify_GB_"+e.data.productVariant.product.id+"_"+e.data.productVariant.id;B.push({id:E,price:k,quantity:1}),o("event","conversion",{send_to:t[n].GADS+"/"+t[n].GADSVI,value:k,currency:A,items:B})}if(t[n].TT){var F=[],M={content_id:I,content_name:e.data.productVariant.product.title,quantity:1,price:k};F.push(M);var j={contents:F,content_type:"product",currency:A,value:k};y("ViewContent",j),a((()=>y("ViewContent",j)))}if(t[n].PT){var N=[],O={product_name:e.data.productVariant.product.title,product_id:e.data.productVariant.product.id,product_variant_id:I,product_variant:c,product_price:k,product_quantity:1,product_brand:e.data.productVariant.product.vendor};N.push(O);var Z={event_id:e.id,currency:A,line_items:N};g("pagevisit",Z),a((()=>g("pagevisit",Z)))}w(T(),"latestETMSec")})),leafconnect_analytics.subscribe("product_added_to_cart",(async e=>{if(""!==e.clientId){var a=await C(e),i=e.context.document.referrer,c=e.context.document.location.origin,d=c+e.data.cartLine.merchandise.product.url,u=S(i,c),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,f=e.data.cartLine.merchandise.sku;""===f&&(f=e.data.cartLine.merchandise.product.id);var A={currency:_,value:m,affiliation:"Online Store",items:[{item_id:f,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:d}]};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:A});var k=[],D=e.data.cartLine.merchandise.id||e.data.cartLine.merchandise.sku,G={id:D,quantity:e.data.cartLine.quantity},b=[D];k.push(G);var I={content_type:"product",currency:_,value:m,contents:k};I.content_ids=b;if(t[n].FB&&v("AddToCart",I,e.id,a.external_id,{}),t[n].GA4){var P={...A};h("add_to_cart",P)}if(t[n].GADS&&null!=t[n].GADSATC&&r){o("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}),o("event","conversion",{send_to:t[n].GADSID+"/"+t[n].GADSATC,value:m,currency:_,items:q})}if(t[n].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),y("AddToCart",{contents:L,content_type:"product",currency:_,value:m})}if(t[n].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};g("addtocart",F)}w(T(),"latestETMSec")}})),leafconnect_analytics.subscribe("checkout_started",(async e=>{var a=await C(e),i={};i.value=e.data.checkout.totalPrice.amount,i.currency=e.data.checkout.totalPrice.currencyCode,i.affiliation="Online Store";var c=I(e,"custom/begin_checkout");i.items=c;var d=e.data.checkout,u={currency:d.currencyCode,content_type:"product",value:parseFloat(d.totalPrice.amount)},s=[],l=[];d.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(d.totalPrice.amount),currency:d.currencyCode,affiliation:"Online Store",items:c}}),u.content_ids=l;if(t[n].FB&&v("InitiateCheckout",u,e.id,a.external_id,{}),t[n].GA4){var _={...i};h("begin_checkout",_)}if(t[n].GADS&&null!=t[n].GADSIC&&r){o("set","user_data",a);var p=[];c.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})})),o("event","conversion",{send_to:t[n].GADSID+"/"+t[n].GADSIC,value:parseFloat(d.totalPrice.amount),currency:d.currencyCode,items:p})}if(t[n].TT){var m=[];c.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 f={contents:m,content_type:"product",currency:d.currencyCode,value:parseFloat(d.totalPrice.amount)};y("InitiateCheckout",f)}w(T(),"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,c=e.data.checkout.billingAddress.city?e.data.checkout.billingAddress.city.replace(/ /g,"").toLowerCase():null,d=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 C(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:c,province:d,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},f=[],y=[];e.data.checkout.lineItems.forEach((function(t){var e=t.variant.id?t.variant.id:t.variant.product.id;f.push({id:e,quantity:t.quantity}),y.push(e)})),m.contents=f;var g=e.data.checkout.order.id.split("/"),A=g[g.length-1],k="payment_method_not_available";e.data.checkout.transactions&&e.data.checkout.transactions[0]&&e.data.checkout.transactions[0].gateway&&(k=e.data.checkout.transactions[0].gateway);var D=I(e,"purchase"),G=e.data.checkout.shippingLine.price.amount?e.data.checkout.shippingLine.price.amount:0,b={transaction_number:A,transaction_id:A,affiliation:"Online Store",gateway:k,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:G,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:k,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:G,items:D},customer:_}),m.content_ids=y,m.content_name="Thank You",t[n].FB&&v("Purchase",m,A,l.external_id,_),t[n].GA4){var S={...b};h("purchase",S)}if(t[n].GADS&&null!=t[n].GADSP&&r){o("set","user_data",l);var P=[];D.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})})),o("event","conversion",{send_to:t[n].GADSID+"/"+t[n].GADSP,value:e.data.checkout.totalPrice.amount,currency:e.data.checkout.totalPrice.currencyCode,transaction_id:A,items:P})}if(t[n].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[n].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})}w(T(),"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={}),"undefined"==typeof leafconnect_init&&(leafconnect_init={}),"undefined"==typeof leafconnect_api&&(leafconnect_api={});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:"C9A087BC77UB71TGNRA0",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:!0,FBID:"1234526379889073",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"}},e=[];function a(t){console.log("saving function type ",typeof t),e.push(t)}const i=leafconnect_init.context?.document;var n=i.location.host;leafconnect_init.customerPrivacy;var r=leafconnect_init.customerPrivacy.marketingAllowed,c=leafconnect_init.customerPrivacy.analyticsProcessingAllowed;leafconnect_api.customerPrivacy.subscribe("visitorConsentCollected",(t=>{var a=t.customerPrivacy;console.log("customerPrivacyStatus ... ",a),e.forEach((function(t){console.log("eventFunction ",t),t()})),e=[]}));var o="https://www.googletagmanager.com/gtag/js?id="+t[n].GA4ID;const d=document.createElement("script");function u(){dataLayer.push(arguments)}d.setAttribute("src",o),d.setAttribute("async",""),document.head.appendChild(d),window.dataLayer=window.dataLayer||[],u("js",new Date),u("config",t[n].GA4ID,{send_page_view:!1,page_location:i?.location?.href,page_referrer:i?.referrer,page_title:i?.title}),t[n].CMV2&&(u("consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}),u("consent","update",{ad_storage:r?"granted":"denied",analytics_storage:c?"granted":"denied",ad_user_data:r?"granted":"denied",ad_personalization:r?"granted":"denied"}));var s="https://www.googletagmanager.com/gtag/js?id="+t[n].GADSID;const l=document.createElement("script");var _,p,m,f,v,h;function y(e,a,i,c,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}(c,o);t[n].FBID&&r&&(fbq("init",t[n].FBID,d),fbq("trackSingle",t[n].FBID,e,a,{eventID:i}))}function g(t,e){u("event",t,e)}function A(t,e){r&&ttq.track(t,e)}function k(t,e){r&&pintrk("track",t,e)}l.setAttribute("src",s),l.setAttribute("async",""),document.head.appendChild(l),u("js",new Date),u("config",t[n].GADSID,{page_location:i?.location?.href,page_referrer:i?.referrer,page_title:i?.title}),t[n].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[n].GTMID),_=window,p=document,m="script",_.fbq||(f=_.fbq=function(){f.callMethod?f.callMethod.apply(f,arguments):f.queue.push(arguments)},_._fbq||(_._fbq=f),f.push=f,f.loaded=!0,f.version="2.0",f.queue=[],(v=p.createElement(m)).async=!0,v.src="https://connect.facebook.net/en_US/fbevents.js",(h=p.getElementsByTagName(m)[0]).parentNode.insertBefore(v,h)),t[n].TT&&r&&function(e,a,i){e.TiktokAnalyticsObject=i;var r=e[i]=e[i]||[];r.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie"],r.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};for(var c=0;c<r.methods.length;c++)r.setAndDefer(r,r.methods[c]);r.instance=function(t){for(var e=r._i[t]||[],a=0;a<r.methods.length;a++)r.setAndDefer(e,r.methods[a]);return e},r.load=function(t,e){var a="https://analytics.tiktok.com/i18n/pixel/events.js";r._i=r._i||{},r._i[t]=[],r._i[t]._u=a,r._t=r._t||{},r._t[t]=+new Date,r._o=r._o||{},r._o[t]=e||{};var n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src=a+"?sdkid="+t+"&lib="+i;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(n,c)},r.load(t[n].TTID),r.page()}(window,document,"ttq"),t[n].PT&&r&&(!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[n].PTID),pintrk("page"));const w=()=>Math.random().toString(36).substring(2);function C(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||C(w()+w(),"connect_cid")}async function T(t){return await leafconnect_browser.cookie.get(t)}function G(){return Math.floor(Date.now()/1e3)}async function b(e){var a=await T("connect_cid"),i=(await T("_ga")).split(".").splice(2,3).join("."),r="";if(t[n].GA4){var c="_ga_"+t[n].GA4ID.split("-")[1],o=await T(c);o&&o.split(".").length>3&&(r=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=G();if(!t||""===t)return C(e,"latestETMSec"),1;var a=e-t;return 0===a?1:a}();return{cid:i,ga_session_id:r,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 S(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 I(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=S(a.join(" "))}else e.item_list_id=t.join("_"),e.item_list_name=S(t.join(" "));else e.item_list_id=t.join("_"),e.item_list_name=S(t.join(" "));return e}function q(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)?I((n=n.slice(1,-1)).split("/")):n.length<=1?{item_list_id:"home",item_list_name:"Home"}:I((n=n.slice(1)).split("/"))}function P(t,e){var a,i,n=[],r=q(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 b(e),c={},o={};if(t[n].FB&&(y("PageView",c,e.id,i.external_id,o),a((()=>y("PageView",c,e.id,i.external_id,o)))),t[n].GA4)g("page_view",{page_location:e.context.window.location.href,page_title:e.context.document.title});t[n].GADS&&null!=t[n].GADSPV&&r&&(u("set","user_data",i),u("event","conversion",{send_to:t[n].GADSID+"/"+t[n].GADSPV})),C(G(),"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 b(e),c=e.data.productVariant.title;""===c&&(c="Default Title");var o=e.context.document.referrer,d=e.context.document.location.origin,s=e.context.document.location.protocol,l=e.context.document.location.href,_=q(o,d),p=_.item_list_id,m=_.item_list_name,f=s+e.data.productVariant.image.src,v=e.data.productVariant.price.currencyCode,h=e.data.productVariant.price.amount,w=e.data.productVariant.sku;""===w&&(w=e.data.productVariant.product.id);var D={currency:v,value:h,affiliation:"Online Store",items:[{item_id:w,item_shopify_id:e.data.productVariant.product.id,item_shopify_variant:e.data.productVariant.id,item_name:e.data.productVariant.product.title,item_variant:c,currency:v,price:h,item_brand:e.data.productVariant.product.vendor,item_list_id:p,item_list_name:m,image_url:f,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:D});var T=[],S=e.data.productVariant.id||e.data.productVariant.sku,I={id:S,quantity:1},P=[S];T.push(I);var x={content_type:"product",currency:v,value:h,contents:T};x.content_ids=P;var L={};(t[n].FB&&(y("ViewContent",x,e.id,i.external_id,L),a((()=>y("ViewContent",x,e.id,i.external_id,L)))),t[n].GA4)&&g("view_item",{...D});if(t[n].GADS&&null!=t[n].GADSVI&&r){u("set","user_data",i);var E=[],V="shopify_GB_"+e.data.productVariant.product.id+"_"+e.data.productVariant.id;E.push({id:V,price:h,quantity:1}),u("event","conversion",{send_to:t[n].GADS+"/"+t[n].GADSVI,value:h,currency:v,items:E})}if(t[n].TT){var B=[],F={content_id:S,content_name:e.data.productVariant.product.title,quantity:1,price:h};B.push(F);var M={contents:B,content_type:"product",currency:v,value:h};A("ViewContent",M),a((()=>A("ViewContent",M)))}if(t[n].PT){var O=[],N={product_name:e.data.productVariant.product.title,product_id:e.data.productVariant.product.id,product_variant_id:S,product_variant:c,product_price:h,product_quantity:1,product_brand:e.data.productVariant.product.vendor};O.push(N);var Z={event_id:e.id,currency:v,line_items:O};k("pagevisit",Z),a((()=>k("pagevisit",Z)))}C(G(),"latestETMSec")})),leafconnect_analytics.subscribe("product_added_to_cart",(async e=>{if(""!==e.clientId){var a=await b(e),i=e.context.document.referrer,c=e.context.document.location.origin,o=c+e.data.cartLine.merchandise.product.url,d=q(i,c),s=d.item_list_id,l=d.item_list_name,_=e.data.cartLine.merchandise.price.currencyCode,p=e.data.cartLine.merchandise.price.amount,m=e.data.cartLine.cost.totalAmount.amount,f=e.data.cartLine.merchandise.sku;""===f&&(f=e.data.cartLine.merchandise.product.id);var v={currency:_,value:m,affiliation:"Online Store",items:[{item_id:f,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:v});var h=[],w=e.data.cartLine.merchandise.id||e.data.cartLine.merchandise.sku,D={id:w,quantity:e.data.cartLine.quantity},T=[w];h.push(D);var S={content_type:"product",currency:_,value:m,contents:h};S.content_ids=T;if(t[n].FB&&y("AddToCart",S,e.id,a.external_id,{}),t[n].GA4)g("add_to_cart",{...v});if(t[n].GADS&&null!=t[n].GADSATC&&r){u("set","user_data",a);var I=[],P="shopify_GB_"+e.data.cartLine.merchandise.product.id+"_"+e.data.cartLine.merchandise.id;I.push({id:P,price:p,quantity:e.data.cartLine.quantity}),u("event","conversion",{send_to:t[n].GADSID+"/"+t[n].GADSATC,value:m,currency:_,items:I})}if(t[n].TT){var x=[],L={content_id:w,content_name:e.data.cartLine.merchandise.product.title,quantity:e.data.cartLine.quantity,price:p};x.push(L),A("AddToCart",{contents:x,content_type:"product",currency:_,value:m})}if(t[n].PT){var E=[],V={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};E.push(V),k("addtocart",{event_id:e.id,currency:_,line_items:E})}C(G(),"latestETMSec")}})),leafconnect_analytics.subscribe("checkout_started",(async e=>{var a=await b(e),i={};i.value=e.data.checkout.totalPrice.amount,i.currency=e.data.checkout.totalPrice.currencyCode,i.affiliation="Online Store";var c=P(e,"custom/begin_checkout");i.items=c;var o=e.data.checkout,d={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)})),d.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:c}}),d.content_ids=l;(t[n].FB&&y("InitiateCheckout",d,e.id,a.external_id,{}),t[n].GA4)&&g("begin_checkout",{...i});if(t[n].GADS&&null!=t[n].GADSIC&&r){u("set","user_data",a);var _=[];c.forEach((function(t){var e="shopify_GB_"+t.item_shopify_id+"_"+t.item_shopify_variant;_.push({id:e,price:t.price,quantity:t.quantity})})),u("event","conversion",{send_to:t[n].GADSID+"/"+t[n].GADSIC,value:parseFloat(o.totalPrice.amount),currency:o.currencyCode,items:_})}if(t[n].TT){var p=[];c.forEach((function(t){var e=t.item_shopify_variant?t.item_shopify_variant:t.item_shopify_id;p.push({content_id:e,content_name:t.item_name,price:t.price,quantity:t.quantity})})),A("InitiateCheckout",{contents:p,content_type:"product",currency:o.currencyCode,value:parseFloat(o.totalPrice.amount)})}C(G(),"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,c=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,d=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 b(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:c,province:o,province_code:e.data.checkout.billingAddress.provinceCode,zip:d,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},f=[],v=[];e.data.checkout.lineItems.forEach((function(t){var e=t.variant.id?t.variant.id:t.variant.product.id;f.push({id:e,quantity:t.quantity}),v.push(e)})),m.contents=f;var h=e.data.checkout.order.id.split("/"),A=h[h.length-1],k="payment_method_not_available";e.data.checkout.transactions&&e.data.checkout.transactions[0]&&e.data.checkout.transactions[0].gateway&&(k=e.data.checkout.transactions[0].gateway);var w=P(e,"purchase"),D=e.data.checkout.shippingLine.price.amount?e.data.checkout.shippingLine.price.amount:0,T={transaction_number:A,transaction_id:A,affiliation:"Online Store",gateway:k,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:D,items:w};(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:k,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:D,items:w},customer:_}),m.content_ids=v,m.content_name="Thank You",t[n].FB&&y("Purchase",m,A,l.external_id,_),t[n].GA4)&&g("purchase",{...T});if(t[n].GADS&&null!=t[n].GADSP&&r){u("set","user_data",l);var S=[];w.forEach((function(t){var e="shopify_GB_"+t.item_shopify_id+"_"+t.item_shopify_variant;S.push({id:e,price:t.price,quantity:t.quantity})})),u("event","conversion",{send_to:t[n].GADSID+"/"+t[n].GADSP,value:e.data.checkout.totalPrice.amount,currency:e.data.checkout.totalPrice.currencyCode,transaction_id:A,items:S})}if(t[n].TT){var I=[];w.forEach((function(t){var e=t.item_shopify_variant?t.item_shopify_variant:t.item_shopify_id;I.push({content_id:e,content_name:t.item_name,price:t.price,quantity:t.quantity})}));var q={contents:I,content_type:"product",currency:e.data.checkout.totalPrice.currencyCode,value:e.data.checkout.totalPrice.amount};ttq.track("CompletePayment",q)}if(t[n].PT){var x=[];w.forEach((function(t){x.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:x})}C(G(),"latestETMSec")}))}));
{
"name": "@leaffm/automatic-script-test",
"version": "1.0.4",
"version": "1.0.5",
"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