window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"context_data",page_location:init.con
text.document.location.href,page_referrer:init.context.document.referrer,page_title:init.context.documen
t.title,page_path:init.context.document.location.pathname,search_param:init.context.document.location.se
arch,hash_param:init.context.document.location.hash,language:init.context.navigator.language,screen_widt
h:init.context.window.outerWidth,screen_height:init.context.window.outerHeight,user_agent:init.context.n
avigator.userAgent});
//Put Your GTM Code Below
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXXXX');
//Mention the ads platform you want to track for in the below array.Example - ['Facebook','Snapchat'...]
var trackingPlatform = ["Facebook", "Pinterest", "Snapchat"];
var
page_view_fired=!1,checkout_contact_info_submitted_fired=!1,checkout_address_info_submitted_fired=!1,che
ckout_shipping_info_submitted_fired=!1,customerData={};function contextData(){let t,e,a;for(let
d=0;d{if(!page_view_fired){var
e=contextData()||{},a={event:"page_view",client_id:t.clientId,event_time:t.timestamp,event_time_seconds:
Math.round(new
Date(t.timestamp)/1e3)};window.dataLayer.push({...a,...e})}page_view_fired=!0}),analytics.subscribe("pro
duct_viewed",t=>{var
e=contextData()||{},a={event:"view_item",client_id:t.clientId,event_time:t.timestamp,event_time_seconds:
Math.round(new
Date(t.timestamp)/1e3),product_variant_id:[t.data.productVariant.id],product_sku:[t.data.productVariant.
sku],ecommerce:{currency:t.data.productVariant.price.currencyCode,value:t.data.productVariant.price.amou
nt,items:[{item_id:t.data.productVariant.product.id,item_name:t.data.productVariant.product.title,item_b
rand:t.data.productVariant.product.vendor,item_category:t.data.productVariant.product.type,item_variant:
t.data.productVariant.title?t.data.productVariant.title:"",price:t.data.productVariant.price.amount,quan
tity:1},]}};trackingPlatform.filter(t=>t.toLowerCase().includes("pinterest")).length>0&&(a.pt_browser_si
de={value:t.data.productVariant.price.amount,order_quantity:1,currency:t.data.productVariant.price.curre
ncyCode,line_items:[{product_name:t.data.productVariant.product.title,product_id:t.data.productVariant.p
roduct.id,product_variant_id:t.data.productVariant.id,product_category:t.data.productVariant.product.typ
e,product_brand:t.data.productVariant.product.vendor?t.data.productVariant.product.vendor:"",product_pri
ce:t.data.productVariant.price.amount,product_quantity:1},]}),trackingPlatform.filter(t=>t.toLowerCase()
.includes("snapchat")).length>0&&(a.snap_browser_side={price:t.data.productVariant.price.amount,currency
:t.data.productVariant.price.currencyCode,item_ids:[t.data.productVariant.product.id],item_category:t.da
ta.productVariant.product.type,brands:[t.data.productVariant.product.vendor].includes("")?"":[t.data.pro
ductVariant.product.vendor]}),trackingPlatform.filter(t=>t.toLowerCase().includes("facebook")).length>0&
&(a.fb_browser_side={content_ids:[t.data.productVariant.product.id],content_category:t.data.productVaria
nt.product.type,content_name:t.data.productVariant.product.title,content_type:"product",contents:[{id:t.
data.productVariant.product.id,quantity:1,item_price:t.data.productVariant.price.amount},],currency:t.da
ta.productVariant.price.currencyCode,value:t.data.productVariant.price.amount}),window.dataLayer.push({.
..a,...e})}),analytics.subscribe("product_added_to_cart",t=>{var
e=contextData()||{},a={event:"add_to_cart",client_id:t.clientId,event_time:t.timestamp,event_time_second
s:Math.round(new
Date(t.timestamp)/1e3),product_variant_id:[t.data.cartLine.merchandise.id],product_sku:[t.data.cartLine.
merchandise.sku],ecommerce:{currency:t.data.cartLine.cost.totalAmount.currencyCode,value:t.data.cartLine
.cost.totalAmount.amount,items:[{item_id:t.data.cartLine.merchandise.product.id,item_name:t.data.cartLin
e.merchandise.product.title,item_brand:t.data.cartLine.merchandise.product.vendor,item_category:t.data.c
artLine.merchandise.product.type,item_variant:t.data.cartLine.merchandise.title?t.data.cartLine.merchand
ise.title:"",price:t.data.cartLine.merchandise.price.amount,quantity:t.data.cartLine.quantity},]}};track
ingPlatform.filter(t=>t.toLowerCase().includes("facebook")).length>0&&(a.fb_browser_side={content_ids:[t
.data.cartLine.merchandise.product.id],content_category:t.data.cartLine.merchandise.product.type,content
_name:t.data.cartLine.merchandise.product.title,content_type:"product",contents:[{id:t.data.cartLine.mer
chandise.product.id,quantity:t.data.cartLine.quantity,item_price:t.data.cartLine.merchandise.price.amoun
t},],currency:t.data.cartLine.cost.totalAmount.currencyCode,value:t.data.cartLine.cost.totalAmount.amoun
t}),trackingPlatform.filter(t=>t.toLowerCase().includes("pinterest")).length>0&&(a.pt_browser_side={valu
e:t.data.cartLine.cost.totalAmount.amount,order_quantity:t.data.cartLine.quantity,currency:t.data.cartLi
ne.cost.totalAmount.currencyCode,line_items:[{product_name:t.data.cartLine.merchandise.product.title,pro
duct_id:t.data.cartLine.merchandise.product.id,product_variant_id:t.data.cartLine.merchandise.id,product
_category:t.data.cartLine.merchandise.product.type,product_brand:t.data.cartLine.merchandise.product.ven
dor?t.data.cartLine.merchandise.product.vendor:"",product_price:t.data.cartLine.merchandise.price.amount
,product_quantity:t.data.cartLine.quantity},]}),trackingPlatform.filter(t=>t.toLowerCase().includes("sna
pchat")).length>0&&(a.snap_browser_side={price:t.data.cartLine.cost.totalAmount.amount,currency:t.data.c
artLine.cost.totalAmount.currencyCode,item_ids:[t.data.cartLine.merchandise.product.id],item_category:t.
data.cartLine.merchandise.product.type,brands:[t.data.cartLine.merchandise.product.vendor].includes("")?
"":[t.data.cartLine.merchandise.product.vendor]}),window.dataLayer.push({...a,...e})}),analytics.subscri
be("product_removed_from_cart",t=>{var
e=contextData()||{},a={event:"remove_from_cart",client_id:t.clientId,event_time:t.timestamp,event_time_s
econds:Math.round(new
Date(t.timestamp)/1e3),product_variant_id:[t.data.cartLine.merchandise.id],product_sku:[t.data.cartLine.
merchandise.sku],ecommerce:{currency:t.data.cartLine.cost.totalAmount.currencyCode,value:t.data.cartLine
.cost.totalAmount.amount,items:[{item_id:t.data.cartLine.merchandise.product.id,item_name:t.data.cartLin
e.merchandise.product.title?t.data.cartLine.merchandise.product.title:t.data.cartLine.merchandise.produc
t.untranslatedTitle,item_brand:t.data.cartLine.merchandise.product.vendor,item_category:t.data.cartLine.
merchandise.product.type,item_variant:t.data.cartLine.merchandise.title?t.data.cartLine.merchandise.titl
e:"",price:t.data.cartLine.merchandise.price.amount,quantity:t.data.cartLine.quantity},]}};trackingPlatf
orm.filter(t=>t.toLowerCase().includes("facebook")).length>0&&(a.fb_browser_side={content_ids:[t.data.ca
rtLine.merchandise.product.id],content_category:t.data.cartLine.merchandise.product.type,content_name:t.
data.cartLine.merchandise.product.title?t.data.cartLine.merchandise.product.title:t.data.cartLine.mercha
ndise.product.untranslatedTitle,content_type:"product",contents:[{id:t.data.cartLine.merchandise.product
.id,quantity:t.data.cartLine.quantity,item_price:t.data.cartLine.merchandise.price.amount},],currency:t.
data.cartLine.cost.totalAmount.currencyCode,value:t.data.cartLine.cost.totalAmount.amount}),trackingPlat
form.filter(t=>t.toLowerCase().includes("pinterest")).length>0&&(a.pt_browser_side={value:t.data.cartLin
e.cost.totalAmount.amount,order_quantity:t.data.cartLine.quantity,currency:t.data.cartLine.cost.totalAmo
unt.currencyCode,line_items:[{product_name:t.data.cartLine.merchandise.product.title?t.data.cartLine.mer
chandise.product.title:t.data.cartLine.merchandise.product.untranslatedTitle,product_id:t.data.cartLine.
merchandise.product.id,product_variant_id:t.data.cartLine.merchandise.id,product_category:t.data.cartLin
e.merchandise.product.type,product_brand:t.data.cartLine.merchandise.product.vendor?t.data.cartLine.merc
handise.product.vendor:"",product_price:t.data.cartLine.merchandise.price.amount,product_quantity:t.data
.cartLine.quantity},]}),trackingPlatform.filter(t=>t.toLowerCase().includes("snapchat")).length>0&&(a.sn
ap_browser_side={price:t.data.cartLine.cost.totalAmount.amount,currency:t.data.cartLine.cost.totalAmount
.currencyCode,item_ids:[t.data.cartLine.merchandise.product.id],item_category:t.data.cartLine.merchandis
e.product.type,brands:[t.data.cartLine.merchandise.product.vendor].includes("")?"":[t.data.cartLine.merc
handise.product.vendor]}),window.dataLayer.push({...a,...e})}),analytics.subscribe("cart_viewed",t=>{var
e,a,d,c,i,r,o,n,s,u=contextData()||{},p={};if(null!==t.data.cart){var
h=t.data.cart.lines,l=h.map(t=>{var
e;return{item_id:t.merchandise.product.id,item_name:t.merchandise.product.title,item_brand:t.merchandise
.product.vendor,item_category:t.merchandise.product.type,item_variant:t.merchandise.title?t.merchandise.
title:"",price:t.merchandise.price.amount,quantity:t.quantity}});r=h.map(t=>{var
e;return{product_id:t.merchandise.product.id,product_name:t.merchandise.product.title,product_variant_id
:t.merchandise.id,product_brand:t.merchandise.product.vendor?t.merchandise.product.vendor:"",product_cat
egory:t.merchandise.product.type,product_price:t.merchandise.price.amount,product_quantity:t.quantity}})
,s=h.map(t=>t.merchandise.sku),n=h.map(t=>t.merchandise.id),a=h.map(t=>t.merchandise.product.id),d=h.map
(t=>t.merchandise.product.type).includes("")?"":h.map(t=>t.merchandise.product.type).join(),o=h.map(t=>t
.merchandise.product.vendor?t.merchandise.product.vendor:"").includes("")?"":h.map(t=>t.merchandise.prod
uct.vendor),c=h.map(t=>t.merchandise.product.title).join(),i=h.map(t=>{var
e;return{id:t.merchandise.product.id,quantity:t.quantity,item_price:t.merchandise.price.amount}}),p.curr
ency=t.data.cart.cost.totalAmount.currencyCode,p.value=t.data.cart.cost.totalAmount.amount,p.items=l}e={
event:"view_cart",client_id:t.clientId,event_time:t.timestamp,event_time_seconds:Math.round(new
Date(t.timestamp)/1e3),product_variant_id:n,product_sku:s,itemTotalQuantity:t.data.cart.totalQuantity,ec
ommerce:p},trackingPlatform.filter(t=>t.toLowerCase().includes("facebook")).length>0&&(e.fb_browser_side
={content_ids:a,content_category:d,content_name:c,content_type:"product",contents:i,currency:t.data.cart
.cost.totalAmount.currencyCode,value:t.data.cart.cost.totalAmount.amount,num_items:t.data.cart.totalQuan
tity}),trackingPlatform.filter(t=>t.toLowerCase().includes("pinterest")).length>0&&(e.pt_browser_side={v
alue:t.data.cart.cost.totalAmount.amount,order_quantity:t.data.cart.totalQuantity,currency:t.data.cart.c
ost.totalAmount.currencyCode,line_items:r}),trackingPlatform.filter(t=>t.toLowerCase().includes("snapcha
t")).length>0&&(e.snap_browser_side={price:t.data.cart.cost.totalAmount.amount,currency:t.data.cart.cost
.totalAmount.currencyCode,item_ids:a,item_category:d,brands:o,number_items:t.data.cart.totalQuantity}),w
indow.dataLayer.push({...e,...u})}),analytics.subscribe("checkout_started",t=>{var
e,a,d,c,i,r,o,n,s,u,p=contextData()||{},h={};if(null!==t.data.checkout){var
l=t.data.checkout.lineItems,m=l.map(t=>{var
e;return{item_id:t.variant.product.id,item_name:t.variant.product.title,item_brand:t.variant.product.ven
dor,item_category:t.variant.product.type,item_variant:t.variant.title?t.variant.title:"",price:t.variant
.price.amount,coupon:t.discountAllocations.length>0?t.discountAllocations[0].discountApplication.title:"
",quantity:t.quantity}});o=l.map(t=>{var
e;return{product_id:t.variant.product.id,product_name:t.variant.product.title,product_variant_id:t.varia
nt.id,product_brand:t.variant.product.vendor?t.variant.product.vendor:"",product_category:t.variant.prod
uct.type,product_price:t.variant.price.amount,product_quantity:t.quantity}}),u=l.map(t=>void
0===t.variant.sku?"":t.variant.sku),s=l.map(t=>t.variant.id),a=l.map(t=>t.variant.product.id),d=l.map(t=
>t.variant.product.type).includes("")?"":l.map(t=>t.variant.product.type).join(),n=l.map(t=>t.variant.pr
oduct.vendor?t.variant.product.vendor:"").includes("")?"":l.map(t=>t.variant.product.vendor),c=l.map(t=>
t.variant.product.title).join(),i=l.map(t=>{var
e;return{id:t.variant.product.id,quantity:t.quantity,item_price:t.variant.price.amount}}),r=l.reduce((t,
e)=>t+=e.quantity,0),h.currency=t.data.checkout.currencyCode,h.value=t.data.checkout.totalPrice.amount,h
.coupon=t.data.checkout.discountApplications.length>0?t.data.checkout.discountApplications[0].title:"",h
.items=m}e={event:"begin_checkout",client_id:t.clientId,event_time:t.timestamp,event_time_seconds:Math.r
ound(new
Date(t.timestamp)/1e3),product_variant_id:s,product_sku:u,itemTotalQuantity:r,total_tax:t.data.checkout.
totalTax.amount,subTotal_price:t.data.checkout.subtotalPrice.amount,shipping:t.data.checkout.shippingLin
e.price.amount?t.data.checkout.shippingLine.price.amount:"",transaction_id:t.data.checkout.order.id?t.da
ta.checkout.order.id:"",email:t.data.checkout.email?t.data.checkout.email:"",phone:t.data.checkout.phone
?t.data.checkout.phone:"",customer_address_Line1:t.data.checkout.shippingAddress.address1?t.data.checkou
t.shippingAddress.address1:t.data.checkout.billingAddress.address1,customer_address_Line2:t.data.checkou
t.shippingAddress.address2?t.data.checkout.shippingAddress.address2:t.data.checkout.billingAddress.addre
ss2,customer_city:t.data.checkout.shippingAddress.city?t.data.checkout.shippingAddress.city:t.data.check
out.billingAddress.city,customer_country:t.data.checkout.shippingAddress.country?t.data.checkout.shippin
gAddress.country:t.data.checkout.billingAddress.country,customer_countryCode:t.data.checkout.shippingAdd
ress.countryCode?t.data.checkout.shippingAddress.countryCode:t.data.checkout.billingAddress.countryCode,
customer_firstName:t.data.checkout.shippingAddress.firstName?t.data.checkout.shippingAddress.firstName:t
.data.checkout.billingAddress.firstName,customer_lastName:t.data.checkout.shippingAddress.lastName?t.dat
a.checkout.shippingAddress.lastName:t.data.checkout.billingAddress.lastName,customer_phoneNo:t.data.chec
kout.shippingAddress.phone?t.data.checkout.shippingAddress.phone:t.data.checkout.billingAddress.phone,cu
stomer_state:t.data.checkout.shippingAddress.province?t.data.checkout.shippingAddress.province:t.data.ch
eckout.billingAddress.province,customer_stateCode:t.data.checkout.shippingAddress.provinceCode?t.data.ch
eckout.shippingAddress.provinceCode:t.data.checkout.billingAddress.provinceCode,customer_zip:t.data.chec
kout.shippingAddress.zip?t.data.checkout.shippingAddress.zip:t.data.checkout.billingAddress.zip,ecommerc
e:h},trackingPlatform.filter(t=>t.toLowerCase().includes("facebook")).length>0&&(e.fb_browser_side={cont
ent_ids:a,content_category:d,content_name:c,content_type:"product",contents:i,currency:t.data.checkout.c
urrencyCode,value:t.data.checkout.totalPrice.amount,num_items:r}),trackingPlatform.filter(t=>t.toLowerCa
se().includes("pinterest")).length>0&&(e.pt_browser_side={value:t.data.checkout.totalPrice.amount,order_
quantity:r,currency:t.data.checkout.currencyCode,line_items:o}),trackingPlatform.filter(t=>t.toLowerCase
().includes("snapchat")).length>0&&(e.snap_browser_side={price:t.data.checkout.totalPrice.amount,currenc
y:t.data.checkout.currencyCode,item_ids:a,item_category:d,brands:n,number_items:r,payment_info_available
:1}),window.dataLayer.push({...e,...p})}),analytics.subscribe("checkout_contact_info_submitted",t=>{if(!
checkout_contact_info_submitted_fired){var
e,a,d,c,i,r,o,n,s,u,p=contextData()||{},h={};if(null!==t.data.checkout){var
l=t.data.checkout.lineItems,m=l.map(t=>{var
e;return{item_id:t.variant.product.id,item_name:t.variant.product.title,item_brand:t.variant.product.ven
dor,item_category:t.variant.product.type,item_variant:t.variant.title?t.variant.title:"",price:t.variant
.price.amount,coupon:t.discountAllocations.length>0?t.discountAllocations[0].discountApplication.title:"
",quantity:t.quantity}});o=l.map(t=>{var
e;return{product_id:t.variant.product.id,product_name:t.variant.product.title,product_variant_id:t.varia
nt.id,product_brand:t.variant.product.vendor?t.variant.product.vendor:"",product_category:t.variant.prod
uct.type,product_price:t.variant.price.amount,product_quantity:t.quantity}}),u=l.map(t=>void
0===t.variant.sku?"":t.variant.sku),s=l.map(t=>t.variant.id),a=l.map(t=>t.variant.product.id),d=l.map(t=
>t.variant.product.type).includes("")?"":l.map(t=>t.variant.product.type).join(),n=l.map(t=>t.variant.pr
oduct.vendor?t.variant.product.vendor:"").includes("")?"":l.map(t=>t.variant.product.vendor),c=l.map(t=>
t.variant.product.title).join(),i=l.map(t=>{var
e;return{id:t.variant.product.id,quantity:t.quantity,item_price:t.variant.price.amount}}),r=l.reduce((t,
e)=>t+=e.quantity,0),h.currency=t.data.checkout.currencyCode,h.value=t.data.checkout.totalPrice.amount,h
.coupon=t.data.checkout.discountApplications.length>0?t.data.checkout.discountApplications[0].title:"",h
.items=m}e={event:"checkout_contact_info_submitted",client_id:t.clientId,event_time:t.timestamp,event_ti
me_seconds:Math.round(new
Date(t.timestamp)/1e3),product_variant_id:s,product_sku:u,itemTotalQuantity:r,total_tax:t.data.checkout.
totalTax.amount,subTotal_price:t.data.checkout.subtotalPrice.amount,shipping:t.data.checkout.shippingLin
e.price.amount?t.data.checkout.shippingLine.price.amount:"",transaction_id:t.data.checkout.order.id?t.da
ta.checkout.order.id:"",email:t.data.checkout.email?t.data.checkout.email:"",phone:t.data.checkout.phone
?t.data.checkout.phone:"",customer_address_Line1:t.data.checkout.shippingAddress.address1?t.data.checkou
t.shippingAddress.address1:t.data.checkout.billingAddress.address1,customer_address_Line2:t.data.checkou
t.shippingAddress.address2?t.data.checkout.shippingAddress.address2:t.data.checkout.billingAddress.addre
ss2,customer_city:t.data.checkout.shippingAddress.city?t.data.checkout.shippingAddress.city:t.data.check
out.billingAddress.city,customer_country:t.data.checkout.shippingAddress.country?t.data.checkout.shippin
gAddress.country:t.data.checkout.billingAddress.country,customer_countryCode:t.data.checkout.shippingAdd
ress.countryCode?t.data.checkout.shippingAddress.countryCode:t.data.checkout.billingAddress.countryCode,
customer_firstName:t.data.checkout.shippingAddress.firstName?t.data.checkout.shippingAddress.firstName:t
.data.checkout.billingAddress.firstName,customer_lastName:t.data.checkout.shippingAddress.lastName?t.dat
a.checkout.shippingAddress.lastName:t.data.checkout.billingAddress.lastName,customer_phoneNo:t.data.chec
kout.shippingAddress.phone?t.data.checkout.shippingAddress.phone:t.data.checkout.billingAddress.phone,cu
stomer_state:t.data.checkout.shippingAddress.province?t.data.checkout.shippingAddress.province:t.data.ch
eckout.billingAddress.province,customer_stateCode:t.data.checkout.shippingAddress.provinceCode?t.data.ch
eckout.shippingAddress.provinceCode:t.data.checkout.billingAddress.provinceCode,customer_zip:t.data.chec
kout.shippingAddress.zip?t.data.checkout.shippingAddress.zip:t.data.checkout.billingAddress.zip,ecommerc
e:h},trackingPlatform.filter(t=>t.toLowerCase().includes("facebook")).length>0&&(e.fb_browser_side={cont
ent_ids:a,content_category:d,content_name:c,content_type:"product",contents:i,currency:t.data.checkout.c
urrencyCode,value:t.data.checkout.totalPrice.amount,num_items:r}),trackingPlatform.filter(t=>t.toLowerCa
se().includes("pinterest")).length>0&&(e.pt_browser_side={value:t.data.checkout.totalPrice.amount,order_
quantity:r,currency:t.data.checkout.currencyCode,line_items:o}),trackingPlatform.filter(t=>t.toLowerCase
().includes("snapchat")).length>0&&(e.snap_browser_side={price:t.data.checkout.totalPrice.amount,currenc
y:t.data.checkout.currencyCode,item_ids:a,item_category:d,brands:n,number_items:r,payment_info_available
:1}),window.dataLayer.push({...e,...p})}checkout_contact_info_submitted_fired=!0}),analytics.subscribe("
checkout_address_info_submitted",t=>{if(!checkout_address_info_submitted_fired){var
e,a,d,c,i,r,o,n,s,u,p=contextData()||{},h={};if(null!==t.data.checkout){var
l=t.data.checkout.lineItems,m=l.map(t=>{var
e;return{item_id:t.variant.product.id,item_name:t.variant.product.title,item_brand:t.variant.product.ven
dor,item_category:t.variant.product.type,item_variant:t.variant.title?t.variant.title:"",price:t.variant
.price.amount,coupon:t.discountAllocations.length>0?t.discountAllocations[0].discountApplication.title:"
",quantity:t.quantity}});o=l.map(t=>{var
e;return{product_id:t.variant.product.id,product_name:t.variant.product.title,product_variant_id:t.varia
nt.id,product_brand:t.variant.product.vendor?t.variant.product.vendor:"",product_category:t.variant.prod
uct.type,product_price:t.variant.price.amount,product_quantity:t.quantity}}),u=l.map(t=>void
0===t.variant.sku?"":t.variant.sku),s=l.map(t=>t.variant.id),a=l.map(t=>t.variant.product.id),d=l.map(t=
>t.variant.product.type).includes("")?"":l.map(t=>t.variant.product.type).join(),n=l.map(t=>t.variant.pr
oduct.vendor?t.variant.product.vendor:"").includes("")?"":l.map(t=>t.variant.product.vendor),c=l.map(t=>
t.variant.product.title).join(),i=l.map(t=>{var
e;return{id:t.variant.product.id,quantity:t.quantity,item_price:t.variant.price.amount}}),r=l.reduce((t,
e)=>t+=e.quantity,0),h.currency=t.data.checkout.currencyCode,h.value=t.data.checkout.totalPrice.amount,h
.coupon=t.data.checkout.discountApplications.length>0?t.data.checkout.discountApplications[0].title:"",h
.items=m}e={event:"checkout_address_info_submitted",client_id:t.clientId,event_time:t.timestamp,event_ti
me_seconds:Math.round(new
Date(t.timestamp)/1e3),product_variant_id:s,product_sku:u,itemTotalQuantity:r,total_tax:t.data.checkout.
totalTax.amount,subTotal_price:t.data.checkout.subtotalPrice.amount,shipping:t.data.checkout.shippingLin
e.price.amount?t.data.checkout.shippingLine.price.amount:"",transaction_id:t.data.checkout.order.id?t.da
ta.checkout.order.id:"",email:t.data.checkout.email?t.data.checkout.email:"",phone:t.data.checkout.phone
?t.data.checkout.phone:"",customer_address_Line1:t.data.checkout.shippingAddress.address1?t.data.checkou
t.shippingAddress.address1:t.data.checkout.billingAddress.address1,customer_address_Line2:t.data.checkou
t.shippingAddress.address2?t.data.checkout.shippingAddress.address2:t.data.checkout.billingAddress.addre
ss2,customer_city:t.data.checkout.shippingAddress.city?t.data.checkout.shippingAddress.city:t.data.check
out.billingAddress.city,customer_country:t.data.checkout.shippingAddress.country?t.data.checkout.shippin
gAddress.country:t.data.checkout.billingAddress.country,customer_countryCode:t.data.checkout.shippingAdd
ress.countryCode?t.data.checkout.shippingAddress.countryCode:t.data.checkout.billingAddress.countryCode,
customer_firstName:t.data.checkout.shippingAddress.firstName?t.data.checkout.shippingAddress.firstName:t
.data.checkout.billingAddress.firstName,customer_lastName:t.data.checkout.shippingAddress.lastName?t.dat
a.checkout.shippingAddress.lastName:t.data.checkout.billingAddress.lastName,customer_phoneNo:t.data.chec
kout.shippingAddress.phone?t.data.checkout.shippingAddress.phone:t.data.checkout.billingAddress.phone,cu
stomer_state:t.data.checkout.shippingAddress.province?t.data.checkout.shippingAddress.province:t.data.ch
eckout.billingAddress.province,customer_stateCode:t.data.checkout.shippingAddress.provinceCode?t.data.ch
eckout.shippingAddress.provinceCode:t.data.checkout.billingAddress.provinceCode,customer_zip:t.data.chec
kout.shippingAddress.zip?t.data.checkout.shippingAddress.zip:t.data.checkout.billingAddress.zip,ecommerc
e:h},trackingPlatform.filter(t=>t.toLowerCase().includes("facebook")).length>0&&(e.fb_browser_side={cont
ent_ids:a,content_category:d,content_name:c,content_type:"product",contents:i,currency:t.data.checkout.c
urrencyCode,value:t.data.checkout.totalPrice.amount,num_items:r}),trackingPlatform.filter(t=>t.toLowerCa
se().includes("pinterest")).length>0&&(e.pt_browser_side={value:t.data.checkout.totalPrice.amount,order_
quantity:r,currency:t.data.checkout.currencyCode,line_items:o}),trackingPlatform.filter(t=>t.toLowerCase
().includes("snapchat")).length>0&&(e.snap_browser_side={price:t.data.checkout.totalPrice.amount,currenc
y:t.data.checkout.currencyCode,item_ids:a,item_category:d,brands:n,number_items:r,payment_info_available
:1}),window.dataLayer.push({...e,...p})}checkout_address_info_submitted_fired=!0}),analytics.subscribe("
checkout_shipping_info_submitted",t=>{if(!checkout_shipping_info_submitted_fired){var
e,a,d,c,i,r,o,n,s,u,p=contextData()||{},h={};if(null!==t.data.checkout){var
l=t.data.checkout.lineItems,m=l.map(t=>{var
e;return{item_id:t.variant.product.id,item_name:t.variant.product.title,item_brand:t.variant.product.ven
dor,item_category:t.variant.product.type,item_variant:t.variant.title?t.variant.title:"",price:t.variant
.price.amount,coupon:t.discountAllocations.length>0?t.discountAllocations[0].discountApplication.title:"
",quantity:t.quantity}});o=l.map(t=>{var
e;return{product_id:t.variant.product.id,product_name:t.variant.product.title,product_variant_id:t.varia
nt.id,product_brand:t.variant.product.vendor?t.variant.product.vendor:"",product_category:t.variant.prod
uct.type,product_price:t.variant.price.amount,product_quantity:t.quantity}}),u=l.map(t=>void
0===t.variant.sku?"":t.variant.sku),s=l.map(t=>t.variant.id),a=l.map(t=>t.variant.product.id),d=l.map(t=
>t.variant.product.type).includes("")?"":l.map(t=>t.variant.product.type).join(),n=l.map(t=>t.variant.pr
oduct.vendor?t.variant.product.vendor:"").includes("")?"":l.map(t=>t.variant.product.vendor),c=l.map(t=>
t.variant.product.title).join(),i=l.map(t=>{var
e;return{id:t.variant.product.id,quantity:t.quantity,item_price:t.variant.price.amount}}),r=l.reduce((t,
e)=>t+=e.quantity,0),h.currency=t.data.checkout.currencyCode,h.value=t.data.checkout.totalPrice.amount,h
.coupon=t.data.checkout.discountApplications.length>0?t.data.checkout.discountApplications[0].title:"",h
.items=m}e={event:"add_shipping_info",client_id:t.clientId,event_time:t.timestamp,event_time_seconds:Mat
h.round(new
Date(t.timestamp)/1e3),product_variant_id:s,product_sku:u,itemTotalQuantity:r,total_tax:t.data.checkout.
totalTax.amount,subTotal_price:t.data.checkout.subtotalPrice.amount,shipping:t.data.checkout.shippingLin
e.price.amount?t.data.checkout.shippingLine.price.amount:"",transaction_id:t.data.checkout.order.id?t.da
ta.checkout.order.id:"",email:t.data.checkout.email?t.data.checkout.email:"",phone:t.data.checkout.phone
?t.data.checkout.phone:"",customer_address_Line1:t.data.checkout.shippingAddress.address1?t.data.checkou
t.shippingAddress.address1:t.data.checkout.billingAddress.address1,customer_address_Line2:t.data.checkou
t.shippingAddress.address2?t.data.checkout.shippingAddress.address2:t.data.checkout.billingAddress.addre
ss2,customer_city:t.data.checkout.shippingAddress.city?t.data.checkout.shippingAddress.city:t.data.check
out.billingAddress.city,customer_country:t.data.checkout.shippingAddress.country?t.data.checkout.shippin
gAddress.country:t.data.checkout.billingAddress.country,customer_countryCode:t.data.checkout.shippingAdd
ress.countryCode?t.data.checkout.shippingAddress.countryCode:t.data.checkout.billingAddress.countryCode,
customer_firstName:t.data.checkout.shippingAddress.firstName?t.data.checkout.shippingAddress.firstName:t
.data.checkout.billingAddress.firstName,customer_lastName:t.data.checkout.shippingAddress.lastName?t.dat
a.checkout.shippingAddress.lastName:t.data.checkout.billingAddress.lastName,customer_phoneNo:t.data.chec
kout.shippingAddress.phone?t.data.checkout.shippingAddress.phone:t.data.checkout.billingAddress.phone,cu
stomer_state:t.data.checkout.shippingAddress.province?t.data.checkout.shippingAddress.province:t.data.ch
eckout.billingAddress.province,customer_stateCode:t.data.checkout.shippingAddress.provinceCode?t.data.ch
eckout.shippingAddress.provinceCode:t.data.checkout.billingAddress.provinceCode,customer_zip:t.data.chec
kout.shippingAddress.zip?t.data.checkout.shippingAddress.zip:t.data.checkout.billingAddress.zip,ecommerc
e:h},trackingPlatform.filter(t=>t.toLowerCase().includes("facebook")).length>0&&(e.fb_browser_side={cont
ent_ids:a,content_category:d,content_name:c,content_type:"product",contents:i,currency:t.data.checkout.c
urrencyCode,value:t.data.checkout.totalPrice.amount,num_items:r}),trackingPlatform.filter(t=>t.toLowerCa
se().includes("pinterest")).length>0&&(e.pt_browser_side={value:t.data.checkout.totalPrice.amount,order_
quantity:r,currency:t.data.checkout.currencyCode,line_items:o}),trackingPlatform.filter(t=>t.toLowerCase
().includes("snapchat")).length>0&&(e.snap_browser_side={price:t.data.checkout.totalPrice.amount,currenc
y:t.data.checkout.currencyCode,item_ids:a,item_category:d,brands:n,number_items:r,payment_info_available
:1}),window.dataLayer.push({...e,...p})}checkout_shipping_info_submitted_fired=!0}),analytics.subscribe(
"payment_info_submitted",t=>{var
e,a,d,c,i,r,o,n,s,u,p=contextData()||{},h={};if(null!==t.data.checkout){var
l=t.data.checkout.lineItems,m=l.map(t=>{var
e;return{item_id:t.variant.product.id,item_name:t.variant.product.title,item_brand:t.variant.product.ven
dor,item_category:t.variant.product.type,item_variant:t.variant.title?t.variant.title:"",price:t.variant
.price.amount,coupon:t.discountAllocations.length>0?t.discountAllocations[0].discountApplication.title:"
",quantity:t.quantity}});o=l.map(t=>{var
e;return{product_id:t.variant.product.id,product_name:t.variant.product.title,product_variant_id:t.varia
nt.id,product_brand:t.variant.product.vendor?t.variant.product.vendor:"",product_category:t.variant.prod
uct.type,product_price:t.variant.price.amount,product_quantity:t.quantity}}),u=l.map(t=>void
0===t.variant.sku?"":t.variant.sku),s=l.map(t=>t.variant.id),a=l.map(t=>t.variant.product.id),d=l.map(t=
>t.variant.product.type).includes("")?"":l.map(t=>t.variant.product.type).join(),n=l.map(t=>t.variant.pr
oduct.vendor?t.variant.product.vendor:"").includes("")?"":l.map(t=>t.variant.product.vendor),c=l.map(t=>
t.variant.product.title).join(),i=l.map(t=>{var
e;return{id:t.variant.product.id,quantity:t.quantity,item_price:t.variant.price.amount}}),r=l.reduce((t,
e)=>t+=e.quantity,0),h.currency=t.data.checkout.currencyCode,h.value=t.data.checkout.totalPrice.amount,h
.coupon=t.data.checkout.discountApplications.length>0?t.data.checkout.discountApplications[0].title:"",h
.items=m}e={event:"add_payment_info",client_id:t.clientId,event_time:t.timestamp,event_time_seconds:Math
.round(new
Date(t.timestamp)/1e3),product_variant_id:s,product_sku:u,itemTotalQuantity:r,total_tax:t.data.checkout.
totalTax.amount,subTotal_price:t.data.checkout.subtotalPrice.amount,shipping:t.data.checkout.shippingLin
e.price.amount?t.data.checkout.shippingLine.price.amount:"",transaction_id:t.data.checkout.order.id?t.da
ta.checkout.order.id:"",email:t.data.checkout.email?t.data.checkout.email:"",phone:t.data.checkout.phone
?t.data.checkout.phone:"",customer_address_Line1:t.data.checkout.shippingAddress.address1?t.data.checkou
t.shippingAddress.address1:t.data.checkout.billingAddress.address1,customer_address_Line2:t.data.checkou
t.shippingAddress.address2?t.data.checkout.shippingAddress.address2:t.data.checkout.billingAddress.addre
ss2,customer_city:t.data.checkout.shippingAddress.city?t.data.checkout.shippingAddress.city:t.data.check
out.billingAddress.city,customer_country:t.data.checkout.shippingAddress.country?t.data.checkout.shippin
gAddress.country:t.data.checkout.billingAddress.country,customer_countryCode:t.data.checkout.shippingAdd
ress.countryCode?t.data.checkout.shippingAddress.countryCode:t.data.checkout.billingAddress.countryCode,
customer_firstName:t.data.checkout.shippingAddress.firstName?t.data.checkout.shippingAddress.firstName:t
.data.checkout.billingAddress.firstName,customer_lastName:t.data.checkout.shippingAddress.lastName?t.dat
a.checkout.shippingAddress.lastName:t.data.checkout.billingAddress.lastName,customer_phoneNo:t.data.chec
kout.shippingAddress.phone?t.data.checkout.shippingAddress.phone:t.data.checkout.billingAddress.phone,cu
stomer_state:t.data.checkout.shippingAddress.province?t.data.checkout.shippingAddress.province:t.data.ch
eckout.billingAddress.province,customer_stateCode:t.data.checkout.shippingAddress.provinceCode?t.data.ch
eckout.shippingAddress.provinceCode:t.data.checkout.billingAddress.provinceCode,customer_zip:t.data.chec
kout.shippingAddress.zip?t.data.checkout.shippingAddress.zip:t.data.checkout.billingAddress.zip,ecommerc
e:h},trackingPlatform.filter(t=>t.toLowerCase().includes("facebook")).length>0&&(e.fb_browser_side={cont
ent_ids:a,content_category:d,content_name:c,content_type:"product",contents:i,currency:t.data.checkout.c
urrencyCode,value:t.data.checkout.totalPrice.amount,num_items:r}),trackingPlatform.filter(t=>t.toLowerCa
se().includes("pinterest")).length>0&&(e.pt_browser_side={value:t.data.checkout.totalPrice.amount,order_
quantity:r,currency:t.data.checkout.currencyCode,line_items:o}),trackingPlatform.filter(t=>t.toLowerCase
().includes("snapchat")).length>0&&(e.snap_browser_side={price:t.data.checkout.totalPrice.amount,currenc
y:t.data.checkout.currencyCode,item_ids:a,item_category:d,brands:n,number_items:r,payment_info_available
:1}),window.dataLayer.push({...e,...p})}),analytics.subscribe("checkout_completed",t=>{var
e,a,d,c,i,r,o,n,s,u,p=contextData()||{},h={};if(null!==t.data.checkout){var
l=t.data.checkout.lineItems,m=l.map(t=>{var
e;return{item_id:t.variant.product.id,item_name:t.variant.product.title,item_brand:t.variant.product.ven
dor,item_category:t.variant.product.type,item_variant:t.variant.title?t.variant.title:"",price:t.variant
.price.amount,coupon:t.discountAllocations.length>0?t.discountAllocations[0].discountApplication.title:"
",quantity:t.quantity}});o=l.map(t=>{var
e;return{product_id:t.variant.product.id,product_name:t.variant.product.title,product_variant_id:t.varia
nt.id,product_brand:t.variant.product.vendor?t.variant.product.vendor:"",product_category:t.variant.prod
uct.type,product_price:t.variant.price.amount,product_quantity:t.quantity}}),u=l.map(t=>void
0===t.variant.sku?"":t.variant.sku),s=l.map(t=>t.variant.id),a=l.map(t=>t.variant.product.id),d=l.map(t=
>t.variant.product.type).includes("")?"":l.map(t=>t.variant.product.type).join(),n=l.map(t=>t.variant.pr
oduct.vendor?t.variant.product.vendor:"").includes("")?"":l.map(t=>t.variant.product.vendor),c=l.map(t=>
t.variant.product.title).join(),i=l.map(t=>{var
e;return{id:t.variant.product.id,quantity:t.quantity,item_price:t.variant.price.amount}}),r=l.reduce((t,
e)=>t+=e.quantity,0),h.currency=t.data.checkout.currencyCode,h.value=t.data.checkout.totalPrice.amount,h
.tax=t.data.checkout.totalTax.amount,h.coupon=t.data.checkout.discountApplications.length>0?t.data.check
out.discountApplications[0].title:"",h.shipping=t.data.checkout.shippingLine.price.amount?t.data.checkou
t.shippingLine.price.amount:"",h.transaction_id=t.data.checkout.order.id?t.data.checkout.order.id.split(
"/").pop():"",h.items=m}e={event:"purchase",client_id:t.clientId,event_time:t.timestamp,event_time_secon
ds:Math.round(new
Date(t.timestamp)/1e3),itemTotalQuantity:r,subTotal_price:t.data.checkout.subtotalPrice.amount,product_v
ariant_id:s,product_sku:u,payment_gateway:t.data.checkout.transactions.length>0?t.data.checkout.transact
ions[0].gateway:"",customer_id:t.data.checkout.order.customer.id?t.data.checkout.order.customer.id:"",em
ail:t.data.checkout.email?t.data.checkout.email:"",phone:t.data.checkout.phone?t.data.checkout.phone:"",
customer_address_Line1:null===t.data.checkout.billingAddress||void
0===t.data.checkout.billingAddress?null===t.data.checkout.shippingAddress||void
0===t.data.checkout.shippingAddress?"":null===t.data.checkout.shippingAddress.address1||void
0===t.data.checkout.shippingAddress.address1?"":t.data.checkout.shippingAddress.address1:null===t.data.c
heckout.billingAddress.address1||void
0===t.data.checkout.billingAddress.address1?"":t.data.checkout.billingAddress.address1,customer_address_
Line2:null===t.data.checkout.billingAddress||void
0===t.data.checkout.billingAddress?null===t.data.checkout.shippingAddress||void
0===t.data.checkout.shippingAddress?"":null===t.data.checkout.shippingAddress.address2||void
0===t.data.checkout.shippingAddress.address2?"":t.data.checkout.shippingAddress.address2:null===t.data.c
heckout.billingAddress.address2||void
0===t.data.checkout.billingAddress.address2?"":t.data.checkout.billingAddress.address2,customer_city:nul
l===t.data.checkout.billingAddress||void
0===t.data.checkout.billingAddress?null===t.data.checkout.shippingAddress||void
0===t.data.checkout.shippingAddress?"":null===t.data.checkout.shippingAddress.city||void
0===t.data.checkout.shippingAddress.city?"":t.data.checkout.shippingAddress.city:null===t.data.checkout.
billingAddress.city||void
0===t.data.checkout.billingAddress.city?"":t.data.checkout.billingAddress.city,customer_country:null===t
.data.checkout.billingAddress||void
0===t.data.checkout.billingAddress?null===t.data.checkout.shippingAddress||void
0===t.data.checkout.shippingAddress?"":null===t.data.checkout.shippingAddress.country||void
0===t.data.checkout.shippingAddress.country?"":t.data.checkout.shippingAddress.country:null===t.data.che
ckout.billingAddress.country||void
0===t.data.checkout.billingAddress.country?"":t.data.checkout.billingAddress.country,customer_countryCod
e:null===t.data.checkout.billingAddress||void
0===t.data.checkout.billingAddress?null===t.data.checkout.shippingAddress||void
0===t.data.checkout.shippingAddress?"":null===t.data.checkout.shippingAddress.countryCode||void
0===t.data.checkout.shippingAddress.countryCode?"":t.data.checkout.shippingAddress.countryCode:null===t.
data.checkout.billingAddress.countryCode||void
0===t.data.checkout.billingAddress.countryCode?"":t.data.checkout.billingAddress.countryCode,customer_fi
rstName:null===t.data.checkout.billingAddress||void
0===t.data.checkout.billingAddress?null===t.data.checkout.shippingAddress||void
0===t.data.checkout.shippingAddress?"":null===t.data.checkout.shippingAddress.firstName||void
0===t.data.checkout.shippingAddress.firstName?"":t.data.checkout.shippingAddress.firstName:null===t.data
.checkout.billingAddress.firstName||void
0===t.data.checkout.billingAddress.firstName?"":t.data.checkout.billingAddress.firstName,customer_lastNa
me:null===t.data.checkout.billingAddress||void
0===t.data.checkout.billingAddress?null===t.data.checkout.shippingAddress||void
0===t.data.checkout.shippingAddress?"":null===t.data.checkout.shippingAddress.lastName||void
0===t.data.checkout.shippingAddress.lastName?"":t.data.checkout.shippingAddress.lastName:null===t.data.c
heckout.billingAddress.lastName||void
0===t.data.checkout.billingAddress.lastName?"":t.data.checkout.billingAddress.lastName,customer_phoneNo:
null===t.data.checkout.billingAddress||void
0===t.data.checkout.billingAddress?null===t.data.checkout.shippingAddress||void
0===t.data.checkout.shippingAddress?"":null===t.data.checkout.shippingAddress.phone||void
0===t.data.checkout.shippingAddress.phone?"":t.data.checkout.shippingAddress.phone:null===t.data.checkou
t.billingAddress.phone||void
0===t.data.checkout.billingAddress.phone?"":t.data.checkout.billingAddress.phone,customer_state:null===t
.data.checkout.billingAddress||void
0===t.data.checkout.billingAddress?null===t.data.checkout.shippingAddress||void
0===t.data.checkout.shippingAddress?"":null===t.data.checkout.shippingAddress.province||void
0===t.data.checkout.shippingAddress.province?"":t.data.checkout.shippingAddress.province:null===t.data.c
heckout.billingAddress.province||void
0===t.data.checkout.billingAddress.province?"":t.data.checkout.billingAddress.province,customer_stateCod
e:null===t.data.checkout.billingAddress||void
0===t.data.checkout.billingAddress?null===t.data.checkout.shippingAddress||void
0===t.data.checkout.shippingAddress?"":null===t.data.checkout.shippingAddress.provinceCode||void
0===t.data.checkout.shippingAddress.provinceCode?"":t.data.checkout.shippingAddress.provinceCode:null===
t.data.checkout.billingAddress.provinceCode||void
0===t.data.checkout.billingAddress.provinceCode?"":t.data.checkout.billingAddress.provinceCode,customer_
zip:null===t.data.checkout.billingAddress||void
0===t.data.checkout.billingAddress?null===t.data.checkout.shippingAddress||void
0===t.data.checkout.shippingAddress?"":null===t.data.checkout.shippingAddress.zip||void
0===t.data.checkout.shippingAddress.zip?"":t.data.checkout.shippingAddress.zip:null===t.data.checkout.bi
llingAddress.zip||void
0===t.data.checkout.billingAddress.zip?"":t.data.checkout.billingAddress.zip,ecommerce:h},trackingPlatfo
rm.filter(t=>t.toLowerCase().includes("facebook")).length>0&&(e.fb_browser_side={content_ids:a,content_c
ategory:d,content_name:c,content_type:"product",contents:i,currency:t.data.checkout.currencyCode,value:t
.data.checkout.totalPrice.amount,num_items:r}),trackingPlatform.filter(t=>t.toLowerCase().includes("pint
erest")).length>0&&(e.pt_browser_side={value:t.data.checkout.totalPrice.amount,order_quantity:r,currency
:t.data.checkout.currencyCode,order_id:t.data.checkout.order.id?t.data.checkout.order.id.split("/").pop(
):"",promo_code:t.data.checkout.discountApplications.length>0?t.data.checkout.discountApplications[0].ti
tle:"",line_items:o}),trackingPlatform.filter(t=>t.toLowerCase().includes("snapchat")).length>0&&(e.snap
_browser_side={price:t.data.checkout.totalPrice.amount,currency:t.data.checkout.currencyCode,item_ids:a,
item_category:d,brands:n,number_items:r,transaction_id:t.data.checkout.order.id?t.data.checkout.order.id
.split("/").pop():""}),window.dataLayer.push({...e,...p,page_location:t.context.document.location.href,p
age_referrer:t.context.document.referrer,page_title:t.context.document.title,page_path:t.context.documen
t.location.pathname,search_param:t.context.document.location.search,hash_param:t.context.document.locati
on.hash})}),analytics.subscribe("search_submitted",t=>{var
e,a,d,c,i=contextData()||{},r={},o=t.data.searchResult.productVariants;o.length>0&&(a=o.map(t=>{var
e;return{item_id:t.product.id,item_name:t.product.title,item_brand:t.product.vendor,item_category:t.prod
uct.type,item_variant:t.title?t.title:"",price:t.price.amount,quantity:1}})),r.value=o.reduce((t,e)=>t+=
e.price.amount,0),r.items=a,d=o.map(t=>t.id),c=o.map(t=>t.sku),e={event:"search",client_id:t.clientId,ev
ent_time:t.timestamp,event_time_seconds:Math.round(new
Date(t.timestamp)/1e3),search_term:t.data.searchResult.query},trackingPlatform.filter(t=>t.toLowerCase()
.includes("facebook")).length>0&&(e.fb_browser_side={search_string:t.data.searchResult.query}),trackingP
latform.filter(t=>t.toLowerCase().includes("pinterest")).length>0&&(e.pt_browser_side={search_query:t.da
ta.searchResult.query}),trackingPlatform.filter(t=>t.toLowerCase().includes("snapchat")).length>0&&(e.sn
ap_browser_side={search_string:t.data.searchResult.query}),window.dataLayer.push({...e,...i}),window.dat
aLayer.push({event:"view_search_results",client_id:t.clientId,page_location:t.context.document.location.
href,page_referrer:t.context.document.referrer,page_title:t.context.document.title,page_path:t.context.d
ocument.location.pathname,search_param:t.context.document.location.search,hash_param:t.context.document.
location.hash,language:t.context.navigator.language,screen_width:t.context.window.outerWidth,screen_heig
ht:t.context.window.outerHeight,user_agent:t.context.navigator.userAgent,event_time:t.timestamp,event_ti
me_seconds:Math.floor(new
Date(t.timestamp)/1e3),product_variant_id:d,product_sku:c,search_term:t.data.searchResult.query,ecommerc
e:r})}),analytics.subscribe("collection_viewed",t=>{var
e,a,d,c,i,r,o,n,s,u=contextData()||{},p={},h=t.data.collection.productVariants;h.length>0&&(r=h.map(t=>{
var
e;return{item_id:t.product.id,item_name:t.product.title,item_brand:t.product.vendor,item_category:t.prod
uct.type,item_variant:t.title?t.title:"",price:t.price.amount,quantity:1}}),s=h.map(t=>{var
e;return{product_id:t.product.id,product_name:t.product.title,product_variant_id:t.id,product_brand:t.pr
oduct.vendor?t.product.vendor:"",product_category:t.product.type,product_price:t.price.amount,product_qu
antity:1}}),o=h.map(t=>t.id),n=h.map(t=>t.sku),a=h.map(t=>t.product.id),d=h.map(t=>t.product.type).inclu
des("")?"":h.map(t=>t.product.type).join(),c=h.map(t=>t.product.title).join(),i=h.map(t=>{var
e;return{id:t.product.id,quantity:1,item_price:t.price.amount}}),p.item_list_id=t.data.collection.id,p.i
tem_list_name=t.data.collection.title,p.items=r),e={event:"view_item_list",client_id:t.clientId,event_ti
me:t.timestamp,event_time_seconds:Math.round(new
Date(t.timestamp)/1e3),product_variant_id:o,product_sku:n,ecommerce:p},trackingPlatform.filter(t=>t.toLo
werCase().includes("facebook")).length>0&&(e.fb_browser_side={content_ids:a,content_category:d,content_n
ame:c,content_type:"product",contents:i}),trackingPlatform.filter(t=>t.toLowerCase().includes("pinterest
")).length>0&&(e.pt_browser_side={line_items:s}),trackingPlatform.filter(t=>t.toLowerCase().includes("sn
apchat")).length>0&&(e.snap_browser_side={item_list_id:t.data.collection.id,item_list_name:t.data.collec
tion.title,item_ids:a}),window.dataLayer.push({...e,...u})});
Comments
Post a Comment