(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 = []; var pushedClientEvents = []; if(window.bouncex && bouncex.push && bouncex.length){ pushedData = bouncex; } if (window.bouncex && bouncex.clientEvents && bouncex.clientEvents.length) { pushedClientEvents = bouncex.clientEvents; } window.bouncex = {}; bouncex.pushedData = pushedData; bouncex.pushedClientEvents = pushedClientEvents; bouncex.website = {"id":3873,"name":"BrainMD","cookie_name":"bounceClientVisit3873","domain":"brainmd.com","ct":"multi_cookie","ally":0,"ei":0,"tcjs":"","cjs":"bouncex.infoStore = {\n sessionStorageIdentifier: 'bxInfoStore',\n set: function(data) {\n var hashedData = bouncex.lz.compressToURI(JSON.stringify(data));\n try {\n sessionStorage.setItem(this.sessionStorageIdentifier, hashedData);\n } catch(e) {\n bouncex.err('session storage failure');\n }\n },\n \n get: function() {\n var info = sessionStorage.getItem(this.sessionStorageIdentifier);\n return info ? JSON.parse(bouncex.lz.decompressFromURI(info)) : '';\n },\n \n infoIsStored: function() {\n return !!sessionStorage.getItem(this.sessionStorageIdentifier);\n },\n \n populateFields: function(fields) {\n if (!this.infoIsStored()) return;\n \n var data = this.get();\n for (var field in fields) {\n if (fields.hasOwnProperty(field)) {\n fields[field].val(data[field]);\n }\n }\n }\n};\n\nif (bouncex.testmode.bxdev) {\n\tvar bxGa = bouncex.report_ga;\n\tbouncex.report_ga = function(action, label, bypass) {\n\t\tvar submitType = label.split(' - ').shift();\n\t\t\n\t\tif (action === 'submission') {\n\t\t\tif (submitType === 'EMAIL' || submitType === 'TEXT') {\n\t\t\t\tbxGa(action, label, bypass);\n\t\t\t}\n\t\t} else {\n\t\t\tbxGa(action, label, bypass);\n\t\t}\n\t};\n}\n\n/* --------------------------- INITIALIZE SHOPIFY DYNAMIC COUPON AUTOAPPLY -------------------------- */\nfunction initShopifyCouponAutoApply() {\n var isShopifyHostedTheme = !!bouncex.utils.getNestedProp('Shopify.theme.id');\n\n if (isShopifyHostedTheme) {\n bouncex.off(bouncex.window, 'bxCouponFetched.bx-cpn-auto-apply');\n bouncex.on(bouncex.window, 'bxCouponFetched.bx-cpn-auto-apply', function(event, params) {\n if (params.code !== bouncex.vars.coupon_auto_applied) {\n ajaxShopifyAutoApply(params.code);\n }\n });\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 dataType: 'text',\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\ninitShopifyCouponAutoApply();","force_https":false,"waypoints":false,"content_width":900,"gai":"UA-22945161-1","swids":"","sd":0,"ljq":"auto","campaign_id":0,"is_preview":false,"aco":{"first_party_limit":"3500","local_storage":"1"},"cmp":{"gdpr":0,"gmp":0,"whitelist_check":1},"burls":[],"ple":false,"fbe":true,"ffs":"DISABLE_IOS_ABSOLUTE","mas":2,"map":1,"gar":true,"ete":1,"ettm":false,"etjs":"/* ---------------------------- STANDARD VARIABLES ---------------------------- */\r\n\r\nvar CART_COOKIE_KEY = 'cart',\r\n CLEAN_URL = bouncex.utils.url.allowParams(),\r\n ROOT_DOMAIN = window.location.hostname.replace('www.', '');\r\n\r\n/* --------------------------------- CUSTOMIZATION VARIABLES -------------------------------- */\r\n\r\nvar soldOutItemsOnSite = true,\r\n pdpAtcSelector = 'form[action=\"/cart/add\"] button[type=\"submit\"], button[name=\"add\"]',\r\n quickAtcSelector = 'button.product-card__atc',\r\n rebuyAtcSelector = '.rebuy-product-actions button:contains(Add)',\r\n outOfStockSelector = '';\r\n\r\n\r\n/* --------------------------------- CLIENT SPECIFIC FUNCTIONALITY -------------------------------- */\r\n\r\nvar CATALOG = false,\r\nQUICKVIEW = false,\r\nQUICKADD = true;\r\n/* --------------------------------- HELPERS -------------------------------- */\r\n\r\nfunction getItemId(url){\r\n if (!url){\r\n return '';\r\n }\r\n\r\n return bouncex.utils.url.allowParams([], url).replace(/\\/$/g, '').split('/').pop();\r\n}\r\n\r\nfunction getGroupId(){\r\n return bouncex.utils.getNestedProp('ShopifyAnalytics.meta.product.id', '') ||\r\n bouncex.utils.getNestedProp('__st.rid', '');\r\n}\r\n\r\nfunction getItemCopy(){\r\n return jQuery('.shopify-section h1, h1.product__title').first().text().trim() || '';\r\n}\r\n\r\nfunction getItemCategory(){\r\n return bouncex.utils.getNestedProp('ShopifyAnalytics.meta.product.type') || 'Global';\r\n}\r\n\r\nfunction getItemImage(){\r\n var imgElement = jQuery('.product__media-gallery-viewer .product__media-item:not(.swiper-slide-duplicate) img'),\r\n imgUrl = jQuery(imgElement).attr('src') || jQuery(imgElement).attr('srcset');\r\n\r\n if (!imgUrl){\r\n return false;\r\n }\r\n\r\n imgUrl = bouncex.utils.url.allowParams([], imgUrl.replace(/\\s+/g, ''));\r\n\r\n if (imgUrl.indexOf('http') === -1){\r\n return 'https:' + imgUrl;\r\n }\r\n\r\n return imgUrl;\r\n}\r\n\r\nfunction getItemInStock(){\r\n if (!soldOutItemsOnSite){\r\n return true;\r\n }\r\n\r\n if (outOfStockSelector && jQuery(outOfStockSelector).length > 0){\r\n return false;\r\n }\r\n\r\n return jQuery(pdpAtcSelector).length > 0 ? !jQuery(pdpAtcSelector).is(':disabled') && jQuery(pdpAtcSelector).is(':visible') : true;\r\n}\r\n\r\n/* ------------------------------ ITEM TRACKING ----------------------------- */\r\n\r\nfunction getItem() {\r\n return {\r\n id: getItemId(CLEAN_URL),\r\n copy: getItemCopy(),\r\n category: getItemCategory(),\r\n url: CLEAN_URL,\r\n imageurl: getItemImage(),\r\n instock: getItemInStock()\r\n };\r\n}\r\n\r\nfunction fireViewItem(id, groupId) {\r\n var pushItem = { 'item:id': id };\r\n\r\n if (groupId) {\r\n pushItem['item:itemgroupid'] = groupId;\r\n }\r\n bouncex.push(['view item', pushItem]);\r\n}\r\n\r\nfunction initializeItemEvents() {\r\n var item;\r\n\r\n bouncex.et.onTrue(\r\n function () {\r\n item = getItem();\r\n return !!item.id &&\r\n !!item.copy &&\r\n !!item.category &&\r\n !!item.url &&\r\n !!item.imageurl;\r\n },\r\n function () {\r\n if (item.url.indexOf('gift-card') > -1) {\r\n return;\r\n }\r\n bouncex.push(['item', item]);\r\n\r\n if (CATALOG){\r\n item.groupId = item.id;\r\n initializeSkuEvents(item.id, item.groupId);\r\n }\r\n\r\n fireViewItem(item.id, item.groupId);\r\n initializeATCClickTracking(item.id);\r\n },\r\n 10\r\n );\r\n}\r\n\r\n/* ---------------------------- CATEGORY TRACKING --------------------------- */\r\n\r\nfunction getTileSelector(){\r\n var tileSelectors = ['div.product-card a[href]'],\r\n main = '#MainContent ',\r\n tileSelector;\r\n\r\n for (var i = 0; i < tileSelectors.length; i++){\r\n if (jQuery(tileSelectors[i]).length > 0){\r\n tileSelector = tileSelectors[i];\r\n var mainContentSel = main + tileSelectors[i];\r\n if (jQuery(mainContentSel).length > 0){\r\n tileSelector = mainContentSel;\r\n }\r\n }\r\n }\r\n\r\n return tileSelector;\r\n}\r\n\r\nfunction getItemIdsCat(){\r\n var ids = [],\r\n tileSelector = getTileSelector();\r\n\r\n jQuery(tileSelector).each(function () {\r\n var itemUrl = jQuery(this).attr('href') || '',\r\n id = getItemId(itemUrl);\r\n\r\n if (id && ids.indexOf(id) < 0) {\r\n ids.push(id);\r\n }\r\n });\r\n\r\n return ids.join(',');\r\n}\r\n\r\nfunction getCategoryObject() {\r\n return {\r\n 'page:url': bouncex.utils.url.allowParams('q'),\r\n 'items:ids': getItemIdsCat()\r\n };\r\n}\r\n\r\nfunction initializeCategoryEvents() {\r\n var categoryObj;\r\n\r\n bouncex.et.onTrue(\r\n function () {\r\n categoryObj = getCategoryObject();\r\n return !!categoryObj['items:ids'].length &&\r\n !!categoryObj['page:url'];\r\n },\r\n function () {\r\n bouncex.push(['view category', categoryObj]);\r\n },\r\n 10\r\n );\r\n}\r\n\r\n/* ------------------------------- CART EVENTS ------------------------------ */\r\n\r\nfunction fireAddToCart(itemId) {\r\n var token;\r\n\r\n bouncex.et.onTrue(\r\n function () {\r\n token = bouncex.getBounceCookie(CART_COOKIE_KEY);\r\n return token;\r\n },\r\n function () {\r\n bouncex.push([\r\n 'add to cart',\r\n {\r\n 'item:id': itemId,\r\n 'cart:token': token\r\n }\r\n ]);\r\n\r\n if (bouncex.vars.cart) {\r\n return;\r\n }\r\n\r\n bouncex.setVar('cart', true);\r\n },\r\n 10\r\n );\r\n}\r\n\r\nfunction initializeATCClickTracking(itemId) {\r\n bouncex.et.on(bouncex.document, 'click.bxatc', function () {\r\n fireAddToCart(itemId);\r\n if (jQuery('.package-ordergroove-block input').is(':checked')) {\r\n bouncex.push(['view_subscription', {'item:id':itemId}]);\r\n }\r\n }, pdpAtcSelector);\r\n}\r\n\r\nfunction initializeQuickAddToCart(){\r\n bouncex.et.on(bouncex.document, 'click.bxatc', function () {\r\n var prodContainer = jQuery(this).closest('.product-card__image-wrapper'),\r\n prodUrl = prodContainer.find('a').attr('href') || '',\r\n itemId = getItemId(prodUrl);\r\n if (itemId){\r\n fireAddToCart(itemId);\r\n }\r\n }, quickAtcSelector);\r\n}\r\n\r\nfunction initializeRebuyQuickAddToCart(){\r\n bouncex.et.onTrue(\r\n function () {\r\n return jQuery(rebuyAtcSelector).length > 0;\r\n },\r\n function () {\r\n bouncex.on(jQuery(rebuyAtcSelector), 'click.bxatc', function () {\r\n var prodContainer = jQuery(this).closest('.rebuy-product-block'),\r\n prodUrl = prodContainer.find('.rebuy-product-media a').attr('href') || '',\r\n itemId = getItemId(prodUrl);\r\n if (itemId){\r\n fireAddToCart(itemId);\r\n }\r\n });\r\n },\r\n 10\r\n );\r\n \r\n}\r\n\r\nfunction emptyCart() {\r\n bouncex.et.onVarChange('cart_qty', function (oldVal, newVal) {\r\n if (bouncex.vars.cart && newVal === 0 && oldVal > 0) {\r\n bouncex.push(['empty_cart']);\r\n bouncex.setVar('cart', false);\r\n }\r\n });\r\n}\r\n\r\nfunction initializeCartEvents() {\r\n bouncex.et.cart.init({\r\n replenishmentType: 'cookie',\r\n replenish: function (cart) {\r\n bouncex.utils.cookies.create({\r\n name: CART_COOKIE_KEY,\r\n value: cart.token\r\n });\r\n replenComplete();\r\n }\r\n });\r\n\r\n\r\n function replenComplete() {\r\n window.location.href = CLEAN_URL + '?bx_replen=true';\r\n }\r\n\r\n emptyCart();\r\n}\r\n\r\n/* ------------------------------ USER TRACKING ----------------------------- */\r\n\r\nfunction getUserEmail(){\r\n\tvar pixelScriptText = jQuery('#web-pixels-manager-setup').text(),\r\n\t\temailPattern = /[\\w.-]+@[\\w.-]+\\.[\\w]+/,\r\n\t\temailMatch = pixelScriptText.match(emailPattern) || [];\r\n\r\n\treturn emailMatch[0];\r\n}\r\n\r\nfunction initializeUserTracking() {\r\n if (!bouncex.vars.logged_in || !!bouncex.vars.logged_in_identified) {\r\n return;\r\n }\r\n\r\n var userEmail;\r\n\r\n bouncex.et.onTrue(\r\n function () {\r\n userEmail = getUserEmail();\r\n return bouncex.utils.validate.email(userEmail);\r\n },\r\n function () {\r\n bouncex.push([\r\n 'user',\r\n {\r\n 'email': userEmail,\r\n 'source': 'LoggedIn'\r\n }\r\n ]);\r\n bouncex.setVar('logged_in_identified', true);\r\n },\r\n 5\r\n );\r\n}\r\n\r\n/* --------------------------- INITIALIZE TRACKING -------------------------- */\r\n\r\nfunction isValidDomain() {\r\n if (!bouncex.vars.location_path){\r\n return ROOT_DOMAIN === bouncex.website.domain;\r\n }\r\n\r\n return ROOT_DOMAIN === bouncex.website.domain && window.location.pathname.indexOf(bouncex.vars.location_path) > -1;\r\n}\r\n\r\nfunction isEn() {\r\n var lang = bouncex.html.attr('lang') || '';\r\n\r\n return /^en/.test(lang);\r\n}\r\n\r\nfunction isCorrectCountry(){\r\n return bouncex.state.geo.country_code === 'US';\r\n}\r\n\r\nfunction isValidForTracking() {\r\n return isValidDomain() && isEn() & isCorrectCountry();\r\n}\r\n\r\nfunction init() {\r\n if (!isValidForTracking()) {\r\n return;\r\n }\r\n\r\n initializeUserTracking();\r\n initializeCartEvents();\r\n initializeRebuyQuickAddToCart();\r\n \r\n if (QUICKVIEW){\r\n initializeQuickviewEvents();\r\n }\r\n \r\n if (QUICKADD){\r\n initializeQuickAddToCart();\r\n }\r\n\r\n switch (bouncex.website.pts) {\r\n case 'category':\r\n case 'search':\r\n initializeCategoryEvents();\r\n break;\r\n case 'product':\r\n initializeItemEvents();\r\n break;\r\n default:\r\n break;\r\n }\r\n}\r\n\r\ninit();","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"},{"activation":"js","prop":"","prop2":"","prop3":"","val":"window.ShopifyAnalytics.meta.page.pageType === 'cart';"}]]},"category":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"window.ShopifyAnalytics.meta.page.pageType === 'collection';"}]]},"checkout":{"testmode":true,"val":[[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"/checkout"}],[{"activation":"current_page_url","prop":"not_contains","prop2":"","prop3":"","val":"/cart"}]]},"home":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"window.ShopifyAnalytics.meta.page.pageType === 'home';"}]]},"product":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"window.ShopifyAnalytics.meta.page.pageType === 'product';"}]]},"search":{"testmode":false,"val":[[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"/result/?"},{"activation":"js","prop":"","prop2":"","prop3":"","val":"window.ShopifyAnalytics.meta.page.pageType === 'searchresults';"}]]}},"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":"","PDP - Color Option":"","PDP - Hero Image":"","PDP - Product Name":"","PDP - Product Price":"","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":"!!window.ShopifyAnalytics.meta.page.customerId;","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":"Number(jQuery('.cart-count:visible').text().replace(/[^0-9.]/g, ''));","trigger":""},{"name":"cart_value","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"0","code":"(function () {\n if (jQuery('#rebuy-cart.is-visible').length > 0) {\n return jQuery('.rebuy-cart__flyout-subtotal-final-amount span:not(.sr-only)').length > 0 ? \n Number(jQuery('.rebuy-cart__flyout-subtotal-final-amount span:not(.sr-only)').text().replace(/[^0-9.]/g, '')) :\n Number(jQuery('.rebuy-cart__flyout-subtotal-amount span:not(.sr-only)').text().replace(/[^0-9.]/g, ''));\n } else if (bouncex.website.pts === 'cart') {\n return Number(jQuery('.totals__subtotal-value span').text().replace(/[^0-9.]/g, ''));\n } else {\n return null;\n }\n})();\n","trigger":""},{"name":"prod_price","polling":"all","persist":"no","page_types":["product"],"testmode":false,"default":"false","code":"jQuery('.og-option__price, span.f-price-item:not(:has(s)):visible').text().replace(/[^0-9.]/g, '');","trigger":""},{"name":"prod_name","polling":"none","persist":"no","page_types":["product"],"testmode":false,"default":"false","code":"jQuery('h1.product__title').first().text().trim();","trigger":""},{"name":"in_stock","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"(function() {\n var pdpAtcSelector = 'form[action=\"/cart/add\"] button[type=\"submit\"], button[name=\"add\"]',\n outOfStockSelector = '';\n \n if (outOfStockSelector && jQuery(outOfStockSelector).length > 0){\n return false;\n }\n\n return jQuery(pdpAtcSelector).length > 0 ? !jQuery(pdpAtcSelector).is(':disabled') && jQuery(pdpAtcSelector).is(':visible') : true;\n})();","trigger":""},{"name":"submitted_onsite","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"jQuery('[id*=\"Newsletter-success--newsletter_\"]').length > 0 || null;","trigger":""},{"name":"item_url","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":"page_url","polling":"none","persist":"no","page_types":["category","search"],"testmode":true,"default":"false","code":"","trigger":""},{"name":"item_copy","polling":"none","persist":"no","page_types":["product"],"testmode":true,"default":"false","code":"","trigger":"pageload"},{"name":"logged_in_identified","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"subscription_price_visible","polling":"none","persist":"no","page_types":["product"],"testmode":false,"default":"false","code":"jQuery('.package-ordergroove-wrap .each-price').length > 0;","trigger":"pageload"},{"name":"subscription_in_cart","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"(function(){\r\n if(bouncex.website.pts === \"checkout\"){\r\n return null;\r\n }\r\n return jQuery('#rebuy-cart .rebuy-cart__flyout-item-subscription .rebuy-select').length > 0;\r\n})();","trigger":"pageload"},{"name":"subscription_radio_button","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"true","code":"jQuery('.package-ordergroove-block input:checked').length > 0;","trigger":"pageload"},{"name":"brain_type","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"bouncex.utils.url.allowParams().indexOf('/result') > -1 ? jQuery('span.brainmd-bha-description').first().text().split(' ').pop() : false;","trigger":"pageload"},{"name":"one_time_radio_checked","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"jQuery('.single-ordergroove-block input:checked').length > 0;","trigger":"pageload"},{"name":"page_type","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"bouncex.website.pts || null;","trigger":"pageload"},{"name":"contains_shipping","polling":"all","persist":"no","page_types":[],"testmode":true,"default":"false","code":"window.location.hash.indexOf('#shipping') > -1","trigger":"pageload"},{"name":"contains_payment","polling":"all","persist":"no","page_types":[],"testmode":true,"default":"false","code":"window.location.hash.indexOf('#payment') > -1;","trigger":"pageload"},{"name":"cart","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"cart_images","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"(function(){\n var $cartImages = jQuery('#rebuy-cart .rebuy-cart__flyout-item img'), \n images = [],\n img;\n\n $cartImages.each(function(i) {\n img = $cartImages.eq(i).attr('src');\n\n if (img) {\n img = img.replace(/height=\\d+/g, 'height=400')\n .replace(/width=\\d+/g, 'width=400');\n \n images.push(img);\n }\n });\n\n return images.length ? images.join(',') : null;\n})();","trigger":"pageload"},{"name":"cart_names","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"(function(){\n var $cartNames = jQuery('#rebuy-cart .rebuy-cart__flyout-item .rebuy-cart__flyout-item-product-title'), \n names = [],\n name;\n\n $cartNames.each(function(i) {\n name = $cartNames.eq(i).text().trim();\n\n if (name) {\n names.push(name);\n }\n });\n\n return names.length ? names.join(',') : null;\n})();","trigger":"pageload"},{"name":"cart_prices","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"(function(){\n var $cartPrices = jQuery('#rebuy-cart .rebuy-cart__flyout-item .rebuy-money:not(.compare-at) span:not([class*=\"sr-only\"])'), \n prices = [],\n price;\n\n $cartPrices.each(function(i) {\n price = $cartPrices.eq(i).text().trim();\n\n if (price) {\n prices.push(price);\n }\n });\n\n return prices.length ? prices.join(',') : null;\n})();","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":1,"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 currentPageIdentifier: function () {\n var pathNameHash = window.location.pathname + window.location.hash;\n if (pathNameHash.indexOf('/checkout/#payment') > -1 || pathNameHash.indexOf('/checkout/#shipping') > -1) {\n return true;\n }\n return true;\n },\n shouldCheckSpa: function() {\n return bouncex.testmode.bxdev ? window.location.hash.indexOf('#payment') > -1 : true\n },\n});\n\n\n/* --- AUDIENCE HELPER FUNCTIONS --- */\nfunction mapProdArry(objSrc, objStringPath, shqEventName) {\n var itemsArry = bouncex.utils.getNestedProp(objStringPath, [], objSrc).map(function(e) {\n var prodId = bouncex.utils.getNestedProp('id', '', e),\n prodPrice = bouncex.utils.getNestedProp('price', '', e),\n prodQty = bouncex.utils.getNestedProp('quantity', '', e),\n isSub = bouncex.utils.getNestedProp('is_subscription', '', e),\n subInterval = bouncex.utils.getNestedProp('subscription_interval', '', e);\n\n if (shqEventName === 'addToCart' && !!prodId && !!prodPrice && !!prodQty) {\n return {\n ProductId: prodId,\n UnitPrice: +prodPrice,\n Quantity: +prodQty\n }\n }\n if (shqEventName === 'purchase' && !!prodId && !!prodPrice && !!prodQty) {\n return {\n productId: prodId,\n price: +prodPrice,\n qty: +prodQty\n }\n }\n if (shqEventName === 'customProduct' && !!prodId && !!prodQty && !!isSub && !!subInterval) {\n return {\n productId_scraped: prodId,\n customproductid: prodId,\n issubscription: isSub,\n subscription_interval: subInterval,\n subscription_quantity: prodQty\n }\n }\n });\n\n if (!!itemsArry[0] && itemsArry.length > 0) {\n return itemsArry;\n }\n}\n\nlet segments = {\n /* PROPERTIES */\n testMode: false,\n interceptEnabled: false,\n mirrorEnabled: false,\n arrayObserverEnabled: false,\n /* METHODS */\n /* Intercept Events */\n useIntercept() {\n if (!this.interceptEnabled) {\n return;\n }\n bouncex.utils.shqInterceptEvent = {\n cartAdd: false,\n purchase: false\n };\n },\n /* Mirror Events */\n useMirror() {\n if (!this.mirrorEnabled) {\n return;\n }\n bouncex.utils.shqMirrorEvent = {\n pageview: function() {\n // PageView - Search\n if (bouncex.website.pts === 'search') {\n var sp = bouncex.utils.getParam('q').replace(/\\+/gi, ' ');\n \n if (!!sp) {\n _shq.push(['onSearch', {\n searchPhrase: sp\n }]);\n }\n }\n }\n };\n },\n processObserver(e) {\n while (e.length) {\n let dlObj = e.shift();\n\n // Purchase - Cusotm Product Details & Purchase\n if (dlObj.event === 'purchase') {\n var purchItem = mapProdArry(dlObj, 'ecommerce.purchase.products', dlObj.event),\n ototal = bouncex.utils.getNestedProp('ecommerce.purchase.actionField.revenue', '', dlObj),\n customProdDetail = mapProdArry(dlObj, 'ecommerce.purchase.products', 'customProduct'),\n oid = bouncex.utils.getNestedProp('ecommerce.purchase.actionField.id', '', dlObj),\n dummyId = 'no-orderid-' + Math.floor(Math.random() * 100000000);\n\n if (!!oid && !!ototal && !!purchItem && purchItem.length > 0) {\n _shq.push(['onPurchase', {\n orderItems: purchItem,\n total: +ototal,\n orderId: oid\n }]);\n \n if (!!customProdDetail && customProdDetail.length > 0) {\n _shq.push([ 'onCustomProduct', customProdDetail]);\n }\n } else {\n _shq.push(['onPurchase', {\n usebasket: true,\n total: +ototal || 0,\n orderId: oid || dummyId\n }]);\n }\n \n } \n // Add To Cart\n if (dlObj.event === 'addToCart') {\n var atcItem = mapProdArry(dlObj, 'ecommerce.add.products', dlObj.event);\n\n if (atcItem.length > 0) {\n _shq.push(['onCartAdd', {\n Items: atcItem,\n Total: atcItem[0].UnitPrice * atcItem[0].Quantity\n }]);\n }\n }\n }\n },\n arrayObserver() {\n if (!this.arrayObserverEnabled) {\n return;\n }\n bouncex.et.onTrue(\n () => {\n return bouncex.utils.getNestedProp('window._shq.loaded');\n },\n () => {\n _shq.ArrayObserver(window.dataLayer, (e) => {\n this.processObserver(e);\n }, {catchUp:true, filter: e => e.ecommerce});\n }\n );\n },\n /* Initialize Segments Tracking */\n init() {\n // test mode\n if (this.testMode && !bouncex.testmode.bxdev) return;\n // attach object to window & bouncex.utils\n if (!bouncex.utils) {\n return;\n }\n bouncex.utils.segments = this;\n // initialize intercept and mirror, comment out if not needed\n this.useIntercept();\n this.useMirror();\n this.arrayObserver();\n },\n};\n\nsegments.init();\n","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 BrainMD mktg txts (like cart reminders) to this #, per terms.","eventSharing":false,"shqId":"b1ibom9seb-1","enabled":1},"pde":true,"fmc":["US","CA"],"fme":true,"fmx":"","uid2":false,"iiq":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":"311854643","ga4_measurement_id":"G-82WQ02S9XJ","tag_state_domain":"wd.brainmd.com","tag_state_domain_enabled":false,"tag_state_sst_enabled":true} ; 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":"c07e09f77264cce5ba50382a5890b87a","creativesBaseStyles":"a53944a2","gpsAuction":"bbb80866120d17013073bb6d284cbd6b","inbox":"d6c8d32b386d0fba348241d2c8b6dbc7","onsite":"1238d00d70e4de87443df9eb69ff1a61","sms":"e39203556bab2366e56296ce42e974a7","websdk":"04a8259886e8489210ad79167d61255e","website_campaigns_3873":"ee723030c6f11d2aeaaa0339633e182e"}; 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_cf41599a59d5e7bd7ff99abc7741a0c2.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_92abedfd1b9757a428bfcd7452d0081f.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); } } if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", bxBootstrap); } else { bxBootstrap(); }})();