(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":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};","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":0},"burls":[],"ple":false,"fbe":true,"ffs":"","mas":2,"map":1,"gar":true,"ete":1,"ettm":false,"etjs":"// *----* ITEM TRACKING *----* //\n\nvar BRAIN_MD_DOMAIN = 'https://brainmd.com/';\n\n// ---- HELPERS ---- //\n//SHQ - Helper function to filter GTM dataLayer for specific events\nfunction getFilteredDL(dl, event) {\n var lastEvent = [];\n if (dl && dl.length > 0) {\n for (var i = 0; i < dl.length; i++) {\n if (dl[i].hasOwnProperty(\"event\") && dl[i].event === event) { lastEvent.push(dl[i]); }\n }\n return lastEvent && lastEvent.length > 0 ? lastEvent.pop() : false;\n }\n}\n\nfunction getUrl() {\n\treturn bouncex.utils.url.allowParams();\n}\n\nfunction isValidDomain(){\n\tvar currentUrl = getUrl();\n\t\n\treturn currentUrl.indexOf(BRAIN_MD_DOMAIN) > -1 && !currentUrl.includes('trial'); \n}\n\nfunction isEnUs(){\n return jQuery('html').attr('lang') === 'en';\n}\n\nfunction getIdFromUrl(url) {\n if(url === \"https://brainmd.com/catalog/product/view/_ignore_category/1/id/657/s/brain-health-coaching-certification-course/\"){\n return 'brain-health-coaching-certification-course';\n } else {\n return url.split('/').pop(); \n }\n}\n\nfunction isValidCoursePage(){\n return jQuery('.field.configurable.required').length === 0;\n}\n\n// ---- ITEM META DATA ---- //\n\nfunction getItemId() {\n var url = getItemUrl();\n\n\treturn getIdFromUrl(url);\n}\n\nfunction getItemUrl() {\n\treturn jQuery('link[rel=\"canonical\"]').attr('href');\n}\n\nfunction getItemCopy() {\n\treturn jQuery('.page-title').text().trim();\n}\n\nfunction getItemCategory() {\n\tvar categoryBreadcrumb = jQuery('li.item.category').eq(0).text().trim() ;\n\tvar categoryClass = jQuery('body[data-container=\"body\"]').attr('class') || \"\";\n\t\n\tif (!categoryBreadcrumb && !categoryClass){\n\t return 'Brain MD';\n\t} \n\n return categoryBreadcrumb || categoryClass.split(' ').shift();\n}\n\nfunction getItemImage() {\n\tvar itemImage = jQuery('meta[property=\"og:image\"]').attr('content') || \"\";\n\n if (itemImage.indexOf(\"placeholder\") > -1){\n itemImage = jQuery('.fotorama__img').attr('src');\n }\n \n return itemImage;\n}\n\nfunction itemInStock() {\n return jQuery('.product-info-main button.tocart').length > 0;\n}\n\nfunction isValidItem() {\n\tvar itemId = getItemId();\n\treturn itemId || false; \n}\n\n//SHQ - Collecting productId for shq_id to match product feed\nfunction getShqProdId() {\n var pdpObj = getFilteredDL(window.dataLayer, \"productDetail\");\n var shqProdId = bouncex.utils.getNestedProp('ecommerce.detail.products[0].id', null, pdpObj);\n return shqProdId;\n}\n\n//SHQ - Collecting productId during add to cart for shq_id to match product feed\nfunction shqAddToCart() {\n var filterDL;\n bouncex.et.onTrue(function(){\n filterDL = getFilteredDL(window.dataLayer, \"addToCart\");\n return !!filterDL;\n }, function(){\n var shqProdId = bouncex.utils.getNestedProp('ecommerce.add.products[0].id', null, filterDL);\n if (shqProdId) {\n _shq.push([ \"onCartAdd\", { \n CartId: null,\n Items: [{\n ProductId: shqProdId, \n UnitPrice: null, \n Quantity: 1 \n }],\n Total: null\n }]);\n }\n }, 10);\n}\n\nfunction getItem() {\n\treturn {\n\t\tid : getItemId(),\n\t\tcopy: getItemCopy(),\n\t\tcategory : getItemCategory(),\n\t\turl : getItemUrl(),\n\t\timageurl : getItemImage(),\n\t\tinstock : itemInStock(),\n\t\tshq_id: getShqProdId(),\n\t};\n}\n\nfunction viewItem(itemId){\t\n bouncex.push(['view item', {\n 'item:id': itemId,\n 'item:shq_id': getShqProdId()\n }]);\n \n}\n\nfunction fireItemEvents(){\n\tvar item = getItem();\n\t\n\tbouncex.push(['item', item]);\n\tviewItem(item.id);\n}\n\n// ---- CATEGORY META DATA ---- //\n\nfunction getCategoryPageTitle(){\n\treturn jQuery('ul.items:first li').last().text().trim();\n}\n\nfunction getCategoryIds(){\n return jQuery('.product.product-item-photo').map(function () { \n var itemUrl = jQuery(this).attr('href');\n var itemId = getIdFromUrl(itemUrl);\n\n if (itemId) {\n return itemId;\n }\n \n }).toArray().join(',');\n}\n\nfunction getCategoryObj(){\n\treturn {\n 'page:title' : getCategoryPageTitle(),\n 'page:url': getUrl(),\n 'items:ids': getCategoryIds()\n };\n}\n\n// ---- CART TRACKING ---- //\n\nbouncex.et.cart.init({\n replenish: function (cart) {},\n replenishmentType: 'single'\n});\n\nfunction addToCart(){\n bouncex.et.on(jQuery(document), 'click.bx', function(e){\n var itemId = getItemId();\n \n if (bouncex.website.pts === \"category\"){\n var itemUrl = jQuery(e.target).parentsUntil('.product-item').find('a.product-item-photo').attr('href');\n \n itemId = getIdFromUrl(itemUrl);\n }\n //using shq_bypass to prevent this from being passed to shq so we can collect the add to cart productId outside of Wknd add to cart\n bouncex.push(['add to cart', {'item:id':itemId, 'shq:shq_bypass':true}]);\n setBounceCookie();\n shqAddToCart();\n }, '.tocart'); \n}\n\nfunction emptyCart(){\n bouncex.et.onVarChange('cart_qty', function(){\n if (bouncex.vars.cart_qty === 0){\n bouncex.push(['empty_cart']);\n }\n });\n}\n\n// ---- USER TRACKING ---- //\n\nfunction getLoggedInUserEmail(){\n return jQuery('.box-content').eq(0).text().trim().split(' ').pop();\n\n}\n\n// ---- INITIALIZE EVENTS ---- //\nfunction initializeItemEvents(){\n\tif (bouncex.website.pts === 'product' && isValidCoursePage()){\n\t\tbouncex.et.onTrue(isValidItem, fireItemEvents, 10);\n\t}\n}\n\nfunction initializeCategoryEvents(){\n var categoryObj;\n \n if (bouncex.website.pts === 'category'){\n \tcategoryObj = getCategoryObj();\n \t\n \tif (categoryObj['items:ids'].length){\n \t\tbouncex.push(['view category', categoryObj]);\n }\n\t}\n}\n\nfunction initializeCartEvents(){\n addToCart(); \n emptyCart();\n}\n\nfunction fireLoggedInUser() {\n var userEmail;\n\n bouncex.et.onTrue(\n function () {\n userEmail = getLoggedInUserEmail();\n return bouncex.utils.validate.email(userEmail);\n },\n function () {\n bouncex.push([\n 'user',\n {\n 'email': userEmail,\n 'source': 'LoggedIn'\n }\n ]);\n bouncex.setVar('logged_in_identified', true);\n },\n 5\n );\n}\n\nfunction initializeLoggedInUser() {\n if (bouncex.vars.logged_in && !bouncex.vars.logged_in_identified) {\n fireLoggedInUser();\n return;\n }\n \n bouncex.et.onVarChange('logged_in', function (oldVal, newVal) {\n if (newVal && !bouncex.vars.logged_in_identified) {\n fireLoggedInUser();\n }\n });\n}\n\n\nif (isValidDomain() && isEnUs()) {\n\tinitializeLoggedInUser();\n\tinitializeItemEvents();\n\tinitializeCartEvents();\n\tinitializeCategoryEvents();\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('.catalog-category-view').length > 0;"}],[{"activation":"js","prop":"","prop2":"","prop3":"","val":"document.querySelectorAll('div.products-grid').length > 0;"}]]},"checkout":{"testmode":false,"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":"document.querySelectorAll('body.cms-home').length > 0;"}]]},"product":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"document.querySelectorAll('.catalog-product-view').length > 0;"}]]},"search":{"testmode":false,"val":[[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"/result/?"}]]}},"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":"(function() {\n var cacheStorage = bouncex.utils.getNestedProp([\"mage-cache-storage\"], '', localStorage);\n var parsedData;\n var customerName = '';\n \n\t/* check that what we need to parse exists */\n if (cacheStorage.length > 0) {\n \tparsedData = JSON.parse(cacheStorage);\n customerName = bouncex.utils.getNestedProp('customer.fullname', '', parsedData);\n }\n \n /* customerName exists for logged_in user */\n return customerName.length > 0;\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 if (jQuery('span.counter-number').text() === '0' || window.location.href.indexOf('/logoutSuccess') > -1 || jQuery('div.cart-empty:contains(\"no items\")').length > 0) {\n return 0;\n }\n if (jQuery('span.counter-number').length > 0) {\n /* takes a few seconds for the cart_qty to load, so put in null logic */\n return Number(jQuery('span.counter-number').eq(0).text().replace(/[^0-9]/g, '')) || null;\n }\n return null;\n})();","trigger":""},{"name":"cart_value","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"0","code":"(function() {\n if (jQuery('span.counter-number').text() === '0' || window.location.href.indexOf('/logoutSuccess') > -1 || jQuery('div.cart-empty:contains(\"no items\")').length > 0) {\n return 0;\n }\n if (jQuery('.price-wrapper span.price').length > 0) {\n return Number(jQuery('span[data-bind*=\"subtotal\"] span.price:eq(0)').text().replace(/[^0-9.]/g, '')) || null;\n }\n return null;\n})();","trigger":""},{"name":"prod_price","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"bouncex.website.pts === 'product' && Number(jQuery('.field input[name*=\"option\"]:checked').siblings('label[for*=\"option\"]').children('.option-price').text().replace(/[^0-9.]/g, '') || jQuery('span[data-price-type=\"finalPrice\"] span.price:eq(0)').text().replace(/[^0-9.]/g, ''));","trigger":""},{"name":"prod_name","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"bouncex.website.pts === 'product' && jQuery('.page-title').text().trim();","trigger":""},{"name":"in_stock","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"bouncex.website.pts === 'product' && jQuery('.unavailable:visible:contains(\"Out of stock\")').length === 0;","trigger":""},{"name":"submitted_onsite","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"jQuery('.success:visible:contains(\"subscription\")').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":"logged_in_identified","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"has_excluded_class","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"(function(){\r\n var found = false;\r\n var list = [\"Memory Master Course - Premium\", \"Change Your Brain Masters - Premium\", \"Brain Warrior\\'s Way - Premium\", \"Brain Thrive by 25 - Premium\", \"Healing ADD at Home - Premium\", \"Overcoming Insomnia Course - Premium\", \"Autism: A New Way Forward - Premium\"] ;\r\n if(bouncex.website.pts === \"checkout\"){\r\n return null\r\n }\r\n if(bouncex.website.pts != \"cart\" && jQuery('#mini-cart .product-item').length > 0){\r\n jQuery('#mini-cart .product-item').map(function(_, b){\r\n if(list.indexOf(jQuery(b).find('.product-item-name').text().trim()) > -1){\r\n found = true;\r\n }\r\n });\r\n return found;\r\n } else if(bouncex.website.pts === \"cart\"){\r\n jQuery('#shopping-cart-table .cart.item').map(function(_, b){\r\n if(list.indexOf(jQuery(b).find('.product-item-name').text().trim()) > -1){\r\n found = true;\r\n }\r\n });\r\n }\r\n return found\r\n})();","trigger":"pageload"},{"name":"subscription_price_diff","polling":"none","persist":"no","page_types":["product"],"testmode":false,"default":"false","code":"(function() {\n var purchase = jQuery('#option-label_onetime .option-price');\n var subscription = jQuery('#option-label_subscription .option-price');\n var diff = 0;\n if (purchase.length > 0 && subscription.length > 0) {\n diff = Number(purchase.text().replace(/[^0-9.]/g, '')) - Number(subscription.text().replace(/[^0-9.]/g, ''));\n return Number((Math.round(diff * 100) / 100).toFixed(2));\n }\n return diff;\n})();","trigger":"pageload"},{"name":"subscription_price_visible","polling":"none","persist":"no","page_types":["product"],"testmode":false,"default":"false","code":"jQuery('.subscribe-option .option-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('.minicart-items-wrapper .product-item-details .product-options-list:contains(\"Regular Delivery\")').length > 0\r\n})()","trigger":"pageload"},{"name":"article_topic","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"(function() {\n var category = jQuery('h3.entry-title').text().split(':').pop().trim().toLowerCase() || jQuery(\"img[id*=batBeacon]\").first().attr(\"src\") || \"\";\n if (!(bouncex.utils.url.allowParams().indexOf('blog') > -1)) {\n return false;\n }\n\n if (category.indexOf(\"sleep\") > -1) {\n return \"Sleep\";\n }\n if (category.indexOf(\"memory\") > -1) {\n return \"Memory\";\n }\n if (category.indexOf(\"focus\") > -1) {\n return \"Focus\";\n }\n if (category.indexOf(\"mood\") > -1) {\n return \"Mood\";\n }\n if (category.indexOf(\"weight\") > -1 || category.indexOf(\"nutrition\") > -1) {\n return \"Nutrition\";\n }\n if (category.indexOf(\"family\") > -1) {\n return \"Family\";\n }\n return \"Brain Health\"\n}());","trigger":"pageload"},{"name":"subscription_radio_button","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"true","code":"jQuery('#option_subscription, #option-subscribe').first().is(':checked');","trigger":"pageload"},{"name":"brain_type","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"bouncex.utils.url.allowParams().indexOf('/result') > -1 ? jQuery('.bt').first().text() : false;","trigger":"pageload"},{"name":"one_time_radio_checked","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"jQuery('#option-onetime').length && jQuery('#option-onetime').is(':checked');","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 pathNameHash;\n }\n return true;\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":"","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},"ga4_property_id":"311854643","ga4_measurement_id":"G-82WQ02S9XJ","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":"ababbfcac9b56e701d1f877082b16c1d","creativesBaseStyles":"a53944a2","gpsAuction":"1375a7b38c31e98d14fe7f396b72da14","inbox":"02aca5df0e176b8810a86da97ac05424","onsite":"0e56ab6ba004ee080ce3deb3edae35e9","sms":"e39203556bab2366e56296ce42e974a7","websdk":"3314cefb9e5f7de4ce4a17e3cca4b891"}; bouncex.push = function(pushData) { bouncex.pushedData.push(pushData); } var runtime = document.createElement('script'); runtime.setAttribute('src', '//assets.bounceexchange.com/assets/smart-tag/versioned/runtime_6459738026535cda4232dc813c61447d.br.js'); runtime.setAttribute('async', 'async'); runtime.setAttribute('onload', 'bouncex.initializeTag()'); bouncex.initializeTag = function() { var script = document.createElement('script'); script.setAttribute('src', '//assets.bounceexchange.com/assets/smart-tag/versioned/main-v2_e3c047536bdaca2c8911cb1f6f6d8aa7.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() {}; }; document.body.appendChild(runtime); } } if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", bxBootstrap); } else { bxBootstrap(); }})();