(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":3733,"name":"Kassatex","cookie_name":"bounceClientVisit3733","domain":"kassatex.com","ct":"fp_local_storage","ally":0,"ei":0,"tcjs":"","cjs":"(function() {\n $(document).on('ajaxComplete.bx', function(event, xhr, settings) {\n var cartCats;\n var res = xhr ? xhr.responseJSON : undefined;\n if (res && settings.url.indexOf('/cart/add.js') > -1) {\n cartCats = bouncex.vars.cart_categories.length > 0 ? bouncex.vars.cart_categories.split(',') : [];\n if (res.product_type && !cartCats.includes(res.product_type.toLowerCase())) {\n cartCats.push(res.product_type.toLowerCase());\n } \n } else if (res && settings.url.indexOf('/cart/update') > -1) {\n if (res.items) {\n cartCats = [];\n res.items.forEach(function(item) {\n if (item && item.product_type && !cartCats.includes(item.product_type.toLowerCase())) {\n cartCats.push(item.product_type.toLowerCase());\n }\n });\n }\n }\n if (cartCats) {\n bouncex.setVarAndReload('cart_categories', cartCats.join(','));\n }\n });\n})();\n\n","force_https":false,"waypoints":false,"content_width":900,"gai":"UA-11888056-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":"var ALLOWED_DOMAINS = ['kassatex.com'],\n\tDEFAULT_TIMEOUT = 1000;\n\nfunction isValidDomain () {\n\treturn ALLOWED_DOMAINS.indexOf(window.location.hostname) > -1;\n}\n\nfunction isGiftCard() {\n\treturn window.location.href.indexOf('gift-card') > -1;\n}\n\nfunction isReplen() {\n\treturn window.location.href.indexOf('bx_cart') > -1;\n}\n\nfunction getPageUrl() {\n\treturn bouncex.utils.url.allowParams();\n}\n\nfunction setCartSet(value) {\n\tsetVarAndCookie('cart_set', value);\n}\n\nfunction getCookie() {\n\treturn bouncex.getBounceCookie('cart');\n}\n\nfunction setVarAndCookie(varName, value) {\n\tbouncex.setVar(varName, value);\n\tbouncex.setBounceCookie();\n\n\treturn;\n}\n\nfunction formatId(url) {\n\tif (!url) {\n\t\treturn '';\n\t}\n\n\treturn url.replace(/\\/$/, '').split('/').pop();\n}\n\nfunction trackLoggedInUser() {\n\tif (!bouncex.vars.logged_in || !!bouncex.vars.logged_in_identified) {\n\t\treturn;\n\t}\n\n\tvar email = jQuery('.section__content:visible ul li:eq(1)').text();\n\n\tif (!email) {\n\t\treturn;\n\t}\n\n\tbouncex.push(['user', {\n\t\temail: email,\n\t\tsource: 'LoggedIn'\n\t}]);\n\tsetVarAndCookie('logged_in_identified', true);\n}\n\n// item tracking\nfunction getPDPId() {\n\treturn formatId(window.location.pathname);\n}\nfunction getShqId() {\n\tvar key = Number(bouncex.utils.getNestedProp('ShopifyAnalytics.meta.selectedVariantId')) || null;\n\tvar itemsArray = bouncex.utils.getNestedProp('ShopifyAnalytics.meta.product.variants') || null;\n\tvar product;\n\tif (key && itemsArray) {\n\t\tproduct = itemsArray.filter(k => k.id === key);\n\t\treturn product[0].sku;\n\t} else { return null; }\n}\n\nfunction getPDPImage() {\n\tvar $selector = jQuery('.section__images .link-zoom[tabindex=\"0\"] img:first'),\n\t\tsrc;\n\n\t$selector = $selector.length ? $selector : jQuery('.section__images img:first');\n\n\tsrc = $selector.attr('src') || '';\n\tif (!src) {\n\t\treturn;\n\t}\n\n\tsrc = src.indexOf('http') === -1 ? 'https:' + src : src;\n\treturn bouncex.utils.url.allowParams([], src);\n}\n\nfunction getPDPCategory() {\n\treturn bouncex.utils.getNestedProp('ShopifyAnalytics.meta.product.type') || 'other';\n}\n\nfunction isExcluded() {\n\treturn jQuery('.form-product em').text().toLowerCase() === 'not eligible for discounts or promo codes' || \n\t jQuery('.form-product em').text().toLowerCase() === 'not eligible for additional discounts or promo codes';\n}\n\nfunction buildItem() {\n\tvar item = {\n\t\tid: getPDPId(),\n\t\tshq_id: getShqId(),\n\t\tcopy: bouncex.vars.prod_name,\n\t\tcategory: getPDPCategory(),\n\t\timageurl: getPDPImage(),\n\t\turl: getPageUrl(),\n\t\tinstock: bouncex.vars.in_stock ? 1 : 0,\n\t\texcluded: isExcluded()\n\t},\n\tnewItem = {},\n\tx;\n\tif (!item.id) {\n\t\treturn false;\n\t}\n\tfor (x in item) {\n\t\tif (item.hasOwnProperty(x)) {\n\t\t\tnewItem['item:' + x] = item[x];\n\t\t\tdelete item[x];\n\t\t}\n\t}\n\treturn newItem;\n}\n\nfunction fireViewItem(id) {\n\tif (!id) {\n\t\treturn;\n\t}\n\tbouncex.push(['view item', {\n\t\t'item:id': id,\n\t\t'item:shq_id': getShqId()\n\t}]);\n}\n\nfunction trackItem() {\n\tvar item = buildItem();\n\n\tif (item === false || !bouncex.utils.getNestedProp('ShopifyAnalytics.meta.product.id')) {\n\t\treturn;\n\t}\n\n\tfireViewItem(item['item:id']);\n\tbouncex.setTimeout2(function () {\n\t\tbouncex.push(['item', item]);\n\t}, DEFAULT_TIMEOUT * 2);\n}\n\n// category tracking\nfunction getCatGetItemIds() {\n\treturn jQuery('.section-collections .product').not('.show-more-item').map(function () {\n\t\tvar id = formatId(jQuery(this).find('.product__image a').attr('href'));\n\t\treturn id || undefined;\n\t}).toArray().join() || false;\n}\n\nfunction getCatPageTitle() {\n\treturn jQuery('h1').text().trim() || 'other';\n}\n\nfunction trackCategory() {\n\tif (window.location.href.indexOf('eberjey') > -1) { return; }\n\tvar ids = getCatGetItemIds();\n\tif (ids === false) {\n\t\treturn;\n\t}\n\tbouncex.push(['view category', {\n\t\t'items:ids': ids,\n\t\t'page:title': getCatPageTitle(),\n\t\t'page:url': getPageUrl()\n\t}]);\n}\n\n// cart tracking\nfunction getSubProductId($el) {\n\tvar attr = $el.parents('.product-complete-the-look').find('.product__image a:first').attr('href');\n\n\tif (!attr) {\n\t\treturn false;\n\t}\n\n\treturn formatId(attr);\n}\n\nfunction fireATC() {\n\tvar $el = jQuery(this),\n\t\tid = !$el.hasClass('complete-the-look-btn') ? getPDPId() : getSubProductId($el);\n\n\tif (!id || isReplen()) {\n\t\treturn;\n\t}\n\tbouncex.et.onTrue(getCookie, function () {\n\t\tbouncex.push(['add to cart', {\n\t\t\t'item:id': id,\n\t\t\t'item:shq_id': getShqId(),\n\t\t\t'cart:token': getCookie()\n\t\t}]);\n\t\tsetCartSet(true);\n\t});\n}\n\nfunction replenish (cart) {\n\tbouncex.utils.cookies.create({\n\t\tname: 'cart',\n\t\tvalue: cart.token\n\t});\n\n\tif(!isReplen()) {\n\t\treturn;\n\t}\n\n\tbouncex.setTimeout2(function () {\n\t\twindow.location.href = window.location.pathname + '?bx_replen=true';\n\t}, DEFAULT_TIMEOUT);\n}\n\nfunction trackATC() {\n\tbouncex.et.on(jQuery(document), 'click.bx', fireATC, '.form__actions input.btn--solid, #AddToCart--, .customizer__controls--actions input[value=\"add to cart\"]');\n}\n\nfunction getShopifyCart() {\n\tif (window.Shopify && window.Shopify.getCart) {\n\t\tvar items;\n\t\twindow.Shopify.getCart(function(cart) {\n\t\t\tif(cart && cart.items && cart.items_subtotal_price && cart.token) {\n\t\t\t\titems = cart.items.map(ea => {\n\t\t\t\t\tvar price = ea.price ? ea.price /= Math.pow(10,2) : 0;\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\t'ProductId': ea.sku,\n\t\t\t\t\t\t'UnitPrice': price,\n\t\t\t\t\t\t'Quantity': ea.quantity\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif(items) {\n\t\t\t\twindow._smtr.push(['pageView',{\n\t\t\t\t\t'pageType': 'cart',\n\t\t\t\t\t'Items': items,\n\t\t\t\t\t'CartId': cart.token,\n\t\t\t\t\t'Total': cart.items_subtotal_price ? cart.items_subtotal_price /= Math.pow(10,2) : 0\n\t\t\t\t}]);\n\t\t\t}\n\t\t});\n\t}\n}\n\nfunction fireEmptyCart() {\n\tif (bouncex.vars.cart_set === true\n\t\t&& jQuery('#cart-inner .cart-empty').length > 0\n\t) {\n\t\tbouncex.push(['empty_cart', {}]);\n\t\tsetCartSet(false);\n\t\tshqCartEmpty();\n\t}\n}\n\nfunction trackEmptyCart() {\n\tfireEmptyCart();\n\tbouncex.et.onVisible('#cart-inner .cart-empty', fireEmptyCart);\n}\n\nfunction initCart() {\n\tbouncex.et.cart.init({\n\t\treplenish: replenish,\n\t\treplenishmentType: 'cookie'\n\t});\n}\n\nfunction trackTradeUser(){\n\tbouncex.et.onVarChange('logged_in', function(){\n\t\tbouncex.et.onTrue(function(){\n\t\t\treturn window.dataLayer;\n\t\t}, function(){\n\t\t\twindow.dataLayer.filter(function(elem){\n\t\t\t\tif (elem.event === 'tradeUserLogin' && !bouncex.vars.trade_user_identified){\n\t\t\t\t\tbouncex.push(['trade_user', {}]);\n\t\t\t\t\tsetVarAndCookie('trade_user_identified', true);\n\t\t\t\t}\n\t\t\t});\n\t\t}, 10);\n\t});\n}\n\nif (isValidDomain() && !isGiftCard()) {\n\tinitCart();\n\ttrackLoggedInUser();\n\ttrackEmptyCart();\n\ttrackTradeUser();\n\tswitch (bouncex.website.pts) {\n\t\tcase 'product':\n\t\t\ttrackItem();\n\t\t\ttrackATC();\n\t\t\tbreak;\n\t\tcase 'category':\n\t\t\ttrackCategory();\n\t\t\tbreak;\n\t\tcase 'cart':\n\t\t\tgetShopifyCart();\n\t\t\tbreak;\n\t}\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"}],[{"activation":"current_page_url","prop":"not_contains","prop2":"","prop3":"","val":"cartagena"}]]},"category":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"window.location.href.indexOf('/collections') > -1 || window.location.href.indexOf('/pages') > -1;"}],[{"activation":"current_page_url","prop":"not_contains","prop2":"","prop3":"","val":"/product"}],[{"activation":"current_page_url","prop":"not_contains","prop2":"","prop3":"","val":"/bedding-guide"}]]},"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":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"/product"}]]},"search":{"testmode":false,"val":[[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"/search"}]]}},"els":{},"vars":[{"name":"logged_in","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"/* if user is logged in in Shopify, __st.cid returns unique identifier */\n!!__st.cid;","trigger":"pageload"},{"name":"ever_logged_in","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"bouncex.vars.logged_in || null;","trigger":"pageload"},{"name":"ever_logged_in_dupe","polling":"none","persist":"no","page_types":[],"testmode":true,"default":"false","code":"bouncex.vars.logged_in || null;","trigger":"pageload"},{"name":"cart_qty","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"0","code":"(function() {\n\tif (bouncex.website.pts === 'cart') {\n\t\treturn jQuery('.cart .cart__link').text().trim() || 0;\n\t}\n\treturn jQuery('.cart-empty').length > 0 ? 0 : jQuery('.cart .cart__link').text().trim() || null;\n})();","trigger":"pageload"},{"name":"cart_value","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"0","code":"jQuery('.cart-empty').length > 0 ? 0 : jQuery('.cart .cart__inner-actions, .total-line--subtotal .total-line__price').text().replace(/[^0-9.]/g, '') || null;","trigger":"pageload"},{"name":"prod_name","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"bouncex.website.pts === 'product' ? jQuery('meta[property=\"og:title\"]').attr('content') : null;","trigger":"pageload"},{"name":"prod_price","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"bouncex.website.pts === 'product' ? jQuery('.section__price .money').text().replace(/[^0-9.]/g, '') : null;","trigger":"pageload"},{"name":"in_stock","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"(function () {\n\tvar in_stock = true;\n\n\tif (jQuery('.section__content .form__row .select').length === 0) {\n\t\treturn jQuery('.form-product .form__btn:visible').length > 0;\n\t}\n\n\tjQuery.each(dataLayer, function (i) {\n\t\tif (dataLayer[i].event === 'stock' && dataLayer[i].in_stock === false) {\n\t\t\tin_stock = false;\n\t\t\treturn in_stock;\n\t\t}\n\t});\n\n\treturn in_stock;\n})();","trigger":"pageload"},{"name":"submitted_onsite","polling":"all","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"jQuery('.klaviyo_messages .success_message:visible').length > 0 || null;","trigger":"pageload"},{"name":"cart_set","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":"cart","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"cart_categories","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"","code":"null;","trigger":"pageload"},{"name":"submit_trafficsource","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"(function(){\n if(bouncex.utils.getParam('utm_source')){\n return \"utm_source=\" + bouncex.utils.getParam('utm_source')\n }\n return null\n})()","trigger":"pageload"},{"name":"submit_trafficmedium","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"(function(){\n if(bouncex.utils.getParam('utm_medium')){\n return \"utm_medium=\" + bouncex.utils.getParam('utm_medium')\n }\n return null\n})()","trigger":"pageload"},{"name":"submit_page","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"submit_trafficcampaign","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"(function(){\n if(bouncex.utils.getParam('utm_campaign')){\n return \"utm_campaign=\" + bouncex.utils.getParam('utm_campaign');\n }\n return null;\n})();","trigger":"pageload"},{"name":"bx_coupon","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"(function(){\r\n if(bouncex.utils.getParam('bouncex_kassatex')){\r\n return bouncex.utils.getParam('bouncex_kassatex')\r\n }\r\n return null\r\n})()","trigger":"pageload"},{"name":"trade_user_identified","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":0,"spatm":1,"preinit_cjs":"","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 Kassatex mktg txts (like cart reminders) to this #, per terms.","eventSharing":false,"shqId":"6cl4ks2wby-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":"328858352","ga4_measurement_id":"G-4T2C7K0YVR","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":"005ab6b05ecd8ae76686b26c919990d4","creativesBaseStyles":"a53944a2","gpsAuction":"bbb80866120d17013073bb6d284cbd6b","inbox":"75060a85c1a4aebcc6f779b9e84db722","onsite":"abbdf7a49be9b52b097917b7b527b262","sms":"e39203556bab2366e56296ce42e974a7","websdk":"dbf896ad7d9c86338a81674dc2b145ad"}; 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'); 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_9d211eb186177a1005c747735de6140a.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(); }})();