(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":3875,"name":"True Botanicals","cookie_name":"bounceClientVisit3875","domain":"truebotanicals.com","ct":"fp_local_storage","ally":0,"ei":0,"tcjs":"","cjs":"jQuery(document).on('click.bx', '#rc_purchase_type_autodeliver', function(){\r\n if(jQuery(this).is(':checked')){\r\n bouncex.setv('clicked_autoreplenish', true);\r\n setBounceCookie();\r\n bouncex.reload_campaigns();\r\n }\r\n})\r\n\r\njQuery(document).on('click.bx', '#rc_purchase_type_onetime', function(){\r\n if(bouncex.vars.clicked_autoreplenish){\r\n bouncex.setv('clicked_autoreplenish', false);\r\n setBounceCookie();\r\n bouncex.reload_campaigns();\r\n }\r\n})","force_https":false,"waypoints":false,"content_width":900,"gai":"UA-52720022-1","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":0},"burls":[],"ple":false,"fbe":true,"ffs":"","mas":6,"map":5,"gar":true,"ete":1,"ettm":false,"etjs":"/* eslint sort-vars: 0 */\nvar ALLOWED_DOMAINS = ['truebotanicals.com'];\n\n/** ****** helper functions *********/\nfunction isValidDomain() {\n return ALLOWED_DOMAINS.indexOf(window.location.hostname) > -1;\n}\n\nfunction isExcluded() {\n var excludedPages = ['/pages/subscribe', '/gift-cards', 'giftcard'],\n url = window.location.pathname;\n for (var i = 0; i < excludedPages.length; i++) {\n if (url.indexOf(excludedPages[i]) > -1) {\n return true;\n }\n }\n return false;\n}\n\n\nfunction getStarReviews() {\n \n var starRatingElement = jQuery('.yotpo-stars .sr-only');\n var starRating = starRatingElement.length > 0 ? parseFloat(starRatingElement.text().split(' ')[0]) : null;\n var numReviewsElement = jQuery('.product__stars a');\n var numReviews = numReviewsElement.length > 0 ? parseInt(numReviewsElement.text().split(' ')[0]) : null;\n\n \n return starRating && numReviews && (starRating >= 4 && numReviews >= 10) ? starRating : null;\n}\n\nfunction getNumReviews() {\n\n var numReviewsElement = jQuery('.product__stars a');\n var numReviews = numReviewsElement.length > 0 ? parseInt(numReviewsElement.text().split(' ')[0]) : null;\n\n return numReviews;\n}\n\n\n\nfunction getItemId(miniCartUrl) {\n var url = miniCartUrl || getPageUrl();\n var prodMatch = url && url.match(/products\\/([^?#]+)/);\n var pageMatch = url && url.match(/pages\\/([^?#]+)/)\n\n if (prodMatch && prodMatch.length > 0) {\n return prodMatch[1];\n }\n \n if (pageMatch && pageMatch.length > 0) {\n return pageMatch[1];\n }\n\n}\n\nfunction getItemCopy() {\n return jQuery('meta[property=\"og:title\"]').attr('content') || jQuery('.product-info-title-header--mobile').text().trim();\n}\n\nfunction getItemCategory() {\n if (window.ShopifyAnalytics && window.ShopifyAnalytics.meta && window.ShopifyAnalytics.meta.product && window.ShopifyAnalytics.meta.product.type) {\n return window.ShopifyAnalytics.meta.product.type\n } else {\n return 'product';\n }\n}\n\nfunction getItemImage() {\n return jQuery('meta[property=\"og:image\"]').attr('content');\n}\n\nfunction getPageUrl() {\n return bouncex.utils.url.allowParams();\n}\n\nfunction getCategoryTitle() {\n return jQuery('.breadcrumbs-link:last').text().trim() || jQuery('meta[property=\"og:title\"]').attr('content').toLowerCase();\n}\n\nfunction getStock() {\n return bouncex.website.pts === 'product' && jQuery('meta[property=\"product:availability\"][content=\"instock\"]').length > 0;\n}\n\nfunction isTrialProduct() {\n var copy = getItemCopy();\n\n return copy.indexOf('Mini') > -1 ? true : false;\n}\n\nfunction isExludedIds(productId) {\n var EXCLUSIONS_SKU = ['anti-aging-antioxidants-super-set', '3-step-glowy-skin-reset', 'renew-glowy-skin-confidence-set', \n 'clear-glowy-confidence-skincare-set', 'renew-anti-aging-vitamin-c-set', 'clear-anti-aging-niacinamide-set', \n 'bright-eyes-trio', 'hydrating-skincare-set', 'ceramides-glowy-skin-glossy-hair-set', 'remarkable-radiance-set', \n 'glowy-bestsellers-starter-kit', 'radiant-glow-head-to-toe-set', 'a-m-to-p-m-phyto-retinol-set', 'the-microbiome-renewal-set', \n 'clear-glassy-dewy-winter-skin', 'renew-glassy-dewy-winter-skin-set', 'renew-glowy-skintellectual-vault', 'clear-glowy-skintellectual-vault'];\n \n return EXCLUSIONS_SKU.indexOf(productId) > -1\n}\n\n/** ****** item tracking *********/\nfunction buildItem() {\n var item = {\n id: getItemId(),\n copy: getItemCopy(),\n category: getItemCategory(),\n imageurl: getItemImage(),\n url: getPageUrl(),\n instock: getStock(),\n trialproduct: isTrialProduct(),\n starreviews: getStarReviews(),\n numreview: getNumReviews(),\n excluded: isExludedIds(getItemId()),\n };\n return item;\n}\n\nfunction trackATCPDP(item){\n bouncex.et.on(jQuery(document), 'click.bxsku', function() {\n var item = buildItem();\n if(item.id == \"jessica-chastain\"){\n item.id = \"get-glowing-essentials-set\";\n }\n if(item && item.id){\n fireAddToCart(item.id)\n }\n }, '#AddToCart');\n \n \n \n\n bouncex.et.on(jQuery(document), 'click.bxsku', function() {\n var itemId = \"\";\n var bundleParent = jQuery(this).parents('.bundle__item');\n var cardParent = jQuery(this).parents('.card');\n if(bundleParent.length > 0){\n var itemHref = bundleParent.find('a:first').attr('href');\n if(itemHref != \"\"){\n itemId = itemHref.match(/products\\/([^?#]+)/)[1];\n }\n \n } else if(cardParent.length > 0){\n var itemHref = cardParent.find('h3 a:first').attr('href');\n if(itemHref != \"\"){\n itemId = itemHref.match(/products\\/([^?#]+)/)[1];\n }\n }\n\n if(item.id == \"jessica-chastain\"){\n item.id = \"get-glowing-essentials-set\";\n }\n if(itemId){\n fireAddToCart(itemId)\n }\n }, '.gtm-add-to-cart');\n //fireAddToCart(id);\n}\n\nfunction trackItem() {\n var item = buildItem();\n if (item.id && item.imageurl && item.imageurl.indexOf(\"logotype\") == -1) {\n item.groupId = bouncex.utils.getNestedProp('afterpay_product.id', '') || bouncex.utils.getNestedProp('meta.product.id', '');\n initializeSkuEvents(item);\n trackATCPDP(item)\n bouncex.push(['item', item]);\n bouncex.push(['view item', {\n 'item:id': item.id,\n 'item:itemgroupid': item.groupId\n }]);\n }\n \n //custom page tracking\n if(item.id == \"jessica-chastain\"){\n item.id = \"get-glowing-essentials-set\";\n item.groupId = \"7429762089034\";\n trackATCPDP(item)\n bouncex.push(['view item', {\n 'item:id': item.id,\n 'item:itemgroupid': item.groupId\n }]);\n }\n}\n\n// function trackQuizItem() {\n// var itemId = getQuizItemId();\n// if (itemId) {\n// bouncex.push(['view item', {\n// 'item:id': itemId\n// }]);\n// }\n// }\n\n/** ****** category tracking *********/\nfunction getItemsIds() {\n return jQuery('.productGrid__item .productGrid__ProductImage a, .snize-product a, .grid__item .card__heading a').map(function () {\n var itemId = getItemId(jQuery(this).attr('href') || '');\n\n if (itemId) {\n return itemId;\n }\n\n }).toArray().join(',');\n}\n\nfunction trackCategory() {\n var itemsIds = getItemsIds();\n if (itemsIds && itemsIds.length) {\n bouncex.push(['view category', {\n 'items:ids': itemsIds,\n 'page:title': getCategoryTitle(),\n 'page:url': bouncex.utils.url.allowParams('q')\n }]);\n }\n}\n\n/* ------------------------------ SKU TRACKING ------------------------------ */\n\nfunction initializeSkuEvents(item) {\n var skuObj = {\n id: item.id || '',\n groupId: item.groupId || '',\n skuId: '',\n },\n skuId = '';\n\n skuId = bouncex.utils.getNestedProp('afterpay_current_variant.id', '') || bouncex.utils.getNestedProp('item.ProductID', '') || skuId;\n\n if (skuObj.skuId === skuId) {\n return;\n }\n\n skuObj.skuId = skuId;\n bouncex.push([\n 'select_sku',\n {\n 'item:id': skuObj.id,\n 'item:itemgroupid': skuObj.groupId,\n 'item:feedid': skuObj.skuId\n }\n ]);\n return;\n}\n\n/** ****** Cart tracking **********/\nfunction trackAJAXCart(e, xhr, settings) {\n if (\n settings.url.indexOf('/cart/add') > -1\n && !bouncex.utils.url.getParam('bx_cart')\n && settings.type === 'POST'\n && xhr.status === 200\n ) {\n // we need to account for multiple items being added\n var items = bouncex.utils.getNestedProp('responseJSON.items', false, xhr) || [bouncex.utils.getNestedProp('responseJSON', {}, xhr)];\n\n items.forEach(function (item) {\n var id = getItemId(bouncex.utils.getNestedProp('url', '', item)),\n dataString = decodeURI(settings.data),\n isAddOn = bouncex.utils.url.getParam('properties[free]', dataString);\n if (!id || !dataString || isAddOn === 'true') {\n return;\n }\n\n fireAddToCart(id);\n });\n }\n}\n\nfunction fireAddToCart(id) {\n var cookie;\n bouncex.et.onTrue(function () {\n cookie = bouncex.getBounceCookie('cart');\n return cookie;\n }, function () {\n bouncex.push(['add to cart', {\n 'item:id': id,\n 'cart:token': bouncex.getBounceCookie('cart')\n }]);\n\n bouncex.setv('ibx_atc_once', true);\n // eslint-disable-next-line no-undef\n setBounceCookie();\n });\n}\n\n/* track empty cart */\nfunction trackEmptyCart() {\n if (bouncex.vars.ibx_atc_once && bouncex.website.pts === 'cart') {\n if (jQuery('.supports-cookies:visible').text().toLowerCase().indexOf('cart is currently empty') > -1) {\n fireEmptyCart();\n }\n }\n bouncex.et.onVarChange('cart_qty', function () {\n if (bouncex.vars.cart_qty === 0) {\n fireEmptyCart();\n }\n });\n\n bouncex.et.on(bouncex.document, 'ajaxComplete.bx', trackAJAXCart);\n}\n\nfunction fireEmptyCart() {\n bouncex.push(['empty_cart']);\n bouncex.setv('ibx_atc_once', false);\n // eslint-disable-next-line no-undef\n setBounceCookie();\n}\n\n\n/** ****** user tracking *********/\n\nfunction trackLoggedInUser() {\n if (bouncex.vars.logged_in && !bouncex.vars.logged_in_identified) {\n var email = getEmail() || (bouncex.getBounceCookie('attntv_mstore_email') || '').replace(/:0$/g, '');\n\n if (!bouncex.utils.validate.email(email)) {\n return;\n }\n\n bouncex.push([\n 'user',\n {\n email: email,\n source: 'LoggedIn'\n }\n ]);\n bouncex.setv('logged_in_identified', true);\n // eslint-disable-next-line no-undef\n setBounceCookie();\n }\n}\n\nfunction getEmail() {\n if (window.dataLayer) {\n for (var i = 0; i < window.dataLayer.length; i++) {\n if (window.dataLayer[i].customer && window.dataLayer[i].customer.email) {\n return window.dataLayer[i].customer.email;\n }\n }\n }\n return false;\n}\n\nfunction replenish(cart) {\n bouncex.utils.cookies.create({\n name: 'cart',\n value: cart.token\n });\n\n window.location.href = window.location.pathname + '?bx_replen=true';\n}\n\n/** ****** itiniate tracking code *********/\nif (isValidDomain() && !isExcluded()) {\n trackLoggedInUser();\n\n bouncex.et.cart.init({\n replenish: replenish,\n replenishmentType: 'cookie'\n });\n trackEmptyCart();\n\n switch (bouncex.website.pts) {\n case 'product':\n trackItem();\n break;\n case 'category':\n case 'search':\n case 'quiz_results':\n trackCategory();\n break;\n default:\n break;\n }\n}","dge":true,"bxidLoadFirst":false,"pie":true,"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":"document.querySelectorAll(\".collection__productCount\").length > 0 ||\n\tbouncex.utils.getNestedProp(\"ShopifyAnalytics.meta.page.pageType\", \"\") ===\n\t\t\"collection\";"}],[{"activation":"current_page_url","prop":"not_contains","prop2":"","prop3":"","val":"gift-card"}]]},"checkout":{"testmode":false,"val":[[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"/checkouts/"},{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"subscriptions.truebotanicals.com/r/"},{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"/checkout"}]]},"home":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"bouncex.utils.getNestedProp(\"ShopifyAnalytics.meta.page.pageType\", \"\") ===\n\t\"home\";"}]]},"product":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"document.querySelectorAll(\".product__form\").length > 0 ||\n\tbouncex.utils.getNestedProp(\"ShopifyAnalytics.meta.page.pageType\", \"\") ===\n\t\t\"product\";"}]]},"quiz_results":{"testmode":false,"val":[[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"quiz-results"},{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"quiz-2-0-result"}]]},"search":{"testmode":false,"val":[[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"/pages/search-results-page?"}]]}},"els":{"CART - Checkout Button":"","CART - Promo Code Apply Button":"","CART - Promo Code Box":"","CAT - Product Grid Image":"","CAT - Quickview Box":"","CAT-AddtoCartButton":"","CAT-QuickviewAddtoCart":"","Footer":"","Navigation bar":"","PDP - Add to Cart Button":"button#AddToCart","PDP - Color Option":"","PDP - Hero Image":"","PDP - Product Name":"","PDP - Product Price":".product-info-title-price-header span","PDP - Quantity Option":"","PDP - Review Stars":"","PDP - Size Option":"","PDP - Thumbnail Image":"","SEARCH - Product Grid Image":""},"vars":[{"name":"logged_in","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"(function () {\n\tvar $acctInfoAvailable = jQuery(\".c-customerInformation__accountInfo\");\n\n\tif (bouncex.website.pts === \"checkout\") {\n\t\tif ($acctInfoAvailable)\n\t\t\treturn (\n\t\t\t\t$acctInfoAvailable.text().toLowerCase().indexOf(\"log out\") > -1\n\t\t\t);\n\n\t\treturn jQuery('.breadcrumb__item--current:contains(\"Information\")')\n\t\t\t.length > 0\n\t\t\t? jQuery(\".logged-in-customer-information:visible\").length > 0\n\t\t\t: null;\n\t}\n\n\treturn !!bouncex.utils.getNestedProp(\n\t\t\"ShopifyAnalytics.meta.page.customerId\"\n\t);\n})();","trigger":""},{"name":"ever_logged_in","polling":"all","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\tvar count = 0;\n\tif (bouncex.website.pts === \"checkout\") {\n\t\tjQuery(\"#order-summary .product-thumbnail__quantity\").each(function () {\n\t\t\tcount += Number(jQuery(this).text());\n\t\t});\n\t\treturn count || null;\n\t}\n if(bouncex.website.pts === \"cart\"){\n return jQuery('.c-cart__product').length\n }\n\treturn Number(jQuery(\".c-cart__count, .cart__count, .rebuy-cart__flyout-subtotal-label\").first().text().replace(/[^0-9.]/g, \"\"));\n})();","trigger":""},{"name":"cart_value","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"0","code":"(function () {\n\tvar $miniCartVal = jQuery(\"#cart-subtotal, .rebuy-cart__flyout-subtotal-amount, .rebuy-cart__flyout-subtotal-final-amount\");\n\n\tif (\n\t\t$miniCartVal.text() === \"$ 0.00\" ||\n\t\tjQuery(\".c-cart__emptyText:visible\").length > 0\n\t) {\n\t\treturn 0;\n\t}\n\n\tif (bouncex.website.pts === \"checkout\") {\n\t\treturn (\n\t\t\tNumber(\n\t\t\t\tjQuery(\n\t\t\t\t\t\".c-orderTotals__lineValue:last, .order-summary__section .total-line--subtotal .total-line__price\"\n\t\t\t\t)\n\t\t\t\t\t.text()\n\t\t\t\t\t.replace(/[^0-9.]/g, \"\")\n\t\t\t) || null\n\t\t);\n\t}\n\n\treturn Number($miniCartVal.text().replace(/[^0-9.]/g, \"\")) || null;\n})();","trigger":""},{"name":"prod_price","polling":"all","persist":"no","page_types":["product"],"testmode":false,"default":"false","code":"Number(\n\t(\n\t\tjQuery(\".cu-productTypeSelect__price--onetime\").text() ||\n\t\tjQuery(\"#product-price\").text() ||\n\t\tjQuery(\"#AddToCart .link__finalPrice:first\").text()\n\t).replace(/[^0-9.]/g, \"\")\n);","trigger":""},{"name":"prod_name","polling":"all","persist":"no","page_types":["product"],"testmode":false,"default":"false","code":"jQuery('meta[property=\"og:title\"]').attr(\"content\");","trigger":""},{"name":"in_stock","polling":"all","persist":"no","page_types":["product"],"testmode":false,"default":"false","code":"bouncex.website.pts === 'product' && jQuery('meta[property=\"product:availability\"][content=\"instock\"]').length > 0;","trigger":""},{"name":"submitted_onsite","polling":"all","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"jQuery(\".newsletterForm__successs:visible\").length > 0 || null;","trigger":""},{"name":"item_id_product","polling":"none","persist":"no","page_types":["product"],"testmode":true,"default":"false","code":"","trigger":""},{"name":"item_id_quickview","polling":"none","persist":"no","page_types":[],"testmode":true,"default":"false","code":"","trigger":"event"},{"name":"item_id_hover","polling":"none","persist":"no","page_types":[],"testmode":true,"default":"false","code":"","trigger":"event"},{"name":"items_ids","polling":"none","persist":"no","page_types":["category","search"],"testmode":true,"default":"false","code":"","trigger":""},{"name":"item_url","polling":"none","persist":"no","page_types":["product"],"testmode":true,"default":"false","code":"","trigger":""},{"name":"item_image_url","polling":"none","persist":"no","page_types":["product"],"testmode":true,"default":"false","code":"","trigger":""},{"name":"item_category","polling":"none","persist":"no","page_types":["product"],"testmode":true,"default":"false","code":"","trigger":""},{"name":"item_price","polling":"none","persist":"no","page_types":["product"],"testmode":true,"default":"false","code":"","trigger":""},{"name":"item_in_stock","polling":"none","persist":"no","page_types":["product"],"testmode":true,"default":"false","code":"","trigger":""},{"name":"page_url","polling":"none","persist":"no","page_types":["category","search"],"testmode":true,"default":"false","code":"","trigger":""},{"name":"page_title","polling":"none","persist":"no","page_types":["category"],"testmode":true,"default":"false","code":"","trigger":""},{"name":"item_copy","polling":"none","persist":"no","page_types":["product"],"testmode":true,"default":"false","code":"","trigger":"pageload"},{"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":"ibx_atc_once","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"cart","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"logged_in_identified","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"clicked_autoreplenish","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"event"},{"name":"page_type","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"bouncex.website.pts;","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":1,"mibcx":1,"te":1,"cart_rep":{"get":"","set":""},"ulpj":{"bxid":"espemailid"},"cus":"","miw_exclude":"#fb-email-to","enabled":1},"etjson":null,"osre":true,"osru":"osr.bounceexchange.com/v1/osr/items","checkDfp":false,"gamNetwork":"","spa":0,"spatm":1,"preinit_cjs":"var segments = {\n /* PROPERTIES */\n testMode: false,\n interceptEnabled: true,\n mirrorEnabled: true,\n arrayObserverEnabled: true,\n /* METHODS */\n /* Intercept Events */\n useIntercept: function () {\n if (this.interceptEnabled) {\n bouncex.utils.shqInterceptEvent = {\n // true blocks event, defined functions run in place of default\n 'productView': true,\n 'cartAdd': true,\n 'categoryView': true,\n 'purchase': true,\n\n };\n }\n },\n /* Mirror Events */\n useMirror: function () {\n if (this.mirrorEnabled) {\n bouncex.utils.shqMirrorEvent = {\n // defined functions run after designated shq_wknd_event to process event or source names\n 'reloadcampaigns': false,\n 'pageview': function (obj) {\n var catCode = window.location && window.location.pathname ? location.pathname.split('/')[location.pathname.split('/').length - 1].trim() : '';\n if (bouncex.website.pts === 'category' && catCode) {\n _shq.push(['pageView',\n {\n 'pageType': 'category',\n 'catName': catCode,\n 'catId': catCode\n }]);\n }\n if (bouncex.website.pts === 'search') {\n var searchTerm = bouncex.utils.getParam('q').replace(/\\+/gi, ' ');\n if (searchTerm) {\n _shq.push(['pageView',\n {\n 'pageType': 'search',\n 'searchPhrase': searchTerm\n }]);\n }\n }\n }\n };\n }\n },\n processObserver: function processObserver(aoItems) {\n // aoItems will be an array of objects\n while (aoItems.length) {\n var e = aoItems.shift();\n //item variable will contain the object to process.\n //PDP\n if (e && e.event === 'dl_view_item') {\n //PDP event\n this.capturePDP(e);\n }\n //Add to Cart & Cart View\n if (e && (e.event === 'dl_add_to_cart' || e.event === 'dl_view_cart')) {\n this.captureCart();\n }\n if (e && e.event === 'dl_remove_from_cart') {\n this.removeCart(e);\n }\n if (e && e.event === 'dl_purchase') {\n this.capturePurchase(e);\n }\n //Capture User Begins SkinCare Quiz\n if (e && e.event === 'gtm.click' && e['gtm.element'] && e['gtm.element'].innerHTML === 'Begin the quiz') {\n _shq.push(['pageView',\n {\n 'pageType': 'category',\n 'catName': 'BeginSkinQuiz',\n 'catId': 'BeginSkinQuiz'\n }]);\n }\n }\n },\n\n /**\n * \n * @param {Array} a - array to be watched\n * @param {Function} cb - Initial subscriber function to be registered and called upon array growth\n * @param {object} settings - object delivering observer settings (catchUp,filter,intervalms)\n *\n */\n arrayObserver: function arrayObserver() {\n var _this = this;\n\n if (!this.arrayObserverEnabled) {\n return;\n }\n bouncex.et.onTrue(function () {\n return bouncex.utils.getNestedProp('window._shq.loaded');\n }, function () {\n _shq.ArrayObserver(window.dataLayer, function (e) {\n _this.processObserver(e);\n },{catchUp:true});\n });\n },\n\n capturePDP: function (obj) {\n var prodID = bouncex.utils.getNestedProp('ecommerce.detail.products[0].product_id', '', obj) || document.querySelector('form[action=\"/cart/add\"] input[type=\"hidden\"]').value;\n if (prodID) {\n _shq.push(['pageView',\n {\n 'pageType': 'product',\n 'productId': prodID.toString(),\n 'scraped_products': [{\n 'productId_scraped': prodID\n }]\n }]);\n }\n },\n captureCustomProdDetails: function (arr) {\n //Capturing custom product details for subscription\n var customDataObj = [];\n if (arr && arr.length > 0) {\n for (var i = 0; i < arr.length; i++) {\n var thisOne = arr[i],\n pID = thisOne && thisOne.product_id ? thisOne.product_id.toString() : '',\n frequency = bouncex.utils.getNestedProp('properties.Subscription', '', thisOne),\n intervalUnit = thisOne && thisOne.properties ? thisOne.properties['Interval Unit'] : '';\n\n if (thisOne && thisOne.frequencies) {\n customDataObj.push({\n 'productId_scraped': pID,\n 'is_subscription': true,\n 'frequency': frequency,\n 'subscription_unit': intervalUnit\n });\n } else {\n customDataObj.push({\n 'productId_scraped': pID,\n 'is_subscription': false\n });\n }\n }\n //Firing Custom Product\n if (customDataObj.length > 0) {\n _shq.push(['onCustomProduct', customDataObj]);\n }\n }\n },\n captureCart: function () {\n\n var arrItems = bouncex.utils.getNestedProp('CartJS.cart.items', [], window);\n\n if (arrItems && arrItems.length > 0) {\n var cartItems = [];\n var cartTotal = 0.00;\n for (var i = 0; i < arrItems.length; i++) {\n var thisOne = arrItems[i], price = null, pid = '', qty = null;\n\n pid = thisOne && thisOne.product_id ? thisOne.product_id.toString() : '';\n price = thisOne && thisOne.properties && thisOne.properties['Subscription Amount'] ? Number(thisOne.properties['Subscription Amount'].replace('$', '')).toFixed(2) : Number(thisOne.discounted_price) / 100;\n qty = bouncex.utils.getNestedProp('quantity', '', thisOne);\n\n //Running Cart Total\n cartTotal += Number(price) * Number(qty);\n\n if (pid && !isNaN(price) && qty) {\n cartItems.push({\n \"productId\": pid,\n \"UnitPrice\": Number(price),\n \"qty\": qty\n });\n }\n }\n\n if (cartItems && cartItems.length > 0 && cartTotal > 0) {\n\n _shq.push(['onCartView', {\n 'Items': cartItems,\n 'Total': cartTotal\n }]);\n\n\n this.captureCustomProdDetails(arrItems);\n }\n }\n },\n removeCart: function (obj) {\n var prodId = bouncex.utils.getNestedProp('ecommerce.remove.products[0].variant_id', '', obj);\n var qty = Number(bouncex.utils.getNestedProp('ecommerce.remove.products[0].quantity', '', obj));\n if (prodId) {\n _shq.push(['onCartRemove', {\n Items: [{\n 'ProductId': prodId,\n 'Quantity': qty\n }],\n }]);\n }\n },\n capturePurchase: function (obj) {\n var prodErr = false;\n var subArray = bouncex.utils.getNestedProp('Shopify.checkout.line_items', [], window);\n var orderId = bouncex.utils.getNestedProp('ecommerce.purchase.actionField.order_name', '', obj);\n var purchTotal = bouncex.utils.getNestedProp('ecommerce.purchase.actionField.product_sub_total', 0, obj);\n var orderInfo = bouncex.utils.getNestedProp('ecommerce.purchase.products', null, obj);\n var orderArray = orderInfo && orderInfo.map(function (ea) {\n return { productId: ea.variant_id, price: Number(ea.price).toFixed(2), qty: Number(ea.quantity) };\n });\n\n if (orderArray.length < 1) {\n prodErr = true;\n }\n\n if (!prodErr && orderId) {\n _shq.push(['pageView',\n {\n 'pageType': 'purchase',\n 'orderItems': orderArray,\n 'orderId': orderId,\n 'total': Number(purchTotal)\n }]);\n\n this.captureCustomProdDetails(subArray);\n\n } else {\n _shq.push(['pageView',\n {\n 'pageType': 'purchase',\n 'orderId': orderId || 'NoOrderId-' + randomNumber(),\n 'usebasket': true\n }]);\n }\n },\n captureSkinQuiz: function () {\n\n var curURL = window.location && window.location.pathname ? window.location.pathname.split('/')[window.location.pathname.split('/').length - 1].trim() : '';\n if (curURL && (curURL.indexOf('skin-quiz-home') > -1 || curURL.indexOf('quiz-results') > -1)) {\n //capture when user is on Quiz Home page or completes quiz\n _shq.push(['pageView',\n {\n 'pageType': 'category',\n 'catName': curURL,\n 'catId': curURL\n }]);\n\n if (curURL.indexOf('quiz-results') > -1) {\n //First removeall previous quiz result sets if existed\n _shq.push(['onProductList', { customList: true, listId: 'quiz_long_am', action: 'removeall' }]);\n _shq.push(['onProductList', { customList: true, listId: 'quiz_long_pm', action: 'removeall' }]);\n _shq.push(['onProductList', { customList: true, listId: 'quiz_long_all', action: 'removeall' }]);\n\n //Grab Quiz Long AM/PM Results\n var arrLongPMObj = bouncex.utils.getNestedProp('longPmCategories', [], window);\n var arrLongAMObj = bouncex.utils.getNestedProp('longAmCategories', [], window);\n var arrLongALL = [];\n\n var arrLongAM = arrLongAMObj && arrLongAMObj.map(function (ea) {\n return { prodId: ea.products[0].id.toString() };\n });\n var arrLongPM = arrLongPMObj && arrLongPMObj.map(function (ea) {\n return { prodId: ea.products[0].id.toString() };\n });\n\n for (var y = 0; y < arrLongAM.length; y++) {//Add AM results to quiz_long_am list\n _shq.push(['onProductList', { customList: true, listId: 'quiz_long_am', action: 'add', productId: arrLongAM[y].prodId }]);\n arrLongALL.push({\n \"prodId\": arrLongAM[y].prodId\n });\n }\n for (var x = 0; x < arrLongPM.length; x++) {//Add PM results to quiz_long_pm list\n _shq.push(['onProductList', { customList: true, listId: 'quiz_long_pm', action: 'add', productId: arrLongPM[x].prodId }]);\n arrLongALL.push({\n \"prodId\": arrLongPM[x].prodId\n });\n }\n for (var a = 0; a < arrLongALL.length; a++) {//Add ALL results to quiz_long_all list\n _shq.push(['onProductList', { customList: true, listId: 'quiz_long_all', action: 'add', productId: arrLongALL[a].prodId }]);\n }\n }\n }\n },\n captureCustomCategory: function () {\n if (location.href.indexOf('/pages/chebula-antioxidant-serum-kit') > -1) {\n _shq.push(['onCategory',\n {\n 'catName': 'chebula-antioxidant-serum-kit',\n 'catId': 'chebula-antioxidant-serum-kit'\n }]);\n }\n },\n\n /* Initialize Segments Tracking */\n init: function () {\n // test mode\n if (this.testMode && !bouncex.testmode.bxdev) return;\n // attach object to window & bouncex.utils\n if (bouncex.utils) bouncex.utils.segments = this;\n\n // initialize intercept and mirror, comment out if not needed\n this.useIntercept();\n this.useMirror();\n this.captureSkinQuiz();\n this.captureCustomCategory();\n this.arrayObserver();\n }\n};\n\nsegments.init();","crs":{"integrations":null,"pageCount":null},"mat":0,"math":0,"cpnu":"coupons.bounceexchange.com","dfpcms":0,"sms":{"optm":"Hit 'Send' to sign-up for automated, recurring True Botanicals mktg txts (like cart reminders) to this #, per terms.","eventSharing":true,"shqId":"jdceim5zm6-1","enabled":1},"pde":true,"fmc":["US","CA"],"fme":true,"fmx":"#fb-email-to","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":"262325584","ga4_measurement_id":"G-QZ2P1SCZ4C","tag_state_domain":"api.bounceexchange.com"} ; 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":"1cd8cbf5ae67db4a14f8b3ed5c22b39d","creativesBaseStyles":"a53944a2","gpsAuction":"bbb80866120d17013073bb6d284cbd6b","inbox":"75060a85c1a4aebcc6f779b9e84db722","onsite":"abbdf7a49be9b52b097917b7b527b262","sms":"e39203556bab2366e56296ce42e974a7","websdk":"04cde0014774b7eb597770595769aab1"}; 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_998b660150b546f63d32b9b44e9e7ca3.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_3a843477d8e318f67237a66d0a58c542.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"},{"Key":"data-fire","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(); }})();