(function() { function bxBootstrap() { var re = /bot|crawl|slurp|spider|mediapartners|headlesschrome|snap-prefetch|remotasks|woorank|uptime\.com|facebookexternalhit|facebookcatalog/i; if (re.test(navigator.userAgent) || navigator.userAgent == '') { return; } if (!(window.bouncex&&bouncex.website)) { var pushedData = []; if(window.bouncex && bouncex.push && bouncex.length){ pushedData = bouncex; } window.bouncex = {}; bouncex.pushedData = pushedData; bouncex.website = {"id":5562,"name":"Boden UK","cookie_name":"bounceClientVisit5562","domain":"boden.com","ct":"fp_local_storage","ally":0,"ei":0,"tcjs":"","cjs":"if (bouncex.website.pts === 'search' || bouncex.website.pts === 'category') {\n bouncex.setVar('quick_add_item_id', false);\n}\n\n/* enable.feature.COMPLIANCE_REFACTOR_ENABLED */","force_https":false,"waypoints":false,"content_width":900,"gai":"","swids":"","sd":0,"ljq":"auto","campaign_id":0,"is_preview":false,"aco":{"first_party_limit":"3500","local_storage":"1"},"cmp":{"gdpr":1,"gmp":0,"whitelist_check":1},"burls":[],"ple":false,"fbe":true,"ffs":"","mas":2,"map":1,"gar":true,"ete":1,"ettm":false,"etjs":"/* ---------------------------- SHARED VARIABLES ---------------------------- */\n\nvar CLEAN_URL = bouncex.utils.url.allowParams(['q']),\n ATC_SELECTOR = 'button[name=\"add\"]';\n\n/* --------------------------------- HELPERS -------------------------------- */\n\nfunction getItemId(url){\n if (!url){\n return '';\n }\n\n return bouncex.utils.url.allowParams([], url).replace(/\\/$/g, '').split('/').pop();\n}\n\n\nfunction getItemCopy(){\n return jQuery('.shopify-section h1, h1.product__title').first().text().trim() || '';\n}\n\nfunction getItemImage(){\n var imgElement = jQuery('.slick-slide.slick-active[data-slick-index=\"0\"] .lazyloaded, .swiper-slide.swiper-slide-active img, .product-media__image-wrapper img'),\n imgUrl = jQuery(imgElement).attr('src') || jQuery(imgElement).attr('srcset');\n\n if (!imgUrl){\n return false;\n }\n\n imgUrl = bouncex.utils.url.allowParams([], imgUrl.replace(/\\s+/g, ''));\n\n if (imgUrl.indexOf('http') === -1){\n return 'https:' + imgUrl;\n }\n\n return imgUrl;\n}\n\n\nfunction isValidItemId(id) {\n return (id || '').split('-').length > 2;\n}\n\nfunction getPrice() {\n var originalPrice = jQuery('.price__container .price-item').first().text().replace(/[^0-9./]/g, ''),\n salePrice = jQuery('.updated-price-text').first().text().split(' ').shift().replace(/[^0-9./]/g, '');\n\n return Number(salePrice) || Number(originalPrice);\n}\n\nfunction isExcluded() {\n var dataLayerLoadEvent = dataLayer.find(item => item.event === 'dataLayer.load.auto.dataLayer.load'),\n stockArray = dataLayerLoadEvent.assets.products[0].stock,\n hasOnOrder = stockArray.some(function(stockItem) {\n return stockItem.status === \"OnOrder\";\n });\n \n return hasOnOrder;\n}\n\n/* ------------------------------ ITEM TRACKING ----------------------------- */\n\nfunction getItem() {\n return {\n id: getItemId(CLEAN_URL),\n copy: getItemCopy(),\n category: jQuery('.at-breadcrumbs-text').last().text() || 'Global',\n url: CLEAN_URL,\n imageurl: getItemImage(),\n instock: jQuery(ATC_SELECTOR).text().toLowerCase().indexOf('add to bag') > -1,\n price: getPrice(),\n excluded: isExcluded()\n };\n}\n\nfunction fireViewItem(id, groupId) {\n var pushItem = { 'item:id': id };\n\n if (groupId) {\n pushItem['item:itemgroupid'] = groupId;\n }\n bouncex.push(['view item', pushItem]);\n}\n\nfunction initializeItemEvents() {\n var item;\n\n bouncex.et.onTrue(\n function () {\n item = getItem();\n return !!item.copy &&\n !!item.category &&\n !!item.url &&\n !!item.imageurl && isValidItemId(item.id);\n },\n function () {\n if (item.url.indexOf('gift-voucher') > -1) {\n return;\n }\n bouncex.push(['item', item]);\n \n item.groupId = jQuery('.accordion__content p').first().text().trim().split('-').shift() || jQuery('.pdp-style-option-code').text().trim().split('-').shift();\n initializeSkuEvents(item.id, item.groupId);\n \n fireViewItem(item.id, item.groupId);\n initializeATCClickTracking(item.id);\n trackStylitics(item.url);\n },\n 10\n );\n}\n\n/* ---------------------------- STYLITICS TRACKING --------------------------- */\n\nfunction trackStylitics(itemUrl) {\n jQuery('.stylitics-card img').each(function () {\n var imageUrl = jQuery(this).attr('src');\n if (imageUrl) {\n bouncex.push(['view_collection', {\n image_url: bouncex.utils.url.allowParams([], imageUrl),\n item_url: itemUrl\n }]);\n }\n });\n}\n\n/* ------------------------------ SKU TRACKING ------------------------------ */\n\nfunction getSku() {\n return jQuery('.product__inventory.inventory input[name=\"properties[_variant_edp]\"]').val() ||\n bouncex.utils.url.getParam('variant', window.location.href) ||\n bouncex.utils.getNestedProp('ShopifyAnalytics.meta.selectedVariantId') ||\n jQuery('input[name=\"id\"]').val();\n}\n\nfunction initializeSkuEvents(itemId, groupId) {\n var allVariantsSelector = '.product__swatches li.product-swatches__swatch, .size-selector .form__field',\n minVariants = 2,\n lastSkuFired,\n skuId;\n\n if (jQuery(allVariantsSelector).length <= minVariants){\n skuId = getSku();\n if (skuId){\n fireSelectSku(itemId, groupId, skuId);\n }\n return;\n }\n \n bouncex.et.onVarChange('sku_id', function (oldVal, newVal) {\n if(newVal) {\n skuId = getSku();\n if (skuId){\n fireSelectSku(itemId, groupId, skuId); \n } \n }\n });\n}\n\nfunction fireSelectSku(itemId, groupId, skuId){\n bouncex.push([\n 'select_sku',\n {\n 'item:id': itemId,\n 'item:itemgroupid': groupId,\n 'item:feedid': skuId\n }\n ]);\n}\n\n/* ---------------------------- CATEGORY TRACKING --------------------------- */\n\n\nfunction getTileSelector(){\n var tileSelectors = ['div[class*=\"Product\"] a[href]', 'div[class*=\"product\"] a[href]'],\n main = '#MainContent ',\n tileSelector;\n\n for (var i = 0; i < tileSelectors.length; i++){\n if (jQuery(tileSelectors[i]).length > 0){\n tileSelector = tileSelectors[i];\n var mainContentSel = main + tileSelectors[i];\n if (jQuery(mainContentSel).length > 0){\n tileSelector = mainContentSel;\n }\n }\n }\n\n return tileSelector;\n}\n\nfunction getItemIdsCat(){\n var ids = [],\n tileSelector = getTileSelector();\n\n jQuery(tileSelector).each(function () {\n var itemUrl = jQuery(this).attr('href') || '',\n id = getItemId(itemUrl);\n\n if (id && ids.indexOf(id) < 0) {\n ids.push(id);\n }\n });\n ids.shift();\n return ids.join(',');\n}\n\nfunction getCategoryObject() {\n return {\n 'page:url': CLEAN_URL,\n 'items:ids': getItemIdsCat()\n };\n}\n\nfunction initializeCategoryEvents() {\n var categoryObj;\n\n bouncex.et.onTrue(\n function () {\n categoryObj = getCategoryObject();\n return !!categoryObj['items:ids'].length &&\n !!categoryObj['page:url'];\n },\n function () {\n bouncex.push(['view category', categoryObj]);\n captureCategory();\n },\n 10\n );\n\n initializeATCTracking();\n}\n\nfunction captureCategory(){\n if (bouncex.website.pts === 'category'){\n var catCode = bouncex.utils.getNestedProp('CLEAN_URL','',window).split('/').pop()\n if (catCode) {\n _shq.push(['onCategory', {\n 'catName': catCode,\n 'catId': catCode\n }]);\n }\n }\n}\n\nfunction initializeQuickView() {\n var id;\n\n bouncex.et.onVarChange('quick_view_open', function (oldVal, newVal) {\n if (newVal) {\n id = getIdFromUrl(jQuery('.quick-buy__link').attr('href'));\n\n if (id) {\n fireViewItem(id);\n }\n }\n });\n}\n\n/* ------------------------------- CART EVENTS ------------------------------ */\n\nfunction fireAddToCart(itemId) {\n bouncex.push(['add to cart', { 'item:id': itemId }]);\n\n if (bouncex.vars.cart) {\n return;\n }\n bouncex.setVar('cart', true);\n}\n\nfunction initializeATCTracking() {\n var itemId;\n bouncex.et.onVarChange('cart_qty', function (oldVal, newVal) {\n if (newVal > oldVal) {\n itemId = bouncex.vars.item_id || bouncex.vars.quick_add_item_id;\n if (itemId) {\n fireAddToCart(itemId);\n }\n }\n });\n}\n\nfunction initializeATCClickTracking(itemId) {\n bouncex.off(bouncex.document, 'click.bxatc', ATC_SELECTOR);\n bouncex.et.on(bouncex.document, 'click.bxatc', function () {\n fireAddToCart(itemId);\n }, ATC_SELECTOR);\n}\n\nfunction emptyCart(){\n bouncex.et.onVarChange('cart_qty', function (oldVal, newVal) {\n if (bouncex.vars.cart && newVal === 0 && oldVal > 0) {\n bouncex.push(['empty_cart']);\n bouncex.setVar('cart', false);\n }\n });\n if (bouncex.website.pts === 'cart' && bouncex.vars.cart){\n bouncex.et.onVisible('.is-empty', function(){\n bouncex.push(['empty_cart']);\n bouncex.setVar('cart', false);\n });\n }\n}\n\nfunction initializeCartEvents() {\n bouncex.et.cart.init({\n replenish: function () { \n replenComplete();\n },\n replenishmentType: 'single'\n });\n \n function replenComplete() {\n window.location.href = getAutoApplyReplenUrl();\n }\n\n emptyCart();\n}\n\n/* --------------------------- INITIALIZE SHOPIFY COUPON AUTOAPPLY -------------------------- */\n/* https://wunderkindco.atlassian.net/wiki/spaces/CE/pages/3655565410/WIP+Shopify+Coupon+Auto-Apply */\n\n/* --------------- Use this to auto-apply a static coupon code -------------- */\n// This version will apply any static coupon code when the wk_auto_discount param is present in the URL\n// NOTE: An RTV `coupon_auto_applied` with a default value of null is required. This RTV is set to the coupon code string the first time a coupon code is successfully auto-applied.\n// If a different Wunderkind coupon is loaded in that session, it will be auto-applied instead and the RTV value will be updated.\n\n// Add initShopifyCouponAutoApply(); before initializeCartEvents() inside the init function definition.\n// Please see above confluence doc for exact implementation instructions\nfunction initShopifyCouponAutoApply() {\n var isShopifyHostedTheme = !!bouncex.utils.getNestedProp('Shopify.theme.id'),\n discountCode = getAutoApplyPromoCode(),\n isCartReplenLink = !!bouncex.utils.url.getParam('bx_cart');\n\n if (isShopifyHostedTheme && discountCode && discountCode !== bouncex.vars.coupon_auto_applied) {\n ajaxShopifyAutoApply(discountCode);\n }\n}\n\nfunction ajaxShopifyAutoApply(discount) {\n var updateJSON = JSON.stringify({\n 'discounts': [discount],\n }),\n errorMessage = 'event tracking: error with shopify coupon auto-apply',\n discountUrl = '/discount/'+discount,\n updateUrl = '/cart/update.js';\n\n jQuery.ajax({\n url: discountUrl,\n method: 'GET',\n })\n .then(function(){\n jQuery.ajax({\n url: updateUrl,\n method: 'POST',\n contentType: 'application/json',\n data: updateJSON,\n })\n .then(function(){ updateCouponVar(discount); }, function(){ bouncex.log(errorMessage + ' POST ' + updateUrl); });\n }, function(){ bouncex.log(errorMessage + 'GET '+ discountUrl); });\n}\n\nfunction updateCouponVar(discount) {\n bouncex.setVar('coupon_auto_applied', discount);\n}\n\nfunction getAutoApplyPromoCode() {\n return bouncex.utils.url.getParam('wk_auto_discount');\n}\n\nfunction getShopifyAutoApplyUrl(discountCode, redirect) {\n var shopifyAutoApplyLink = window.location.origin+'/discount/'+discountCode;\n\n return redirect ? shopifyAutoApplyLink +'?redirect='+ redirect : shopifyAutoApplyLink;\n}\n\nfunction getShopifyRedirect(isReplen = false) {\n var cleanUrl = typeof CLEAN_URL !== 'undefined' ? CLEAN_URL : bouncex.utils.url.allowParams(), // If necessary, add required params for site navigation urls (i.e. search pages)\n urlObj = new URL(cleanUrl),\n queryParams = urlObj.search ||'',\n redirectUrl = urlObj.pathname,\n redirectParams = queryParams + (isReplen ? '?bx_replen=true' : '');\n\n return redirectUrl + encodeURIComponent(redirectParams);\n}\n\n// Add function innvocation inside replenComplete() to handle regular replen and replen with auto-apply\n// i.e. window.location.href = getAutoApplyReplenUrl();\n// Please see above confluence doc for exact implementation instructions\nfunction getAutoApplyReplenUrl() {\n var promoCode = getAutoApplyPromoCode(),\n autoApplyUrl = getShopifyAutoApplyUrl(promoCode, getShopifyRedirect(true));\n\n return promoCode ? autoApplyUrl : CLEAN_URL + '?bx_replen=true';\n}\n\n/* --------------------------- INITIALIZE TRACKING -------------------------- */\n\nfunction isValidDomain() {\n return CLEAN_URL.indexOf('boden.com') > -1 && CLEAN_URL.indexOf('stage') === -1;\n}\n\nfunction isEnUk() {\n return bouncex.html.attr('lang').indexOf('en') > -1 &&\n bouncex.state.geo.country_code === 'GB';\n}\n\nfunction isValidForTracking() {\n return isValidDomain() && isEnUk();\n}\n\nfunction init() {\n if (!isValidForTracking()) {\n return;\n }\n initShopifyCouponAutoApply(); \n initializeCartEvents();\n\n switch (bouncex.website.pts) {\n case 'category':\n case 'search':\n initializeCategoryEvents();\n initializeQuickView();\n break;\n case 'product':\n bouncex.setTimeout2(initializeItemEvents, 1000);\n break;\n default:\n break;\n }\n}\n\ninit();\n","dge":true,"bxidLoadFirst":false,"pie":false,"cme":true,"gbi_enabled":0,"bpush":false,"pt":{"cart":{"testmode":false,"val":[[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"/cart"}]]},"category":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"bouncex.utils.getNestedProp('br_data.ptype') === 'category';"},{"activation":"js","prop":"","prop2":"","prop3":"","val":"bouncex.utils.getNestedProp('ShopifyAnalytics.meta.page.pageType', '') === 'collection';"}]]},"checkout":{"testmode":false,"val":[[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"checkout.boden.co.uk"},{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"/checkouts"}]]},"home":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"window.location.pathname === '/' || window.location.pathname === '/en-uk';"}],[{"activation":"current_page_url","prop":"not_contains","prop2":"","prop3":"","val":"stageboden.co.uk"}]]},"product":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"bouncex.utils.getNestedProp('br_data.ptype') === 'product';"},{"activation":"js","prop":"","prop2":"","prop3":"","val":"bouncex.utils.getNestedProp('ShopifyAnalytics.meta.page.pageType', '') === 'product';"}]]},"search":{"testmode":false,"val":[[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"/search?"}]]}},"els":{"blank_site_element":""},"vars":[{"name":"logged_in","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"(function(){\n return jQuery('.account-dropdown__heading').first().text().indexOf('Hello') > -1;\n})();","trigger":""},{"name":"ever_logged_in","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"bouncex.vars.logged_in || null;","trigger":""},{"name":"cart_qty","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"0","code":"(function(){\n if(bouncex.website.pts === 'checkout' || bouncex.website.pts === 'cart') {\n return bouncex.utils.getNestedProp('_satellite.getVar', function(){})('CC: Number of items in cart') || 0;\n } else {\n return Number(jQuery('.cart-count-bubble span').first().text().replace(/[^0-9.]/g, '')) || Number(jQuery('.header-rd__mini-basket-count').first().text());\n }\n})();","trigger":""},{"name":"cart_value","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"0","code":"(function(){\n if(bouncex.website.pts === 'checkout' || bouncex.website.pts === 'cart') {\n return bouncex.utils.getNestedProp('_satellite.getVar', function(){})('CC: shoppingBag.value.gross') || 0;\n } else {\n return Number(jQuery('.totals__subtotal-value').first().text().replace(/[^0-9.]/g, ''));\n }\n})();","trigger":""},{"name":"prod_price","polling":"none","persist":"no","page_types":[],"testmode":true,"default":"false","code":"","trigger":""},{"name":"prod_name","polling":"none","persist":"no","page_types":[],"testmode":true,"default":"false","code":"","trigger":""},{"name":"in_stock","polling":"none","persist":"no","page_types":[],"testmode":true,"default":"false","code":"","trigger":""},{"name":"submitted_onsite","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"jQuery('.newsletter-form__success-title').is(':visible') || null;","trigger":""},{"name":"page_url","polling":"none","persist":"no","page_types":["category","search"],"testmode":true,"default":"false","code":"","trigger":""},{"name":"cart_token","polling":"none","persist":"no","page_types":[],"testmode":true,"default":"false","code":"null;","trigger":"pageload"},{"name":"cart_items","polling":"none","persist":"no","page_types":[],"testmode":true,"default":"false","code":"null;","trigger":"pageload"},{"name":"cart","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"cookie_modal_present","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"jQuery('#onetrust-banner-sdk:visible').length > 0;","trigger":"pageload"},{"name":"page_type","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"bouncex.website.pts;","trigger":"pageload"},{"name":"attentive_visible","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"jQuery('#attentive_overlay').length > 0;","trigger":"pageload"},{"name":"item_id","polling":"all","persist":"no","page_types":["product"],"testmode":false,"default":"false","code":"bouncex.utils.url.allowParams().split('/').pop();","trigger":"pageload"},{"name":"quick_add_item_id","polling":"all","persist":"visit","page_types":["category","search"],"testmode":false,"default":"false","code":"(function(){\n var url = jQuery('.quick-buy__link').attr('href') || '',\n id = bouncex.utils.url.allowParams('', url).split('/').pop();\n\n return jQuery('.quick-buy__form').length > 0 && id || null;\n})();","trigger":"pageload"},{"name":"quick_view_open","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"jQuery('.quick-buy').length > 0;","trigger":"pageload"},{"name":"sku_id","polling":"all","persist":"no","page_types":["product"],"testmode":false,"default":"false","code":"jQuery('.product__inventory.inventory input[name=\"properties[_variant_edp]\"]').val() || bouncex.utils.url.getParam('variant', window.location.href) || bouncex.utils.getNestedProp('ShopifyAnalytics.meta.selectedVariantId') || jQuery('input[name=\"id\"]').val();","trigger":"pageload"},{"name":"coupon_auto_applied","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"}],"dgu":"pixel.cdnwidget.com","dgp":false,"ba":{"enabled":0,"fbte":0},"biu":"assets.bounceexchange.com","bau":"api.bounceexchange.com","beu":"events.bouncex.net","ibx":{"tjs":"","cjs":"","miw":0,"mibcx":1,"te":1,"cart_rep":{"get":"","set":""},"ulpj":{"bxid":"espemailid"},"cus":"","miw_exclude":"","enabled":1},"etjson":null,"osre":true,"osru":"osr.bounceexchange.com/v1/osr/items","checkDfp":false,"gamNetwork":"","spa":1,"spatm":0,"preinit_cjs":"SinglePageApp.setCustomParams({\n shouldCheckSpa: function() {\n return !!window.br_data && window.br_data.ptype === 'product';\n }\n});\n\nSinglePageApp.setCustomParams({\n currentPageIdentifier: function() {\n return window.location.pathname;\n }\n});\n\n\n\nlet segments = {\n /* PROPERTIES */\n testMode: false,\n interceptEnabled: true,\n mirrorEnabled: true,\n arrayObserverEnabled: true,\n\n /* METHODS */\n /* Function to create orderArray from dataLayer */\n createOrderArray: function() {\n let eventData = (window.dataLayer || []).find(event => event.event === \"dataLayer.load.auto.dataLayer\");\n\n return (eventData?.lines || []).map(item => {\n let colourVariant = item.product.variants.find(variant => variant.type === 'colour');\n let productId = colourVariant ? 'sty-' + colourVariant.id : '';\n\n return {\n productId: productId,\n price: Number(item.value.net),\n qty: Number(item.quantity)\n };\n });\n },\n\n /* Intercept Events */\n useIntercept: function() {\n if (!this.interceptEnabled) return;\n\n bouncex.utils.shqInterceptEvent = {\n purchase: (wkndEventParams) => {\n let orderId = bouncex.utils.getNestedProp('obj.order_id', null, wkndEventParams);\n let purchTotal = (Number(wkndEventParams.amount) || 0) - (Number(wkndEventParams.shipping) || 0) - (Number(wkndEventParams.total_discount) || 0);\n\n let orderArray = this.createOrderArray();\n\n if (orderArray.length && orderId) {\n _shq.push(['onPurchase', {\n 'orderItems': orderArray,\n 'orderId': orderId,\n 'total': purchTotal.toFixed(2)\n }]);\n } else {\n _shq.push(['onPurchase', {\n 'orderId': orderId || 'NoOrderId-' + randomNumber(),\n 'usebasket': true\n }]);\n }\n }\n };\n },\n\n useMirror: function() {\n if (!this.mirrorEnabled) return;\n\n bouncex.utils.shqMirrorEvent = {\n 'reloadcampaigns': false,\n 'pageview': function() {\n if (bouncex.website.pts === 'category') {\n let catCode = bouncex.utils.getNestedProp('location.href').split('#').pop();\n if (catCode) {\n _shq.push(['onCategory', {\n 'catId': catCode,\n 'catName': catCode\n }]);\n }\n } else if (bouncex.website.pts === 'search') {\n let searchTerm = bouncex.utils.getParam('q').replace(/\\+/gi, ' ');\n if (searchTerm) {\n _shq.push(['onSearch', {\n 'searchPhrase': searchTerm\n }]);\n }\n }\n }\n };\n },\n\n capturePDP: function() {\n let prodID = bouncex.utils.getNestedProp('ShopifyAnalytics.meta.product.variants[0].id');\n if (prodID && window.location.href.includes('/products/')) {\n _shq.push(['onProductView', {\n 'productId': prodID.toString()\n }]);\n }\n },\n\n captureATC: function(obj) {\n let prodId = bouncex.utils.getNestedProp('variant_id', '', obj);\n let price = bouncex.utils.getNestedProp('price', 0, obj) / 100;\n let qty = bouncex.utils.getNestedProp('quantity', '', obj);\n\n if (prodId && qty && price) {\n _shq.push(['onCartAdd', {\n 'Items': [{\n 'ProductId': prodId.toString(),\n 'UnitPrice': price,\n 'Quantity': qty\n }]\n }]);\n }\n },\n\n captureCartview: function(obj) {\n if (obj.items && obj.items.length > 0) {\n let Total = obj.items_subtotal_price / 100 || 0;\n let Items = obj.items.map(k => ({\n 'UnitPrice': k.price / 100,\n 'Quantity': k.quantity,\n 'ProductId': k.variant_id.toString()\n }));\n\n _shq.push(['onCartView', {\n Items,\n Total\n }]);\n }\n },\n\n cartAJAX: function() {\n bouncex.setTimeout2(() => {\n if (bouncex.website.pts === 'cart') {\n bouncex.et.on(bouncex.document, 'ajaxComplete', (e, xhr, settings) => {\n if (settings.url.includes('/cart/add')) segments.captureATC(xhr.responseJSON);\n if (settings.url.includes('/cart/change')) segments.captureCartview(xhr.responseJSON);\n });\n }\n }, 700);\n },\n\n customProductView: function() {\n if (window.location.href.includes('starter-kit-oxygen-boost')) {\n let prodID = bouncex.utils.getNestedProp('ShopifyAnalytics.meta.product.variants[0].id');\n if (prodID) {\n _shq.push(['onProductView', {\n 'pageType': 'product',\n 'productId': prodID.toString()\n }]);\n }\n }\n },\n\n processObserver: function(e) {\n while (e.length) {\n let event = e.shift();\n if (bouncex.utils.getNestedProp('event', '', event) === 'thrive_add_to_cart') {\n segments.captureATC(event.itemsArray);\n }\n }\n },\n\n arrayObserver: function() {\n if (!this.arrayObserverEnabled) return;\n\n bouncex.et.onTrue(\n () => bouncex.utils.getNestedProp('window._shq.loaded'),\n () => {\n _shq.ArrayObserver(window.dataLayer, (e) => {\n segments.processObserver(e);\n }, { catchUp: true, filter: e => e.event });\n }\n );\n },\n\n /* Initialize Segments Tracking */\n init: function() {\n if (this.testMode && !bouncex.testmode.bxdev) return;\n if (!bouncex.utils) return;\n\n bouncex.utils.segments = this;\n this.useIntercept();\n this.useMirror();\n this.capturePDP();\n this.arrayObserver();\n this.cartAJAX();\n this.customProductView();\n }\n};\n\nsegments.init();\n\n\n\n","crs":{"integrations":null,"pageCount":null},"mat":0,"math":0,"cpnu":"coupons.bounceexchange.com","dfpcms":0,"sms":{"optm":"","eventSharing":true,"shqId":"5036vjg56p-1","enabled":1},"pde":true,"fmc":["AX","AL","AD","AM","AT","AZ","BY","BE","BA","BG","HR","CY","CZ","DK","EE","EU","FO","FI","FR","GI","GG","GE","DE","GR","HU","IM","IS","IE","IT","JE","LV","LI","LT","LU","MT","MD","MC","ME","NL","MK","NO","PL","PT","RO","SM","RS","SK","SI","ES","SJ","SE","CH","UA","GB","VA"],"fme":true,"fmx":".product-detail-gift-form-field-email #email","uid2":false,"sdk":{"android":{"enabled":false,"enabledVersions":[],"eventModifications":null},"ios":{"enabled":false,"enabledVersions":[],"eventModifications":null}},"onsite":{"enabled":1},"ads":{"enabled":0},"pubs":{"enabled":0},"websdk":{"enabled":0,"devMode":0},"ga4_property_id":"","ga4_measurement_id":"","tag_state_domain":"api.bounceexchange.com","tag_state_domain_enabled":false} ; bouncex.tag = 'tag3'; bouncex.$ = window.jQuery; bouncex.env = 'production'; bouncex.restrictedTlds = {"casl":{"ca":1},"gdpr":{"ad":1,"al":1,"at":1,"ax":1,"ba":1,"be":1,"bg":1,"by":1,"xn--90ais":1,"ch":1,"cy":1,"cz":1,"de":1,"dk":1,"ee":1,"es":1,"eu":1,"fi":1,"fo":1,"fr":1,"uk":1,"gb":1,"gg":1,"gi":1,"gr":1,"hr":1,"hu":1,"ie":1,"im":1,"is":1,"it":1,"je":1,"li":1,"lt":1,"lu":1,"lv":1,"mc":1,"md":1,"me":1,"mk":1,"xn--d1al":1,"mt":1,"nl":1,"no":1,"pl":1,"pt":1,"ro":1,"rs":1,"xn--90a3ac":1,"ru":1,"su":1,"xn--p1ai":1,"se":1,"si":1,"sj":1,"sk":1,"sm":1,"ua":1,"xn--j1amh":1,"va":1,"tr":1}}; bouncex.client = { supportsBrotli: 1 }; bouncex.assets = {"ads":"ba8ae19a5bf9548f3d50df1e54121805","creativesBaseStyles":"a53944a2","gpsAuction":"bbb80866120d17013073bb6d284cbd6b","inbox":"c5ffeacd3b77d074a53f2878c1332dc9","onsite":"c05f8c5551fa6b964660ad61916291c1","sms":"e39203556bab2366e56296ce42e974a7","websdk":"9c2817e65e803cb8c86d0410c88f20c1","website_campaigns_5562":"a9c89fc14a92211252d7adc088907f2b"}; bouncex.push = function(pushData) { bouncex.pushedData.push(pushData); } var runtime = document.createElement('script'); runtime.setAttribute('src', '//assets.bounceexchange.com/assets/smart-tag/versioned/runtime_c81e76ee00d795b1eebf8d27949f8dc5.br.js'); runtime.setAttribute('async', 'async'); bouncex.initializeTag = function() { var script = document.createElement('script'); script.setAttribute('src', '//assets.bounceexchange.com/assets/smart-tag/versioned/main-v2_593c276f770cc7539a00ca1a99a96e5c.br.js'); script.setAttribute('async', 'async'); document.body.appendChild(script); var deviceGraphScript = document.createElement('script'); deviceGraphScript.setAttribute('src', '//assets.bounceexchange.com/assets/smart-tag/versioned/cjs_min_c84323e2726f3e99b307ab7740c6434b.js'); deviceGraphScript.setAttribute('async', 'async'); var dgAttrs = [{"Key":"id","Value":"c.js"},{"Key":"async","Value":"true"},{"Key":"data-apikey","Value":"2^HIykD"},{"Key":"data-cb","Value":"bouncex.dg.initPostDeviceGraph"},{"Key":"data-bx","Value":"1"},{"Key":"data-gm","Value":"1"}]; if (dgAttrs) { for (var i = 0; i < dgAttrs.length; i++) { deviceGraphScript.setAttribute(dgAttrs[i].Key, dgAttrs[i].Value); } } document.body.appendChild(deviceGraphScript); bouncex.initializeTag = function() {}; }; runtime.onload = bouncex.initializeTag; document.body.appendChild(runtime); } window._shq = window._shq || []; var eventSharingCartridge = document.createElement('script'); eventSharingCartridge.setAttribute('src', '//assets.bounceexchange.com/assets/smart-tag/versioned/wknd_audiences_2648fa8509e4b3a98a2790bb8171ddc1.js'); eventSharingCartridge.setAttribute('async', 'async'); document.body.appendChild(eventSharingCartridge); } if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", bxBootstrap); } else { bxBootstrap(); }})();