(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":4206,"name":"Five CBD","cookie_name":"bounceClientVisit4206","domain":"fivecbd.com","ct":"fp_local_storage","ally":0,"ei":0,"tcjs":"","cjs":"","force_https":false,"waypoints":false,"content_width":900,"gai":"UA-170080725-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,"mas":2,"map":1,"gar":true,"ete":1,"ettm":false,"etjs":"/* ---------------------------- SHARED VARIABLES ---------------------------- */\n\nvar CART_COOKIE_KEY = 'cart',\n\tCLEAN_URL = bouncex.utils.url.allowParams();\n\n/* --------------------------------- HELPERS -------------------------------- */\n\n// creates a map of IDs pointing to an item object containing all item metadata. The only pieces of metadata shared amongst the items\n// are the category & the copy. flavor & size are appended to the copy when the email is rendered.\nfunction createItemIdMap() {\n\t// eslint-disable-next-line no-undef\n\tvar variants = currentProduct && currentProduct.variants || [],\n\t\ttype = bouncex.utils.getNestedProp('ShopifyAnalytics.meta.product.type');\n\treturn variants.reduce(function (options, option) {\n\t\toptions[option.id] = {\n\t\t\tid: option.id,\n\t\t\t// eslint-disable-next-line no-undef\n\t\t\tcopy: currentProduct.title,\n\t\t\tcategory: type || 'Global',\n\t\t\turl: CLEAN_URL + '?variant=' + option.id,\n\t\t\timageurl: option.featured_image && option.featured_image.src,\n\t\t\tflavor: option.option1,\n\t\t\tsize: option.option2,\n\t\t\tinstock: option.available\n\t\t};\n\t\treturn options;\n\t}, {});\n}\n\n// item IDs are size and color specific\nfunction getCurrentItemId() {\n\treturn bouncex.utils.getNestedProp('ShopifyAnalytics.meta.selectedVariantId') || bouncex.utils.url.getParam('variant');\n}\n\n/* ------------------------------ ITEM TRACKING ----------------------------- */\n\nfunction initializeItemEvents() {\n\tvar item,\n\t\titemMap = {};\n\n\tbouncex.et.onTrue(\n\t\tfunction () {\n\t\t\titemMap = createItemIdMap();\n\t\t\t// some pages only have one variant, but the selectors for getCurrentItemId() do not populate. In this instance, the the first (& only) item is keyed into the map.\n\t\t\titem = itemMap[getCurrentItemId() || bouncex.utils.getNestedProp('currentProduct.variants[0].id')];\n\t\t\treturn !!item &&\n\t\t\t\t!!item.id &&\n\t\t\t\t!!item.copy &&\n\t\t\t\t!!item.url &&\n\t\t\t\t!!item.imageurl;\n\t\t},\n\t\tfunction () {\n\t\t\tfireItemEvents(item);\n\t\t\ttrackItemChange(itemMap);\n\t\t\t// PDPs with ONLY a one-time purchase option do not fire AJAX events, and the user will not be redirected to the cart page.\n\t\t\tbouncex.et.on(jQuery('.opt-submit-button'), 'click.bxatc', function () {\n\t\t\t\tfireAddToCart();\n\t\t\t});\n\t\t},\n\t\t10\n\t);\n}\n\nfunction fireViewItemEvents(itemId, groupId) {\n\tvar pushItem = { 'item:id': itemId };\n\tif (groupId) {\n\t\tpushItem['item:itemgroupid'] = groupId;\n\t}\n\tbouncex.push(['view item', pushItem]);\n\n\tbouncex.push([\n\t\t'select_sku',\n\t\t{\n\t\t\t'item:id': itemId,\n\t\t\t'item:itemgroupid': groupId,\n\t\t\t'item:feedid': itemId\n\t\t}\n\t]);\n\n\t// set to accurately track ATC events.\n\tbouncex.setVar('last_viewed_id', itemId);\n}\n\nfunction fireItemEvents(item) {\n\tbouncex.push(['item', item]);\n\tfireViewItemEvents(item.id, bouncex.utils.getNestedProp('ShopifyAnalytics.meta.product.id', ''));\n}\n\nfunction trackItemChange(itemMap) {\n\tbouncex.et.on(jQuery('#add-item-form [name=\"option1\"],[name=\"option2\"]'), 'change.bxitemchange', function () {\n\t\tbouncex.setTimeout2(function () {\n\t\t\tvar newId = getCurrentItemId();\n\t\t\tif (newId !== bouncex.vars.last_viewed_id && newId) {\n\t\t\t\tfireItemEvents(itemMap[newId]);\n\t\t\t}\n\t\t}, 500);\n\t});\n}\n\n/* ---------------------------- CATEGORY TRACKING --------------------------- */\nfunction getItemIdsCat() {\n\tvar ids = [],\n\t\t$tiles = jQuery('.product-btn [href*=\"variant=\"]'),\n\t\ti = 0,\n\t\tshopifyMetaProducts = bouncex.utils.getNestedProp('ShopifyAnalytics.meta.products', []);\n\n\tshopifyMetaProducts.forEach(function (metaData) {\n\t\tvar variants = metaData.variants || [];\n\t\tvariants.forEach(function (variant) {\n\t\t\tvar id = variant.id;\n\t\t\tif (id && ids.indexOf(id) < 0) {\n\t\t\t\tids.push(id);\n\t\t\t}\n\t\t});\n\t});\n\n\tfor (i; i < $tiles.length; i++) {\n\t\tvar pdpURL = jQuery($tiles[i]).attr('href'),\n\t\t\tid = bouncex.utils.url.getParam('variant', pdpURL);\n\n\t\tif (!id || ids.indexOf(id) > -1) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tids[ids.length] = id;\n\t}\n\n\treturn ids.join(',');\n}\n\nfunction getCategoryObject() {\n\treturn {\n\t\t'page:url': CLEAN_URL,\n\t\t'items:ids': window.location.pathname === '/products' ? Object.keys(window.variants || {}).join(',') : getItemIdsCat()\n\t};\n}\n\nfunction initializeCategoryEvents() {\n\tvar categoryObj;\n\n\tbouncex.et.onTrue(\n\t\tfunction () {\n\t\t\tcategoryObj = getCategoryObject();\n\t\t\treturn !!categoryObj['items:ids'].length &&\n\t\t\t\t!!categoryObj['page:url'];\n\t\t},\n\t\tfunction () {\n\t\t\tbouncex.push(['view category', categoryObj]);\n\t\t},\n\t\t10\n\t);\n}\n\nfunction initializeQuickViewTracking() {\n\tvar lastItemId;\n\tbouncex.setInterval2(function () {\n\t\tvar $atcForm = jQuery('#variant-selection'),\n\t\t\t// some variants append HTML values to the selector. We are only grabbing a match of the first 12+ consecutive digits\n\t\t\tnewIdMatches = ($atcForm.attr('value') || '').match(/\\d{12,}/g) || [],\n\t\t\tnewId = newIdMatches[0];\n\t\tif (newId && newId !== lastItemId) {\n\t\t\tlastItemId = newId;\n\t\t\tfireViewItemEvents(lastItemId, $atcForm.data('productid'));\n\t\t}\n\t}, 1000);\n}\n\n/* ------------------------------- CART EVENTS ------------------------------ */\nfunction initializeATCTracking() {\n\tbouncex.et.on(bouncex.document, 'ajaxComplete.bxatc', function (e, xhr, settings) {\n\t\tif (settings.url.indexOf('cart/add') > -1\n\t\t\t&& settings.type === 'POST'\n\t\t\t&& xhr.status === 200\n\t\t\t&& bouncex.vars.last_viewed_id) {\n\t\t\tbouncex.setTimeout2(fireAddToCart, 1000);\n\t\t}\n\t});\n}\n\nfunction fireAddToCart() {\n\tvar token;\n\n\tbouncex.et.onTrue(\n\t\tfunction () {\n\t\t\ttoken = bouncex.getBounceCookie(CART_COOKIE_KEY);\n\t\t\treturn token;\n\t\t},\n\t\tfunction () {\n\t\t\tbouncex.push([\n\t\t\t\t'add to cart',\n\t\t\t\t{\n\t\t\t\t\t'item:id': bouncex.vars.last_viewed_id,\n\t\t\t\t\t'cart:token': token\n\t\t\t\t}\n\t\t\t]);\n\n\t\t\tbouncex.setVar('cart', true);\n\t\t\tbouncex.setVar('last_viewed_id', false);\n\t\t},\n\t\t10\n\t);\n}\n\nfunction replenComplete() {\n\twindow.location.href = window.location.origin +\n\t\twindow.location.pathname +\n\t\t'?bx_replen=true';\n}\n\nfunction initializeCartEvents() {\n\tbouncex.et.cart.init({\n\t\treplenishmentType: 'cookie',\n\t\treplenish: function (cart) {\n\t\t\tbouncex.utils.cookies.create({\n\t\t\t\tname: CART_COOKIE_KEY,\n\t\t\t\tvalue: cart.token\n\t\t\t});\n\t\t\treplenComplete();\n\t\t}\n\t});\n\n\t// some items redirect to the cart page after adding to the cart. In that case, the item ID is saved using this RTV and ATC is fired\n\t// on the cart page--rather than the PDP.\n\tif (bouncex.website.pts === 'cart') {\n\t\tif (bouncex.vars.last_viewed_id) {\n\t\t\tfireAddToCart();\n\t\t}\n\t\tbouncex.setTimeout2(function () {\n\t\t\tif (bouncex.vars.cart && bouncex.vars.cart_qty === 0) {\n\t\t\t\tfireEmptyCart();\n\t\t\t}\n\t\t}, 1000);\n\t} else {\n\t\tbouncex.setVar('last_viewed_id', false);\n\t\tbouncex.et.onVarChange('cart_qty', function (oldVal, newVal) {\n\t\t\tif (bouncex.vars.cart && newVal === 0) {\n\t\t\t\tfireEmptyCart();\n\t\t\t}\n\t\t});\n\t}\n\n\t// If a user goes to the cart manually by clicking the cart page link, ATC is not fired on the cart page. That is accomplished by removing\n\t// the last_viewed_id variable here\n\tbouncex.et.on(jQuery('.nav-bar__cart-link'), 'click.bxremoveviewedid', function () {\n\t\tbouncex.setVar('last_viewed_id', false);\n\t});\n\n}\n\nfunction fireEmptyCart() {\n\tbouncex.push(['empty_cart']);\n\tbouncex.setVar('cart', false);\n}\n\n/* ------------------------------ USER TRACKING ----------------------------- */\n\nfunction initializeUserTracking() {\n\tif (!bouncex.vars.logged_in || !!bouncex.vars.logged_in_identified) {\n\t\treturn;\n\t}\n\n\tvar userEmail = bouncex.utils.getNestedProp('_BISConfig.customer.email');\n\n\tif (!bouncex.utils.validate.email(userEmail)) {\n\t\treturn;\n\t}\n\n\tbouncex.push([\n\t\t'user',\n\t\t{\n\t\t\t'email': userEmail,\n\t\t\t'source': 'LoggedIn'\n\t\t}\n\t]);\n\tbouncex.setVar('logged_in_identified', true);\n}\n\n/* --------------------------- INITIALIZE TRACKING -------------------------- */\n\nfunction isValidDomain() {\n\treturn CLEAN_URL.indexOf('fivecbd.com') > -1;\n}\n\nfunction isEn() {\n\treturn jQuery('html').attr('lang') === 'en';\n}\n\nfunction isValidForTracking() {\n\treturn isValidDomain() && isEn();\n}\n\nfunction init() {\n\tif (!isValidForTracking()) {\n\t\treturn;\n\t}\n\n\tinitializeUserTracking();\n\tinitializeCartEvents();\n\tinitializeATCTracking();\n\n\tswitch (bouncex.website.pts) {\n\t\tcase 'product':\n\t\t\tinitializeItemEvents();\n\t\t\tbreak;\n\t\tcase 'category':\n\t\t\tinitializeCategoryEvents();\n\t\t// eslint-disable-next-line no-fallthrough\n\t\tdefault:\n\t\t\tinitializeQuickViewTracking();\n\t\t\tbreak;\n\t}\n}\n\ninit();\n","dge":false,"bxidLoadFirst":false,"pie":false,"cme":false,"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('.products').length > 0;"},{"activation":"js","prop":"","prop2":"","prop3":"","val":"document.querySelectorAll('.pro-box-inr').length > 0 && document.querySelectorAll('.product-internal').length === 0;"}],[{"activation":"js","prop":"","prop2":"","prop3":"","val":"window.location.pathname !== '/';"}],[{"activation":"current_page_url","prop":"not_contains","prop2":"","prop3":"","val":"/quiz"}],[{"activation":"current_page_url","prop":"not_contains","prop2":"","prop3":"","val":"/news"}]]},"checkout":{"testmode":false,"val":[[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"/checkout"}]]},"home":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"window.location.pathname === '/';"}]]},"product":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"document.querySelectorAll('.product-internal').length > 0;"}]]},"search":{"testmode":true,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":""}]]}},"els":{"blank_site_element":""},"vars":[{"name":"logged_in","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"bouncex.website.pts === 'checkout' ? null : jQuery('nav.navbar a:contains(\"login\")').attr('href') === '/account';","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') {\n return null;\n }\n\n if(bouncex.website.pts === 'cart') {\n var $cartItems = jQuery('[name=\"quantity\"]');\n var total = 0;\n jQuery.each($cartItems, function(i) {\n total+= Number($cartItems.eq(i).val()) || 0;\n });\n return total;\n }\n return Number(jQuery('.nav-bar__cart-item-count').first().text().replace(/[^0-9.]/g,'')) || Number(jQuery('.cart .circle:first').first().text().replace(/[^0-9.]/g,''));\n})();","trigger":"pageload"},{"name":"in_stock","polling":"none","persist":"no","page_types":[],"testmode":true,"default":"false","code":"","trigger":""},{"name":"submitted_onsite","polling":"all","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"jQuery('#quiz-wrapper #step-2.show').length > 0 || 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":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":"last_viewed_id","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"cart_value","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"0","code":"(function () {\n if (bouncex.website.pts === 'checkout') {\n return null;\n }\n if (bouncex.website.pts === 'cart') { \n return Number(jQuery('.cart-sub-total').first().text().replace(/[^0-9.]/g, '')); \n } else {\n return Number(jQuery('.slidecart-subtotal').first().text().replace(/[^0-9.]/g, '')); \n \n }})();","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":0,"spatm":1,"preinit_cjs":"","crs":{"integrations":null,"pageCount":null},"mat":0,"math":0,"cpnu":"coupons.bounceexchange.com","dfpcms":0,"sms":{"optm":"","eventSharing":false,"shqId":"","enabled":1},"pde":false,"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":"330127957","ga4_measurement_id":"G-4N6KFDXZ0S"} ; 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: 0 }; bouncex.assets = {"ads":"274f3a24cf2fcadc20f55008ce8b650d","creativesBaseStyles":"a53944a2","gpsAuction":"1375a7b38c31e98d14fe7f396b72da14","inbox":"02aca5df0e176b8810a86da97ac05424","onsite":"0e56ab6ba004ee080ce3deb3edae35e9","sms":"e39203556bab2366e56296ce42e974a7","websdk":"0704dae1eb637cbeb4a847506058402d"}; 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.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_e15248ef4ac8cdb300e79b7fe94d0d13.js'); script.setAttribute('async', 'async'); document.body.appendChild(script); bouncex.initializeTag = function() {}; }; document.body.appendChild(runtime); } } if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", bxBootstrap); } else { bxBootstrap(); }})();