(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":1115,"name":"Casper | United States | English","cookie_name":"bounceClientVisit1115","domain":"casper.com","ct":"fp_local_storage","ally":0,"ei":1,"tcjs":"","cjs":"/* MW: track sessions https://www.wrike.com/open.htm?id=227974108 */\nvar currentVID = bouncex.cookie.vid;\nvar lastVID = bouncex.vars.session_vid;\nvar lastCount = bouncex.vars.session_count;\n\nif (lastVID !== currentVID) {\n bouncex.setVar('session_vid', currentVID); // update to current VID\n bouncex.setVarAndReload('session_count', lastCount + 1); // increase count\n}\n\nbouncex.infoStore = {\n\tsessionStorageIdentifier: 'bxInfoStore',\n\tset: function(data) {\n\t var hashedData = bouncex.lz.compressToURI(JSON.stringify(data));\n\t try {\n\t\tsessionStorage.setItem(this.sessionStorageIdentifier, hashedData);\n\t } catch(e) {\n\t\tbouncex.err('session storage failure');\n\t }\n\t},\n\tget: function() {\n\t var email = sessionStorage.getItem(this.sessionStorageIdentifier);\n\t\t return email ? JSON.parse(bouncex.lz.decompressFromURI(email)) : '';\n\t},\n\tinfoIsStored: function() {\n\t return !!sessionStorage.getItem(this.sessionStorageIdentifier);\n\t},\n\tpopulateFields: function(fields) {\n\t if (!this.infoIsStored()) return;\n\t \n\t var data = this.get();\n\t for (var field in fields) {\n\t\tif (fields.hasOwnProperty(field)) {\n\t\t fields[field].val(data[field]);\n\t\t}\n\t }\n\t}\n };\n \n/* https://www.wrike.com/open.htm?id=391680879 */\nif (bouncex.state.mobile) {\n\tbouncex.off(jQuery('button[class*=BuyBar__add-to-cart]'), 'click.bx-cta');\n\tbouncex.on(jQuery('button[class*=BuyBar__add-to-cart]'), 'click.bx-cta', function() {\n\t\tbouncex.setVarAndReload('native_scroll_to_top_button', true);\n\t\tbouncex.off(jQuery('button[class*=BuyBar__add-to-cart]'), 'click.bx-cta');\n\t});\n}\n\n\n/* DATES FOR TIMER */\n(function(){\n var today = Date.parse(new Date());\n var currentsubmitdisclaimer;\n\n var firstStartDate = Date.parse('December 24, 2021 3:00 AM');\n var firstEndDate = Date.parse('March 4, 2022 3:00 AM');\n \n if (today >= firstStartDate && today < firstEndDate && !bouncex.vars.show_timer){\n \n bouncex.setVar('show_timer', true);\n\n bouncex.setBounceCookie();\n bouncex.reload_campaigns();\n }\n \n})();\n\n\n(function(){\n var today = Date.parse(new Date());\n var currentsubmitdisclaimer;\n\n var firstStartDate = Date.parse('November 10, 2023 3:00 AM');\n var firstEndDate = Date.parse('November 22, 2023 3:00 AM');\n\n var secondStartDate = Date.parse('November 22, 2023 3:00 AM');\n var secondEndDate = Date.parse('November 25, 2023 3:00 AM');\n \n \n /**************\n * \n * Uncomment code below for more dates\n * \n *************/\n \n var thirdStartDate = Date.parse('November 25, 2023 3:00 AM');\n var thirdEndDate = Date.parse('December 1, 2023 3:00 AM');\n \n var fourthStartDate = Date.parse('April 21, 2024 3:00 AM');\n var fourthEndDate = Date.parse('April 26, 2024 3:00 AM');\n \n var fifthStartDate = Date.parse('December 19, 2023 3:00 AM');\n var fifthEndDate = Date.parse('December 26, 2023 3:00 AM');\n \n var sixthStartDate = Date.parse('April 2, 2024 3:00 AM');\n var sixthEndDate = Date.parse('April 4, 2024 6:00 PM'); \n \n var seventhStartDate = Date.parse('April 26, 2024 12:00 AM');\n var seventhEndDate = Date.parse('May 1, 2024 3:00 AM');\n \n var eighthStartDate = Date.parse('February 28, 2023 3:00 AM');\n var eighthEndDate = Date.parse('November 10, 2023 3:00 AM');\n \n \n if (today >= firstStartDate && today < firstEndDate){\n \n bouncex.setVar('ecap_header', 'Plus, take an extra 10% off.*');\n bouncex.setVar('submitdisclaimer', '');\n bouncex.setVar('ctrl_ecap_headline', 'Get up to 25% off everything.');\n bouncex.setVar('promo_couponcode', 'Use code: BFCM23-LC');\n bouncex.setVar('ctrl_psubmit_subheadline', 'Be on the lookout for exclusive offers & more sent directly to your phone.');\n bouncex.setVar('ctrl_id_promo_headline', 'Get up to 25% off everything.*');\n bouncex.setVar('ctrl_id_promo_subheadline', '');\n bouncex.setVar('ctrl_learnmore_headline', 'Get up to 25% off everything.');\n bouncex.setVar('ctrl_learnmore_subheadline', 'Plus, take an extra 10% off*');\n bouncex.setVar('promo_id_rtb', ' Get up to 25% off everything. ');\n bouncex.setVar('promo_ecap_rtb', 'Get an extra 10% off with our subscriber exclusive');\n bouncex.setVar('promo_psubmit_rtb', 'Take an extra 10% off everything with code: BFCM23-LC');\n bouncex.setVar('ctrl_id_prehead', 'Black Friday Sale');\n bouncex.setVar('disclaimer_ad', '*Offer expires 11/21/23 at 11:59pm PT. Excludes final sale and clearance items. Limit one offer per customer and order. Please see casper.com/terms for additional Terms & Conditions. Extra 10% off subscriber exclusive is only available at casper.com.');\n bouncex.setVar('rtbmessage2copy', 'Get up to 25% off everything.');\n bouncex.setVar('rtbmessage2cta', 'Shop now');\n bouncex.setVar('rtbmessage2url', 'https://casper.com/black-friday-mattress-sale.html');\n bouncex.setVar('disclaimer_new', ' *Offer expires 11/30/23. Excludes final sale and clearance items. Cannot be combined with another offer. Offer valid only at casper.com and participating retailers. See casper.com/promo for details. ');\n bouncex.setVar('promo_subhead2', '');\n bouncex.setVar('ecap_prehead', 'Plus, take an extra 10% off.*');\n bouncex.setVar('promo_echo_rtb_copy2', 'Refer a friend, get $75');\n bouncex.setVar('promo_echo_rtb_url2', 'https://casper.com/friends-mattress');\n bouncex.setVar('ctrl_learnmore_subheadline2', 'https://casper.com/black-friday-mattress-sale.html');\n bouncex.setVar('exit_prehead', 'SUBSCRIBER EXCLUSIVE');\n bouncex.setVar('exit_header', 'Get up to 25% off everything.');\n bouncex.setVar('sms_exit_header', 'Get up to 25% off everything.*');\n bouncex.setVar('sms_exit_prehead', 'SUBSCRIBER EXCLUSIVE');\n bouncex.setVar('post_submit_disclaimer', 'Offer expires 11/21/23 at 11:59pm PT. Excludes final sale and clearance items. Limit one offer per customer and order. Please see casper.com/terms for additional Terms & Conditions. Extra 10% off subscriber exclusive is only available at casper.com. ');\n bouncex.setVar('sms_entrancesubhead', 'Get up to 25% off everything.');\n bouncex.setVar('exit_ecap_subhead', 'When you sign up for Casper emails.');\n bouncex.setVar('ecap_prehead2', 'SUBSCRIBER EXCLUSIVE');\n bouncex.setVar('sms_prehead', 'SIGN UP FOR CASPER TEXT ALERTS');\n bouncex.setVar('sms_subhead', 'Subscriber Exclusive: Up to 25% off everything. Plus, take an extra 10% off. ');\n bouncex.setVar('sms_postsubmit_subhead', 'BFCM23-LC');\n bouncex.setVar('sms_subhead2', 'Plus, take an extra 10% off.*');\n bouncex.setVar('postsubmitsubhead', 'Use code:');\n bouncex.setVar('cornertabcta', 'Unlock Offer');\n bouncex.setVar('inlinezonesubhead', 'Plus, take an extra 10% off when you sign up for Casper emails.');\n bouncex.setVar('inlinezoneheader', 'Get up to 25% off everything.*');\n\n bouncex.setBounceCookie();\n bouncex.reload_campaigns();\n } else if (today >= secondStartDate && today < secondEndDate) {\n \n bouncex.setVar('ecap_header', 'Never miss out on subscriber exclusives.');\n bouncex.setVar('submitdisclaimer', '');\n bouncex.setVar('ctrl_ecap_headline', 'Get up to 30% off everything.*');\n bouncex.setVar('promo_couponcode', 'Discount applied at checkout');\n bouncex.setVar('ctrl_psubmit_subheadline', 'Be on the lookout for exclusive offers & more sent directly to your phone.');\n bouncex.setVar('ctrl_id_promo_headline', 'Get up to 30% off everything.*');\n bouncex.setVar('ctrl_id_promo_subheadline', '');\n bouncex.setVar('ctrl_learnmore_headline', 'Get up to 30% off everything.*');\n bouncex.setVar('ctrl_learnmore_subheadline', 'Looking to save on sleep today? ');\n bouncex.setVar('promo_id_rtb', ' Get up to 30% off everything. ');\n bouncex.setVar('promo_ecap_rtb', 'Never miss out on subscriber exclusives.');\n bouncex.setVar('promo_psubmit_rtb', 'Get up to 30% off everything.');\n bouncex.setVar('ctrl_id_prehead', 'BEST OFFER EVER');\n bouncex.setVar('disclaimer_ad', ' *Offer expires 11/30/23 at 11:59pm PT. Excludes final sale and clearance items. Limit one offer per customer and order. Please see casper.com/terms for additional Terms & Conditions.');\n bouncex.setVar('rtbmessage2copy', 'Get up to 30% off everything.');\n bouncex.setVar('rtbmessage2cta', 'Shop now');\n bouncex.setVar('rtbmessage2url', 'https://casper.com/black-friday-mattress-sale.html');\n bouncex.setVar('disclaimer_new', ' *Offer expires 11/30/23. Excludes final sale and clearance items. Cannot be combined with another offer. Offer valid only at casper.com and participating retailers. See casper.com/promo for details. ');\n bouncex.setVar('promo_subhead2', '');\n bouncex.setVar('ecap_prehead', 'Never miss out on subscriber exclusives');\n bouncex.setVar('promo_echo_rtb_copy2', 'Refer a friend, get $75');\n bouncex.setVar('promo_echo_rtb_url2', 'https://casper.com/friends-mattress');\n bouncex.setVar('ctrl_learnmore_subheadline2', 'https://casper.com/black-friday-mattress-sale.html');\n bouncex.setVar('exit_prehead', 'BEST OFFER EVER');\n bouncex.setVar('exit_header', 'Get up to 30% off everything.*');\n bouncex.setVar('sms_exit_header', 'Get up to 30% off everything.*');\n bouncex.setVar('sms_exit_prehead', 'BEST OFFER EVER');\n bouncex.setVar('post_submit_disclaimer', 'Offer expires 11/30/23 at 11:59pm PT. Excludes final sale and clearance items. Limit one offer per customer and order. Please see casper.com/terms for additional Terms & Conditions. ');\n bouncex.setVar('exit_ecap_subhead', 'When you sign up for Casper emails.');\n bouncex.setVar('ecap_prehead2', 'BEST OFFER EVER');\n bouncex.setVar('sms_prehead', 'SIGN UP FOR CASPER TEXT ALERTS');\n bouncex.setVar('sms_subhead', 'Best Offer Ever: Up to 30% off everything. ');\n bouncex.setVar('sms_postsubmit_subhead', 'Discount applied at checkout');\n bouncex.setVar('sms_subhead2', 'Never miss out on subscriber exclusives');\n bouncex.setVar('postsubmitsubhead', '');\n bouncex.setVar('sms_entrancesubhead', 'Get up to 30% off everything.*');\n bouncex.setVar('cornertabcta', 'Unlock Offer');\n bouncex.setVar('inlinezonesubhead', 'Never miss out on subscriber exclusives when you sign up for Casper emails.');\n bouncex.setVar('inlinezoneheader', 'Get up to 30% off everything*');\n \n \n bouncex.setBounceCookie();\n bouncex.reload_campaigns();\n } else if (today >= thirdStartDate && today < thirdEndDate) {\n\n bouncex.setVar('ecap_header', 'Plus, take an extra 10% off.*');\n bouncex.setVar('submitdisclaimer', '');\n bouncex.setVar('ctrl_ecap_headline', 'Get up to 30% off everything.');\n bouncex.setVar('promo_couponcode', 'Use code: BFCM23-LC');\n bouncex.setVar('ctrl_psubmit_subheadline', 'Be on the lookout for exclusive offers & more sent directly to your phone.');\n bouncex.setVar('ctrl_id_promo_headline', 'Get up to 30% off everything.*');\n bouncex.setVar('ctrl_id_promo_subheadline', '');\n bouncex.setVar('ctrl_learnmore_headline', 'Get up to 30% off everything.');\n bouncex.setVar('ctrl_learnmore_subheadline', 'Plus, take an extra 10% off*');\n bouncex.setVar('promo_id_rtb', ' Get up to 30% off everything. ');\n bouncex.setVar('promo_ecap_rtb', 'Get an extra 10% off with our subscriber exclusive');\n bouncex.setVar('promo_psubmit_rtb', 'Take an extra 10% off everything with code: BFCM23-LC');\n bouncex.setVar('ctrl_id_prehead', 'BEST OFFER EVER');\n bouncex.setVar('disclaimer_ad', '*Offer expires 11/30/23 at 11:59pm PT. Excludes final sale and clearance items. Limit one offer per customer and order. Please see casper.com/terms for additional Terms & Conditions. Extra 10% off subscriber exclusive is only available at casper.com.');\n bouncex.setVar('rtbmessage2copy', 'Get up to 30% off everything.');\n bouncex.setVar('rtbmessage2cta', 'Shop now');\n bouncex.setVar('rtbmessage2url', 'https://casper.com/black-friday-mattress-sale.html');\n bouncex.setVar('disclaimer_new', ' *Offer expires 11/30/23. Excludes final sale and clearance items. Cannot be combined with another offer. Offer valid only at casper.com and participating retailers. See casper.com/promo for details. ');\n bouncex.setVar('promo_subhead2', '');\n bouncex.setVar('ecap_prehead', 'Plus, take an extra 10% off.*');\n bouncex.setVar('promo_echo_rtb_copy2', 'Refer a friend, get $75');\n bouncex.setVar('promo_echo_rtb_url2', 'https://casper.com/friends-mattress');\n bouncex.setVar('ctrl_learnmore_subheadline2', 'https://casper.com/black-friday-mattress-sale.html');\n bouncex.setVar('exit_prehead', 'SUBSCRIBER EXCLUSIVE');\n bouncex.setVar('exit_header', 'Get up to 30% off everything.');\n bouncex.setVar('sms_exit_header', 'Get up to 30% off everything.*');\n bouncex.setVar('sms_exit_prehead', 'SUBSCRIBER EXCLUSIVE');\n bouncex.setVar('post_submit_disclaimer', 'Offer expires 11/30/23 at 11:59pm PT. Excludes final sale and clearance items. Limit one offer per customer and order. Please see casper.com/terms for additional Terms & Conditions. Extra 10% off subscriber exclusive is only available at casper.com. ');\n bouncex.setVar('sms_entrancesubhead', 'Get up to 30% off everything.');\n bouncex.setVar('exit_ecap_subhead', 'When you sign up for Casper emails.');\n bouncex.setVar('ecap_prehead2', 'SUBSCRIBER EXCLUSIVE');\n bouncex.setVar('sms_prehead', 'SIGN UP FOR CASPER TEXT ALERTS');\n bouncex.setVar('sms_subhead', 'Subscriber Exclusive: Up to 30% off everything. Plus, take an extra 10% off. ');\n bouncex.setVar('sms_postsubmit_subhead', 'BFCM23-LC');\n bouncex.setVar('sms_subhead2', 'Plus, take an extra 10% off.*');\n bouncex.setVar('postsubmitsubhead', 'Use code:');\n bouncex.setVar('cornertabcta', 'Get extra
10% Off');\n bouncex.setVar('inlinezonesubhead', 'Plus, take an extra 10% off when you sign up for Casper emails.');\n bouncex.setVar('inlinezoneheader', 'Get up to 30% off everything.*');\n \n \n bouncex.setBounceCookie();\n bouncex.reload_campaigns();\n } else if (today >= fourthStartDate && today < fourthEndDate) {\n\n bouncex.setVar('ecap_header', 'Plus, take an extra 5% off.* ');\n bouncex.setVar('submitdisclaimer', '');\n bouncex.setVar('ctrl_ecap_headline', 'Get up to 25% off everything');\n bouncex.setVar('promo_couponcode', 'Use Code: BDAY-EXTRA5');\n bouncex.setVar('ctrl_psubmit_subheadline', 'Be on the lookout for exclusive offers & more sent directly to your phone. Limit one offer per customer and order. ');\n bouncex.setVar('ctrl_id_promo_headline', 'Get up to 25% off everything.*');\n bouncex.setVar('ctrl_id_promo_subheadline', '');\n bouncex.setVar('ctrl_learnmore_headline', 'Get up to 25% off everything.');\n bouncex.setVar('ctrl_learnmore_subheadline', 'Plus, take an extra 5% off.* ');\n bouncex.setVar('promo_id_rtb', ' Get up to 25% off everything. ');\n bouncex.setVar('promo_ecap_rtb', 'Take an extra 5% off our 10th Birthday Sale with our subscriber exclusive.');\n bouncex.setVar('promo_psubmit_rtb', 'Take an extra 5% off everything with code BDAY-EXTRA5');\n bouncex.setVar('ctrl_id_prehead', '10th Birthday Sale');\n bouncex.setVar('disclaimer_ad', '*Extra 5% Offer expires 4/25/24 at 11:59pm PT. Excludes final sale, and clearance items. Other exclusions may apply. Limit one offer per customer and order. ');\n bouncex.setVar('sms_postsubmit_subhead', 'BDAY-EXTRA5');\n bouncex.setVar('rtbmessage2copy', 'Get up to 25% off everything.');\n bouncex.setVar('rtbmessage2cta', 'Shop sale');\n bouncex.setVar('rtbmessage2url', 'https://casper.com/casper-birthday-mattress-sale.html');\n bouncex.setVar('disclaimer_new', '*Extra 5% Offer expires 4/25/24 at 11:59pm PT. Excludes final sale, and clearance items. Other exclusions may apply. Limit one offer per customer and order. ');\n bouncex.setVar('promo_subhead2', '');\n bouncex.setVar('ecap_prehead', 'Plus, take an extra 5% off.* ');\n bouncex.setVar('promo_echo_rtb_copy2', 'Refer a friend, Get $75.');\n bouncex.setVar('promo_echo_rtb_url2', 'https://casper.com/friends-mattress/');\n bouncex.setVar('ctrl_learnmore_subheadline2', 'https://casper.com/casper-birthday-mattress-sale.html');\n bouncex.setVar('exit_prehead', 'Subscriber Exclusive');\n bouncex.setVar('exit_header', 'Get up to 25% off everything.');\n bouncex.setVar('sms_exit_header', 'Get up to 25% off everything*.');\n bouncex.setVar('sms_exit_prehead', 'Looking to save on your sleep today?');\n bouncex.setVar('post_submit_disclaimer', 'Extra 5% Offer expires 4/25/24 at 11:59pm PT. Excludes final sale, and clearance items. Other exclusions may apply. Limit one offer per customer and order. ');\n bouncex.setVar('sms_entrancesubhead', 'Get subscriber exclusives delivered straight to your phone');\n bouncex.setVar('exit_ecap_subhead', 'Plus, take an extra 5% off. ');\n bouncex.setVar('ecap_prehead2', 'Subscriber Exclusive');\n bouncex.setVar('sms_prehead', 'SIGN UP FOR CASPER TEXT ALERTS');\n bouncex.setVar('sms_subhead', 'Subscriber Exclusive: Up to 25% off everything. Plus, take an extra 5% off.');\n bouncex.setVar('sms_subhead2', 'Subscriber Exclusive: Up to 25% off everything. Plus, take an extra 5% off.* ');\n bouncex.setVar('postsubmitsubhead', 'Use code:');\n bouncex.setVar('cornertabcta', 'Unlock Offer ');\n bouncex.setVar('inlinezonesubhead', 'Get extra
10% Off');\n bouncex.setVar('inlinezoneheader', 'Get extra
10% Off');\n \n \n bouncex.setBounceCookie();\n bouncex.reload_campaigns();\n } else if (today >= fifthStartDate && today < fifthEndDate) {\n\n bouncex.setVar('ecap_header', 'Plus, take an extra 10% off sitewide.*');\n bouncex.setVar('submitdisclaimer', '');\n bouncex.setVar('ctrl_ecap_headline', 'Get 30% off bundles.');\n bouncex.setVar('promo_couponcode', 'Use code: NY-LC');\n bouncex.setVar('ctrl_psubmit_subheadline', 'Be on the lookout for exclusive offers & more sent directly to your phone.');\n bouncex.setVar('ctrl_id_promo_headline', 'Get 30% off bundles.*');\n bouncex.setVar('ctrl_id_promo_subheadline', '');\n bouncex.setVar('ctrl_learnmore_headline', 'Get 30% off bundles.');\n bouncex.setVar('ctrl_learnmore_subheadline', 'Plus, take an extra 10% off sitewide*');\n bouncex.setVar('promo_id_rtb', ' Get 30% off bundles and up to 75% off clearance. ');\n bouncex.setVar('promo_ecap_rtb', 'Get an extra 10% off with our subscriber exclusive');\n bouncex.setVar('promo_psubmit_rtb', 'Take an extra 10% off everything with code NY-LC');\n bouncex.setVar('ctrl_id_prehead', 'NEW YEARS SALE');\n bouncex.setVar('disclaimer_ad', '*Offer expires 12/25/23 at 11:59pm PT. Excludes final sale and clearance items. Limit one offer per customer and order.');\n bouncex.setVar('rtbmessage2copy', 'Get 30% off bundles and up to 75% off clearance. ');\n bouncex.setVar('rtbmessage2cta', 'Shop now');\n bouncex.setVar('rtbmessage2url', 'https://casper.com/new-years-mattress-sale.html');\n bouncex.setVar('disclaimer_new', ' *Offer expires 12/25/23 at 11:59pm PT. Excludes final sale and clearance items. Limit one offer per customer and order. ');\n bouncex.setVar('promo_subhead2', '');\n bouncex.setVar('ecap_prehead', 'Plus, take an extra 10% off sitewide*');\n bouncex.setVar('promo_echo_rtb_copy2', 'Refer a friend, get $75');\n bouncex.setVar('promo_echo_rtb_url2', 'https://casper.com/friends-mattress');\n bouncex.setVar('ctrl_learnmore_subheadline2', 'https://casper.com/new-years-mattress-sale.html');\n bouncex.setVar('exit_prehead', 'SUBSCRIBER EXCLUSIVE');\n bouncex.setVar('exit_header', 'Get 30% off bundles');\n bouncex.setVar('sms_exit_header', 'Get 30% off bundles.*');\n bouncex.setVar('sms_exit_prehead', 'SUBSCRIBER EXCLUSIVE');\n bouncex.setVar('post_submit_disclaimer', 'Offer expires 12/25/23 at 11:59pm PT. Excludes final sale and clearance items. Limit one offer per customer and order. ');\n bouncex.setVar('sms_entrancesubhead', 'Get 30% off bundles.');\n bouncex.setVar('exit_ecap_subhead', 'When you sign up for Casper emails.');\n bouncex.setVar('ecap_prehead2', 'SUBSCRIBER EXCLUSIVE');\n bouncex.setVar('sms_prehead', 'SIGN UP FOR CASPER TEXT ALERTS');\n bouncex.setVar('sms_subhead', 'Subscriber Exclusive: Get 30% off bundles. Plus, take a extra 10% off sitewide.');\n bouncex.setVar('sms_postsubmit_subhead', 'NY-LC');\n bouncex.setVar('sms_subhead2', 'Plus, take an extra 10% off sitewide.*');\n bouncex.setVar('postsubmitsubhead', 'Use code:');\n bouncex.setVar('cornertabcta', 'Get extra
10% Off');\n bouncex.setVar('inlinezonesubhead', 'Plus, take an extra 10% off when you sign up for Casper emails.');\n bouncex.setVar('inlinezoneheader', 'Get 30% off bundles.*');\n \n \n bouncex.setBounceCookie();\n bouncex.reload_campaigns();\n } else if (today >= sixthStartDate && today < sixthEndDate) {\n\n bouncex.setVar('new_test_rtv', 'testing123');\n \n \n\n bouncex.setBounceCookie();\n bouncex.reload_campaigns();\n } else if (today >= seventhStartDate && today < seventhEndDate) {\n\n bouncex.setVar('ecap_header', 'Never miss out on subscriber exclusives ');\n bouncex.setVar('submitdisclaimer', '');\n bouncex.setVar('ctrl_ecap_headline', 'Get up to 25% off everything*');\n bouncex.setVar('promo_couponcode', 'Discount applied at checkout');\n bouncex.setVar('ctrl_psubmit_subheadline', 'Be on the lookout for exclusive offers & more sent directly to your phone. Limit one offer per customer and order. ');\n bouncex.setVar('ctrl_id_promo_headline', 'Get up to 25% off everything.*');\n bouncex.setVar('ctrl_id_promo_subheadline', '');\n bouncex.setVar('ctrl_learnmore_headline', 'Get up to 25% off mattresses.*');\n bouncex.setVar('ctrl_learnmore_subheadline', 'Never miss out on subscriber exclusives');\n bouncex.setVar('promo_id_rtb', ' Get up to 25% off everything. ');\n bouncex.setVar('promo_ecap_rtb', 'Never miss out on subscriber exclusives');\n bouncex.setVar('promo_psubmit_rtb', 'Get up to 25% off everything. ');\n bouncex.setVar('ctrl_id_prehead', '10th Birthday Sale');\n bouncex.setVar('disclaimer_ad', '*Offer expires 5/1/24 at 11:59pm PT. Excludes final sale, and clearance items. Other exclusions may apply. Limit one offer per customer and order. ');\n bouncex.setVar('sms_postsubmit_subhead', '');\n bouncex.setVar('rtbmessage2copy', 'Get up to 25% off everything.');\n bouncex.setVar('rtbmessage2cta', 'Shop sale');\n bouncex.setVar('rtbmessage2url', 'https://casper.com/casper-birthday-mattress-sale.html');\n bouncex.setVar('disclaimer_new', '*Offer expires 5/1/24 at 11:59pm PT. Excludes final sale, and clearance items. Other exclusions may apply. Limit one offer per customer and order. ');\n bouncex.setVar('promo_subhead2', '');\n bouncex.setVar('ecap_prehead', 'Never miss out on subscriber exclusives');\n bouncex.setVar('promo_echo_rtb_copy2', 'Refer a friend, Get $75.');\n bouncex.setVar('promo_echo_rtb_url2', 'https://casper.com/friends-mattress/');\n bouncex.setVar('ctrl_learnmore_subheadline2', 'https://casper.com/casper-birthday-mattress-sale.html');\n bouncex.setVar('exit_prehead', '10th Birthday Sale');\n bouncex.setVar('exit_header', 'Get up to 25% off everything.*');\n bouncex.setVar('sms_exit_header', 'Get up to 25% off everything*.');\n bouncex.setVar('sms_exit_prehead', 'Looking to save on your sleep today?');\n bouncex.setVar('post_submit_disclaimer', 'Offer expires 5/1/24 at 11:59pm PT. Excludes final sale, and clearance items. Other exclusions may apply. Limit one offer per customer and order. ');\n bouncex.setVar('sms_entrancesubhead', 'Get subscriber exclusives delivered straight to your phone');\n bouncex.setVar('exit_ecap_subhead', 'Never miss out on subscriber exclusives');\n bouncex.setVar('ecap_prehead2', '10th Birthday Sale');\n bouncex.setVar('sms_prehead', 'SIGN UP FOR CASPER TEXT ALERTS');\n bouncex.setVar('sms_subhead', '10th Birthday Sale: Up to 25% off everything.');\n bouncex.setVar('sms_subhead2', '10th Birthday Sale: Up to 25% off everything.* ');\n bouncex.setVar('postsubmitsubhead', 'Discount applied at checkout');\n bouncex.setVar('cornertabcta', 'Unlock Offer ');\n bouncex.setVar('inlinezonesubhead', 'Get extra
10% Off');\n bouncex.setVar('inlinezoneheader', 'Get extra
10% Off');\n \n \n\n bouncex.setBounceCookie();\n bouncex.reload_campaigns();\n } else if (today >= eighthStartDate && today < eighthEndDate) {\n\n bouncex.setVar('ecap_header', 'Plus, 10% off everything else.*');\n bouncex.setVar('submitdisclaimer', '');\n bouncex.setVar('ctrl_ecap_headline', 'Get up to 25% off mattresses.');\n bouncex.setVar('promo_couponcode', 'BXEC-04-0928');\n bouncex.setVar('ctrl_psubmit_subheadline', 'Be on the lookout for exclusive offers & more sent directly to your phone.');\n bouncex.setVar('ctrl_id_promo_headline', 'Leaving something behind?');\n bouncex.setVar('ctrl_id_promo_subheadline', '');\n bouncex.setVar('ctrl_learnmore_headline', 'Get up to 25% off mattresses.');\n bouncex.setVar('ctrl_learnmore_subheadline', 'Looking to save on sleep today?');\n bouncex.setVar('promo_id_rtb', ' Refer a friend, Get $75.');\n bouncex.setVar('promo_ecap_rtb', 'A dreamy offer awaits: Save up to 25% on mattresses today.');\n bouncex.setVar('promo_psubmit_rtb', 'Up to 25% off mattresses, 10% off everything else with code: ');\n bouncex.setVar('ctrl_id_prehead', '');\n bouncex.setVar('disclaimer_ad', '*Excludes final sale, bundles, and clearance items. Other exclusions may apply. Limit one offer per customer and order. Please see casper.com/terms for additional Terms & Conditions. By clicking “Submit” you agree to Casper’s Terms & Conditions and Privacy Policy. You also agree to receive marketing emails. You can unsubscribe at any time. ');\n bouncex.setVar('sms_postsubmit_subhead', 'BXEC-04-0928');\n bouncex.setVar('rtbmessage2copy', 'Refer a friend, Get $75');\n bouncex.setVar('rtbmessage2cta', 'Learn more');\n bouncex.setVar('rtbmessage2url', 'https://casper.com/mattresses');\n bouncex.setVar('disclaimer_new', '*Excludes final sale, bundles, and clearance items. Other exclusions may apply. Limit one offer per customer and order. Please see casper.com/terms for additional Terms & Conditions. By clicking “Submit” you agree to Casper’s Terms & Conditions and Privacy Policy. You also agree to receive marketing emails. You can unsubscribe at any time.');\n bouncex.setVar('promo_subhead2', '');\n bouncex.setVar('ecap_prehead', 'Plus, 10% off everything else.*');\n bouncex.setVar('promo_echo_rtb_copy2', 'Refer a friend, Get $75');\n bouncex.setVar('promo_echo_rtb_url2', 'https://casper.com/friends-mattress/');\n bouncex.setVar('ctrl_learnmore_subheadline2', 'https://casper.com/friends-mattress/');\n bouncex.setVar('exit_prehead', 'NEVER MISS THE NEXT SALE');\n bouncex.setVar('exit_header', 'Take up to 25% off your purchase');\n bouncex.setVar('sms_exit_header', 'Take up to 25% off your purchase*');\n bouncex.setVar('sms_exit_prehead', 'Looking to save on your sleep today?');\n bouncex.setVar('post_submit_disclaimer', 'Excludes final sale, bundles, and clearance items. Other exclusions may apply. Limit one offer per customer and order. Please see casper.com/terms for additional Terms & Conditions. By clicking “Submit” you agree to Casper’s Terms & Conditions and Privacy Policy. You also agree to receive marketing emails. You can unsubscribe at any time. ');\n bouncex.setVar('sms_entrancesubhead', 'Up to 25% off mattresses. Plus, 10% off everything else.');\n bouncex.setVar('exit_ecap_subhead', 'Plus, 10% off everything else.*');\n bouncex.setVar('ecap_prehead2', 'SIGN UP FOR CASPER EMAILS');\n bouncex.setVar('sms_prehead', 'SIGN UP FOR CASPER TEXT ALERTS');\n bouncex.setVar('sms_subhead', 'Up to 25% off mattresses. Plus, 10% off everything else.');\n bouncex.setVar('sms_subhead2', 'Get this offer delivered straight to your phone. ');\n bouncex.setVar('postsubmitsubhead', 'Use code');\n bouncex.setVar('cornertabcta', 'Get up to 10% off');\n bouncex.setVar('inlinezonesubhead', 'Get extra
10% Off');\n bouncex.setVar('inlinezoneheader', 'Get extra
10% Off');\n }\n })();\n \n/* wrike id 566868989 */\nbouncex.sendToCS = function(csKey, csValue) {\n csKey = \"MA_WK_\" + csKey;\n\n _uxa.push([\"trackDynamicVariable\", {\n key: csKey,\n value: csValue\n }]);\n};\n\nfunction CScallback() {\n if (!disableCallback) {\n disableCallback = true;\n\n if (window.CS_CONF) {\n CS_CONF.integrations = CS_CONF.integrations || [];\n CS_CONF.integrations.push(\"Wunderkind (BounceX)\");\n }\n }\n}\n\nvar disableCallback = false;\n\nwindow._uxa = window._uxa || [];\n_uxa.push([\"afterPageView\", CScallback]); \n\n\n/* wrike 576741075 */\nbouncex.wkndCarousel = function(id, rotate, delay) {\n var $campaign = bouncex.campaigns[id],\n $bxCreative = $campaign.obj1.find('.bx-creative'),\n $bxGroupCustom = $campaign.obj1.find('.bx-group-custom'),\n bxDelay = delay ? delay : 7000,\n stepIndex = 1,\n isPaused = false;\n \n function setNextStep() {\n if ($campaign.current_step === $campaign.numSteps) {\n stepIndex = 1;\n } else {\n stepIndex = $campaign.current_step;\n stepIndex++;\n }\n bouncex.setJumpStep(id, stepIndex, false);\n }\n \n function setPrevStep() {\n if ($campaign.current_step === 1) {\n stepIndex = $campaign.numSteps;\n } else {\n stepIndex = $campaign.current_step;\n stepIndex--;\n }\n bouncex.setJumpStep(id, stepIndex, false);\n }\n \n function bxCustomStepChange() {\n if ($campaign.jumpStep) {\n $campaign.next_step = $campaign.jumpStep;\n $campaign.jumpStep = false;\n }\n \n if ($campaign.next_step <= $campaign.numSteps) {\n $campaign.obj2.find('.bx-step-' + id + '-' + $campaign.current_step).removeClass('bx-active-step');\n $campaign.obj2.find('.bx-step-' + id + '-' + $campaign.next_step).addClass('bx-active-step');\n $campaign.obj2.removeClass('bx-active-step-' + $campaign.current_step).addClass('bx-active-step-' + $campaign.next_step);\n $campaign.current_step = $campaign.next_step;\n $campaign.next_step++;\n }\n \n bouncex.alignCampaign(id);\n $campaign.focusableEls = $campaign.obj1.find('form, :input, a').not(':hidden, .bx-ally-tab-decoy, .bx-carb-trap, .bx-ally-no-focus');\n }\n \n function setBxTimer() {\n if (isPaused === false){\n clearInterval($campaign.bxCarousel);\n $campaign.bxCarousel = bouncex.setInterval2(function(){\n setNextStep();\n bxCustomStepChange();\n }, bxDelay);\n }\n }\n \n bouncex.on($bxCreative, 'focusin.bx-'+id+' mouseover.bx-'+id, function(){\n isPaused = true;\n clearInterval(bouncex.campaigns[id].bxCarousel);\n });\n \n bouncex.on($bxCreative, 'focusout.bx-'+id+' mouseout.bx-'+id, function(){\n if (!jQuery(document.activeElement).is('.bx-input')) {\n isPaused = false;\n setBxTimer();\n }\n });\n \n for(var i = 0; i < $campaign.numSteps; i++) {\n var navButton = '
';\n $bxGroupCustom.append(navButton);\n }\n \n $bxGroupCustom.each(function(key, value){\n var customGroup = jQuery(value),\n stepID = customGroup.parents('form').attr('id').slice(-1);\n \n if(!!stepID) {\n customGroup.find('.bx-mobile-nav-'+stepID).addClass('bx-mobile-nav-active');\n }\n });\n \n bouncex.on($bxGroupCustom, 'click.bx-'+id, function(e){\n var eTarget = jQuery(e.target);\n \n if(eTarget.hasClass('bx-lineshape') || eTarget.hasClass('bx-mobile-nav')){\n clearInterval($campaign.bxCarousel);\n \n if (eTarget.hasClass('bx-lineshape')) {\n eTarget.parent().next('.bx-row-line').length > 0 ? setPrevStep() : setNextStep();\n } else {\n var stepNo = eTarget.attr('class').slice(-1);\n bouncex.setJumpStep(id, stepNo, false);\n }\n \n bouncex.nextStep(id);\n \n if (rotate) {\n setBxTimer();\n }\n }\n });\n \n if (rotate) {\n setBxTimer();\n }\n};\n\nbouncex.closeWkndCarousel = function(id, rotate) {\n var $campaign = bouncex.campaigns[id];\n \n $campaign.obj1.find('.bx-mobile-nav').remove();\n bouncex.off($campaign.obj1.find('.bx-group-custom'), 'click.bx-'+id);\n if (rotate) {\n clearInterval($campaign.bxCarousel);\n }\n};\n\n/* Wrike-879418714 */\nif (bouncex.utils.url.allowParams('collect').indexOf('/mattress-quiz?collect=true') > -1){\n bouncex.et.on(jQuery('#mattress-quiz-root input[name=\"email\"]'), \"input.quiztype\", function (e) {\n email = jQuery(e.target).val();\n if (bouncex.utils.validate.email(email)) {\n bouncex.infoStore.set({email: email});\n }\n });\n}","force_https":false,"waypoints":false,"content_width":0,"gai":"UA-46003726-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":[{"prop":"contains","val":"blockbouncex"}],"ple":false,"fbe":false,"mas":1,"map":1,"gar":true,"ete":1,"ettm":false,"etjs":"bouncex.et.item.requireImageLoad = false;\n\n/* --------------------------------- SHARED VARIABLES -------------------------------- */\n\nvar CLEAN_URL = bouncex.utils.url.allowParams();\n\n/* ------------------------------ ITEM TRACKING ----------------------------- */\n\nfunction trackItem() {\n var item = getItemData();\n fireItemEvents(item);\n\n bouncex.et.onVarChange('product_sku', function (oldVal, newVal) {\n if (!oldVal || !newVal) {\n return;\n }\n var item = getItemData();\n fireItemEvents(item);\n });\n}\n\nfunction getItemId(dataObj) {\n return dataObj.sku || getBundleId(dataObj.name);\n}\n\nfunction getSelectedProduct() {\n return window.bx_selected_product || {};\n}\n\n// setting defaults for custom metadata\nfunction getItemData() {\n var dataObj = getSelectedProduct();\n return {\n id: getItemId(dataObj),\n copy: dataObj.name,\n category: getItemCategory(),\n url: CLEAN_URL,\n imageurl: dataObj.imageUrl,\n price: dataObj.price || '',\n size: dataObj.size || '',\n instock: dataObj.inStock,\n is_mattress: isMattress() ? 1 : 0,\n avg_rating: Number(dataObj.avgRating) || '',\n total_reviews: Number(dataObj.totalReviews) || '',\n review_headline: dataObj.featReviewHeadline || '',\n review_text: dataObj.featReviewMessage || '',\n reviewer_name: dataObj.featReviewNameFeatured || '',\n review_stars: getStars(dataObj.avgRating)\n };\n}\n\nfunction getBundleId(bundleName) {\n return bundleName.toLowerCase()\n .replace(/ /g, '-')\n .replace(/[^\\w-]+/g, '');\n}\n\nfunction getItemCategory() {\n return isMattress() ? 'mattress' : 'notmattress';\n}\n\nfunction isMattress() {\n return (jQuery('meta[name=\"description\"]').attr('content') || '').toLowerCase().indexOf('mattress') > -1;\n}\n\nfunction getStars(reviewAvg) {\n if (!reviewAvg) { return 0; }\n var stars = Math.round(reviewAvg * 2) / 2 || 0;\n return stars.toFixed(1);\n}\n\nfunction fireItemEvents(item) {\n if (item) {\n bouncex.push(['item', item]);\n bouncex.push(['view item', { 'item:id': item.id }]);\n }\n}\n\n\n/* ---------------------------- CATEGORY TRACKING --------------------------- */\nfunction initializeQuickviewTracking() {\n var lastIdFired;\n bouncex.et.onVarChange('qv_id', function (oldVal, newVal) {\n // we are preventing the same ID from firing twice in a row\n if (newVal && lastIdFired !== newVal) {\n lastIdFired = newVal;\n bouncex.push(['view item', { 'item:id': newVal }]);\n }\n });\n}\n\nfunction initializeMattressCategoryTracking() {\n if (window.location.pathname === '/mattresses' || window.location.pathname === '/mattresses/v1') {\n bouncex.push(['view_mattress_category', {}]);\n }\n}\n\nfunction initializeBayAreaMattressTracking() {\n if (bouncex.cookie.vpv !== 1) {\n return;\n }\n\n // zip code is within the bay area zip code range\n if (Number(bouncex.state.geo.postal_code) >= 93901 && Number(bouncex.state.geo.postal_code) <= 95757) {\n bouncex.push(['view_bay_area', {}]);\n }\n}\n\n/* ------------------------------- CART EVENTS ------------------------------ */\n\nfunction fireAddToCart(itemId, replenObj) {\n if (!itemId || !replenObj.pid) {\n return;\n }\n bouncex.push([\n 'add to cart',\n {\n 'item:id': itemId,\n 'cart:item': bouncex.stringify(replenObj)\n }\n ]);\n\n if (!bouncex.vars.cart) {\n bouncex.setVar('cart', true);\n }\n}\n\nfunction initializeATCClickTracking() {\n bouncex.et.on(bouncex.document, 'click.bxatc', function (e) {\n var $target = jQuery(e.target);\n if (($target.attr('class') || '').indexOf('add-to-cart') > -1) {\n var itemId,\n replenData;\n if (window.location.href.indexOf('bundle') > -1) {\n itemId = $target.attr('data-pid');\n replenData = getBundleReplenData();\n } else {\n itemId = bouncex.vars.qv_id || getItemId(getSelectedProduct());\n replenData = { pid: itemId };\n }\n fireAddToCart(itemId, replenData);\n }\n });\n}\n\nfunction getBundleReplenData() {\n var itemsToAdd = jQuery('.js-upsell-bundle-item,.upsell-bundle-item').toArray(),\n upsellItem = jQuery('.pdp-upsell-container .custom-checkbox:checked').parents('.upsell-item').toArray();\n return {\n pid: jQuery(itemsToAdd.shift()).attr('data-item'),\n upItems: createUpsellAndBundleAddOns(upsellItem),\n upBundleItems: createUpsellAndBundleAddOns(itemsToAdd)\n };\n}\n\nfunction createUpsellAndBundleAddOns(addOns) {\n return addOns.reduce(function (items, item) {\n var data = { 'upsellID': jQuery(item).attr('data-item'), 'quantity': null };\n if (data.upsellID) {\n items.push(data);\n }\n return items;\n }, []);\n}\n\nfunction emptyCart() {\n bouncex.et.onVarChange('cart_qty', function (oldVal, newVal) {\n if (bouncex.vars.cart && newVal === 0 && oldVal > 0) {\n bouncex.push(['empty_cart']);\n bouncex.setVar('cart', false);\n }\n });\n}\n\nfunction initializeCartEvents() {\n bouncex.et.cart.init({\n replenishmentType: 'ajax',\n replenish: function (cart) {\n var deferreds = [];\n\n cart.items.forEach(function (item) {\n deferreds.push(makeAjaxATCFunc(item));\n });\n\n deferreds.reduce(\n function (promise, func) {\n return promise.then(function () {\n return func();\n });\n },\n jQuery.Deferred().resolve([])\n )\n .then(replenComplete);\n }\n });\n\n emptyCart();\n}\n\nfunction makeAjaxATCFunc(replenItem) {\n var config = {\n quantity: {\n defaultValue: 1\n },\n options: {\n defaultValue: [],\n makeAString: true\n },\n upItems: {\n defaultValue: [],\n makeAString: true\n },\n upBundleItems: {\n defaultValue: [],\n makeAString: true\n }\n };\n\n for (var key in config) {\n var configObj = config[key];\n if (!replenItem[key]) {\n replenItem[key] = configObj.defaultValue;\n }\n\n if (configObj.makeAString) {\n replenItem[key] = JSON.stringify(replenItem[key]);\n }\n }\n\n return function () {\n return jQuery.ajax({\n type: 'POST',\n url: '/on/demandware.store/Sites-casper_us-Site/en_US/Cart-AddProduct',\n headers: {\n 'content-type': 'application/x-www-form-urlencoded'\n },\n data: replenItem\n });\n };\n}\n\nfunction replenComplete() {\n window.location.href = window.location.origin +\n window.location.pathname +\n '?bx_replen=true';\n}\n\n/* ------------------------ BEHAVIORAL WELCOME ------------------- */\nfunction initFooterSubmitListener() {\n bouncex.et.onVisible('#email-signup-alert', function (e) {\n if (e.text().toLowerCase().indexOf('signed up successfully') < 0) {\n return;\n }\n\n var email = jQuery('.footer-email-signup [name=\"hpEmailSignUp\"]').val();\n if (bouncex.utils.validate.email(email)) {\n var parentInboxCampaignId = 611376;\n bouncex.push(['requestemail', {\n email: email,\n campaignId: parentInboxCampaignId,\n testmode: bouncex.testmode.bxdev ? 1 : 0\n }]);\n }\n });\n}\n\n/* ------------------------ CUSTOM MATTRESS QUIZ MODULE ------------------- */\nfunction getTileImg(imgUrl) {\n var MATTRESS_QUIZ_IMG = {\n 'full-body-support-element': 'https://assets.bounceexchange.com/assets/uploads/users/4450/101421/casper/full-body-support-element.png',\n 'airscape-element': 'https://assets.bounceexchange.com/assets/uploads/users/4450/101421/casper/airscape-element.png',\n 'zoned-support-max-nova-hybrid-snow': 'https://assets.bounceexchange.com/assets/uploads/users/4450/101421/casper/zoned-support-max-nova-hybrid-snow.png',\n 'snow-technology-nova-hybrid-snow': 'https://assets.bounceexchange.com/assets/uploads/users/4450/101421/casper/snow-technology-nova-hybrid-snow.png',\n 'zoned-support-pro-nova-hybrid': 'https://assets.bounceexchange.com/assets/uploads/users/4450/101421/casper/zoned-support-pro-nova-hybrid.png',\n 'airscape-2-nova-hybrid': 'https://assets.bounceexchange.com/assets/uploads/users/4450/101421/casper/airscape-2-nova-hybrid.png',\n 'zoned-support-max-gel-pods-wave-hybrid': 'https://assets.bounceexchange.com/assets/uploads/users/4450/101421/casper/zoned-support-max-gel-pods-wave-hybrid.png',\n 'airscape-3-cooling-gel-wave-hybrid': 'https://assets.bounceexchange.com/assets/uploads/users/4450/101421/casper/airscape-3-cooling-gel-wave-hybrid.png',\n 'zoned-support-original-hybrid': 'https://assets.bounceexchange.com/assets/uploads/users/4450/101421/casper/zoned-support-original-hybrid.png',\n 'airscape-original-hybrid': 'https://assets.bounceexchange.com/assets/uploads/users/4450/101421/casper/airscape-original-hybrid.png',\n 'zoned-support-max-gel-pods-wave-hybrid-snow': 'https://assets.bounceexchange.com/assets/uploads/users/4450/101421/casper/zoned-support-max-gel-pods-wave-hybrid-snow.png',\n 'snow-technology-wave-hybrid-snow': 'https://assets.bounceexchange.com/assets/uploads/users/4450/101421/casper/snow-technology-wave-hybrid-snow.png',\n 'zoned-support-original': 'https://assets.bounceexchange.com/assets/uploads/users/4450/101421/casper/zoned-support-original.png',\n 'airscape-original': 'https://assets.bounceexchange.com/assets/uploads/users/4450/101421/casper/airscape-original.png',\n // signature foam\n 'Frame%202527': 'https://assets.bounceexchange.com/assets/uploads/users/3661/casper/signature-foam/bc9c83e3d09a5236f1236bf6159b83c6.png'\n },\n identifier = imgUrl.replace('.svg', '').split('/').pop();\n\n return MATTRESS_QUIZ_IMG[identifier];\n}\n\nfunction getMattressResultsData() {\n var img2 = jQuery('.experience-component .image-container img').attr('src') ? jQuery('.experience-component .image-container img').attr('src') : window.location.origin;\n\n return {\n header1: jQuery('.hero-eyebrow-component').first().text().trim(),\n header2: jQuery('.hero-headline-component').first().text().trim(),\n header3: jQuery('.hero-text-component').first().text().trim(),\n recommendedmattressurl: jQuery('.mattress-link').attr('href') ? window.location.origin + jQuery('.mattress-link').attr('href') : window.location.origin,\n img1: jQuery('.product-main-image-wrapper source').first().attr('srcset'),\n // img2: jQuery('.experience-component .image-container img').attr('src') ? window.location.origin + jQuery('.experience-component .image-container img').attr('src') : window.location.origin,\n img2: img2.indexOf(window.location.origin) > -1 ? img2 : window.location.origin + img2,\n img2text: jQuery('.experience-component .headline').first().text().trim(),\n tile1img: getTileImg(jQuery('.experience-custom_assets-textandiconblock img').eq(0).attr('src')),\n tile1text: jQuery('.experience-custom_assets-textandiconblock .description').eq(0).text().trim(),\n tile2img: getTileImg(jQuery('.experience-custom_assets-textandiconblock img').eq(1).attr('src')),\n tile2text: jQuery('.experience-custom_assets-textandiconblock .description').eq(1).text().trim(),\n csimg1: 'https://caspercontent.imgix.net/7MQ2ObQ4QkhhYUsnZK3jrt/c0deea279a56df5b077e627b3ef1a4e8/2020-Casper_Pillow-gallery-01.jpg?auto=compress,format&q=65&w=400',\n csurl1: 'https://casper.com/pillows/mid-loft-pillows/pillows.html',\n csname1: 'Original Casper Pillow',\n csimg2: 'https://caspercontent.imgix.net/4FJJLFBRSKUKPYxVdg9fQ6/09ffaba4c9c1c67ea4f6245eb04853af/PercaleSheetSet-Oatmilk_SheetSet_0359.jpg?auto=compress,format&q=65&w=400',\n csurl2: 'https://casper.com/bedding/sheets/percale',\n csname2: 'Percale Sheets',\n csimg3: 'https://caspercontent.imgix.net/7Avvwm68NjQTfp4R4bcooh/bd69ad7ee14e288cdc6a0d14af8b5bb4/carousel-gallery-1-protector.jpg?auto=compress,format&q=65&w=400',\n csurl3: 'https://casper.com/bedding/mattress-protectors/waterproof',\n csname3: 'Waterproof Mattress Protector',\n };\n}\n\nfunction initMattressQuizTracking() {\n if (CLEAN_URL.indexOf('mattress-quiz') < 0 && CLEAN_URL.indexOf('quiz-result') < 0) {\n return;\n }\n \n bouncex.setv('show_results_campaign', true);\n\n bouncex.et.onVisible('h1:contains(\"THE RESULTS ARE IN\")', function () {\n var resultsData;\n bouncex.et.onTrue(function () {\n resultsData = getMattressResultsData();\n return resultsData.header1 &&\n resultsData.header2 &&\n resultsData.header3 &&\n resultsData.recommendedmattressurl &&\n resultsData.img1 &&\n resultsData.img2 &&\n resultsData.img2text &&\n resultsData.tile1img &&\n resultsData.tile1text &&\n resultsData.tile2img &&\n resultsData.tile2text;\n }, function () {\n bouncex.push(['mattress_quiz', resultsData]);\n }, 15);\n });\n}\n\n/* --------------------------- INITIALIZE TRACKING -------------------------- */\nfunction isValidDomain() {\n return CLEAN_URL.indexOf('//casper.com') > -1 || CLEAN_URL.indexOf('staging.casper') > -1;\n}\n\nfunction isEn() {\n return (jQuery('html').attr('lang') || '').indexOf('en') > -1;\n}\n\nfunction isValidForTracking() {\n return isValidDomain() && isEn();\n}\n\nfunction init() {\n\n if (!isValidForTracking()) { return; }\n initializeCartEvents();\n initializeQuickviewTracking();\n initFooterSubmitListener();\n initMattressQuizTracking();\n initializeATCClickTracking();\n initializeBayAreaMattressTracking();\n\n switch (bouncex.website.pts) {\n case 'category':\n initializeMattressCategoryTracking();\n break;\n case 'product':\n bouncex.et.onTrue(function () { return window.bx_selected_product; }, trackItem);\n break;\n default:\n break;\n }\n}\n\ninit();","dge":true,"bxidLoadFirst":false,"pie":true,"cme":true,"gbi_enabled":0,"bpush":false,"pt":{"cart":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"window.location.pathname === '/cart';"}]]},"category":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"document.querySelectorAll('#product-search-results').length > 0;"},{"activation":"js","prop":"","prop2":"","prop3":"","val":"document.querySelectorAll('[data-qa=\"product-comparison-grid\"]').length > 0;"},{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"/bedding"},{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"/mattresses"}],[{"activation":"js","prop":"","prop2":"","prop3":"","val":"!document.querySelectorAll('link[rel=\"canonical\"][href=\"https://casper.com/\"]').length > 0;"}],[{"activation":"js","prop":"","prop2":"","prop3":"","val":"document.querySelectorAll('button.add-to-cart').length === 0;"}]]},"checkout":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"window.location.href.indexOf('/checkout') > -1;"}]]},"home":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"document.querySelectorAll('link[rel=\"canonical\"][href=\"https://casper.com/\"]').length > 0;"}]]},"product":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"document.querySelectorAll('button.add-to-cart').length !== 0;"}]]},"test":{"testmode":true,"val":[[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":""}]]}},"els":{"below_addtocart_cta":".zylhtj-3.jwMGFG","results_subheadline":" p#results-subheadline.n2fdgj-3","save_for_later_cta":".Buttons-sc-10e1kgg-4.hrKQPw","topbar_inlinezone":"#bx-casper-container"},"vars":[{"name":"cart_count","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"","trigger":""},{"name":"logged_in","polling":"all","persist":"no","page_types":[],"testmode":true,"default":"false","code":"jQuery('a[href=\"/account/\"], .logout-link').length > 0;","trigger":""},{"name":"ever_logged_in","polling":"all","persist":"permanent","page_types":[],"testmode":true,"default":"false","code":"bouncex.vars.logged_in ? true : null;","trigger":""},{"name":"cart_qty","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"(function() {\n if (bouncex.website.pts === 'cart') {\n return Number(jQuery('.number-of-items-value').first().text().replace(/[^0-9.]/g, ''));\n }\n if (bouncex.website.pts === 'checkout') {\n return Number(jQuery('.card-body .grand-total-label').first().text().trim().replace(/[^0-9.]/g, ''));\n }\n\n return Number(jQuery('.minicart-quantity ').first().text().replace(/[^0-9.]/g, '')) || null;\n})();","trigger":""},{"name":"cart_value","polling":"all","persist":"visit","page_types":[],"testmode":true,"default":"0","code":"(function() {\n var $emptyCartMsg = jQuery('div[data-qa=\"empty-cart-cta\"]:visible:contains(\"Your cart is empty\")'),\n $emptyCartIcon = jQuery('button[aria-label=\"Cart\"][data-qa=\"cart\"]:visible'),\n $cartValue = jQuery('li[data-summary-item=\"subtotal\"]');\n if ($emptyCartIcon.length > 0) {\n return 0;\n }\n if ($cartValue.length > 0) {\n return Number($cartValue.text().replace(/[^0-9.]/g, '')) || null;\n }\n return null;\n})();","trigger":"pageload"},{"name":"submitted_onsite","polling":"all","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"jQuery('.email-signup-alert').text().indexOf('signed up') > -1 || null;","trigger":"pageload"},{"name":"prod_name","polling":"all","persist":"no","page_types":["product"],"testmode":false,"default":"false","code":"window.bx_selected_product && window.bx_selected_product.name || '';","trigger":""},{"name":"prod_price","polling":"all","persist":"no","page_types":["product"],"testmode":true,"default":"false","code":"(function() {\r\n var domPrice, windowPrice;\r\n /* the HTML on this page is non-specific and auto-generated */\r\n if (window.location.href.indexOf('/casper-original') > -1) {\r\n return Number(jQuery('#page-header').find('div span:contains(\"$\"):first').text().replace(/[^0-9.]/g, ''));\r\n } else if (!jQuery('button[data-qa=\"cta__add-to-cart\"]:visible:enabled').length > 0) {\r\n return false\r\n }\r\n /* domPrice uses or logic to check for discount variations first, then regular price */\r\n domPrice = Number((jQuery('span[class*=\"StrikethroughDiscount\"]:first, div[data-qa=\"render-prices\"] span[class*=\"SalePrice\"]:first') || jQuery('div[data-qa=\"render-prices\"]:first, span[class*=\"StrikethroughPrice\"]:first')).text().replace(/[^0-9.]/g, '')),\r\n windowPrice = bouncex.utils.getNestedProp('bx_product.price', false);\r\n \r\n return domPrice && domPrice != windowPrice ? Number(domPrice.toFixed(2)) : windowPrice;\r\n})();","trigger":""},{"name":"in_stock","polling":"all","persist":"no","page_types":["product"],"testmode":false,"default":"false","code":"window.bx_selected_product && window.bx_selected_product.inStock;","trigger":"pageload"},{"name":"seen_bx","polling":"none","persist":"no","page_types":[],"testmode":true,"default":"false","code":"bouncex.cookie.as>0","trigger":""},{"name":"bx_qa","polling":"none","persist":"visit","page_types":[],"testmode":true,"default":"false","code":"window.location.href.indexOf('bx_qa') > -1 || null;","trigger":""},{"name":"submitted_footer","polling":"all","persist":"permanent","page_types":[],"testmode":true,"default":"false","code":"jQuery('.Snoozeletter__form-thanks___2Kslj.Snoozeletter__active___P7PRh').is(':visible') ? true : null;","trigger":""},{"name":"prod_size","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"window.bx_selected_product && window.bx_selected_product.size || null;","trigger":""},{"name":"prod_review_stars","polling":"none","persist":"no","page_types":[],"testmode":true,"default":"","code":"jQuery('div[class*=PurchaserRating]').text().split(\"(\")[0];","trigger":""},{"name":"country","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"","code":"jQuery('html').attr('lang').split('-')[1] === 'CA' ? 'Canada' : jQuery('html').attr('lang').split('-')[1] === 'DE' ? 'Germany' : jQuery('html').attr('lang').split('-')[1] === 'FR' ? 'France' : jQuery('html').attr('lang').split('-')[1] === 'CH' ? 'Switzerland' : jQuery('html').attr('lang').split('-')[1] === 'AT' ? 'Austria' : jQuery('html').attr('lang').split('-')[1] === 'GB' ? 'United Kingdom' : jQuery('html').attr('lang').split('-')[1] === 'US' ? 'United States' : '';","trigger":""},{"name":"page_type","polling":"vars","persist":"no","page_types":[],"testmode":false,"default":"false","code":"bouncex.website.pts;","trigger":""},{"name":"ibx_test","polling":"none","persist":"permanent","page_types":[],"testmode":true,"default":"false","code":"window.location.href.indexOf('ibx_test') > -1 || null;","trigger":""},{"name":"prod_category","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"(function() {\n var item = window.dataLayer.filter(function(dl) {return dl.category || dl.category_id});\n return item[0].category || item[0].category_id;\n})();","trigger":""},{"name":"prod_image","polling":"none","persist":"no","page_types":[],"testmode":true,"default":"false","code":"(function () {\n var imgTag = jQuery('div[class*=\"Gallery__slides\"] > :first-child > img');\n var imgSrc = imgTag.attr('src');\n\n if (imgTag && imgSrc) {\n var baseImg = imgSrc.split('?')[0] + '?';\n var paramsAndVals = [];\n var allowedQsParams = ['auto', 'q', 'w'];\n allowedQsParams.forEach(function(p) {\n \tvar paramVal = bouncex.utils.getParam(p, imgSrc);\n \tif (paramVal) {\n \t\tparamsAndVals.push(p + '=' + paramVal);\n \t}\n });\n return baseImg + paramsAndVals.join('&');\n }\n return '';\n})();\n","trigger":""},{"name":"cart","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":""},{"name":"identified_logged_in","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":""},{"name":"video_playing","polling":"all","persist":"no","page_types":[],"testmode":true,"default":"false","code":"jQuery('.wistia_popover_overlay').is(':visible')","trigger":""},{"name":"ibx_prod_category","polling":"vars","persist":"no","page_types":[],"testmode":false,"default":"false","code":"(function(){\n if (window.location.href.indexOf('mattresses') > -1 || window.location.href.indexOf('best-selling-bundle') > -1 || bouncex.utils.url.allowParams().indexOf('mattresses') > -1) {\n return 'mattress';\n } else {\n return 'notmattress';\n }\n})();","trigger":""},{"name":"is_logged_in_replen","polling":"none","persist":"no","page_types":[],"testmode":true,"default":"false","code":"(function(){\n if (bouncex.utils.getParam('bx_user_login')) {\n return true;\n }\n return false;\n})();","trigger":""},{"name":"ibx_site_locale","polling":"vars","persist":"no","page_types":[],"testmode":true,"default":"false","code":"(function() {\n function getLocaleFlag() {\n return jQuery('span[class*=HeaderLocaleIcon__icon]').attr('data-icon') || jQuery('.Icon__icon___34QmX.Footer__locale-select-icon___1M8B-').attr('data-icon');\n }\n\n function getLocaleFromWindowVar() {\n return bouncex.utils.getNestedProp('window.__STORE__.i18n.locale');\n }\n var splitPaths = window.location.pathname.split('/');\n var localeFlag = getLocaleFlag();\n var localeWindowVar = getLocaleFromWindowVar();\n var engCheckout = (splitPaths.length > 1 && splitPaths[1] === 'checkout');\n if (localeFlag === 'flag-france' && localeWindowVar === 'fr-FR') {\n return 'fr';\n } else if (localeFlag === 'flag-uk' && localeWindowVar === 'en-GB') {\n return 'uk';\n } else if (localeFlag === 'flag-us' && localeWindowVar === 'en-US') {\n return 'usa';\n } else if (!localeFlag && localeWindowVar === 'en-US') {\n return 'usa';\n }\n return null;\n})();","trigger":""},{"name":"ibx_is_sheets_separate","polling":"vars","persist":"no","page_types":[],"testmode":true,"default":"false","code":"(function(){\n\treturn jQuery('section[class*=SheetSeparatePurchaser__item]').length > 0;\n})();\n","trigger":""},{"name":"ibx_product_color","polling":"vars","persist":"no","page_types":[],"testmode":true,"default":"false","code":"(function() {\n\tvar currentColorText = jQuery('div[class*=ColorSelect__container]:visible').find('div[class*=ColorSelect__selected-color]').text();\n\tvar splitColor = currentColorText.split(': ');\n\tif (splitColor.length > 1) {\n\t\tsplitColor = splitColor[1].replace('/', '').toLowerCase();\n\t} else {\n\t splitColor = '';\n\t}\n\treturn bouncex.utils.getParam('color') || splitColor;\n})();","trigger":""},{"name":"ibx_product_id","polling":"vars","persist":"no","page_types":["product"],"testmode":false,"default":"false","code":"(function(){\n return window.bx_selected_product.sku || window.bx_selected_product.name.toLowerCase().replace(/ /g, '-').replace(/[^\\w-]+/g, '');\n var urlToIdRegex = /([^=\\/]*)\\/*$/;\n var buyUrlToIdRegex = /([a-z-]+)\\/buy[\\/|-]/;\n var engUrl = prodTypeUrl(window.location.href) ? bouncex.utils.url.allowParams(['productType']) : bouncex.utils.url.allowParams();\n var baseId = engUrl && getIdFromUrl(engUrl);\n \n if (window.location.href.indexOf('casper-wave/buy/v2/') > -1 ) {\n return 'casper-wave';\n }\n if (window.location.href.indexOf('casper/buy/v2/') > -1 ) {\n return 'casper';\n }\n \n if (window.location.href.includes('/bedding/sheets')) {\n var material = jQuery('#page-header h1').length > 0 ? jQuery('#page-header h1:first').text().toLowerCase().replace(/[^(\\w\\s-)]+/g, '').split(' ').join('-') : '';\n baseId = bouncex.utils.url.getParam('productType') || 'set';\n return material + '-' + baseId;\n }\n \n if (bouncex.vars.ibx_is_sheets_separate) {\n baseId = jQuery('div[class*=SheetSeparatePurchaser__options]:visible').siblings('header[class*=SheetSeparatePurchaser__header]').find('h2').text().toLowerCase().replace(/ /g, '-');\n }\n if (bouncex.vars.ibx_product_color && !prodTypeUrl(engUrl)) {\n return baseId + '-' + bouncex.vars.ibx_product_color;\n }\n \n return baseId;\n \n function getIdFromUrl(url){\n url = url.replace('/v2/','').replace('-v2','').replace('/v3/','').replace('-v3','').replace('/v1','').replace('/m/','');\n url = url.indexOf('productType') === -1 ? url.split('?')[0] : url;\n if (typeof url != 'string'){ return false; }\n var idMatch = url.indexOf('/buy') > -1 && !url.includes('productType') ? url.match(buyUrlToIdRegex) : url.match(urlToIdRegex);\n if (idMatch && idMatch[1]){\n return idMatch[1];\n }\n }\n \n function prodTypeUrl(url){\n return url.indexOf('/buy/?productType') >-1;\n }\n})();","trigger":""},{"name":"ibx_item_url","polling":"vars","persist":"no","page_types":[],"testmode":true,"default":"false","code":"(function(){\n var url = jQuery('link[rel=canonical]').attr('href') || bouncex.utils.getOrigin() + window.location.pathname,\n material = bouncex.utils.getParam(\"material\");\n \n if (!material || (url && url.indexOf(\"material=\") > -1)) {\n return url;\n } else if (url && material) {\n return url + \"?material=\" + material;\n }\n return \"\";\n})();\n","trigger":""},{"name":"ibx_page_type","polling":"vars","persist":"no","page_types":[],"testmode":false,"default":"false","code":"(function () {\n return bouncex.website.pts;\n var pathName = window.location.pathname;\n var url = window.location.href;\n var productPage;\n\n if (typeof window.jQuery === 'undefined') {\n productPage = pathName.match('(/nightstand|/buy/|/platform-bed/)');\n } else {\n productPage = jQuery('div[class*=Purchaser],section[class*=PDP]').length > 0 || jQuery('title').text().indexOf('Nap Pillow') > -1 || jQuery('title').text().indexOf('Bed Frame') > -1 || pathName.match('(/nightstand|/buy/|/platform-bed/)');\n }\n\n var homePaths = ['/ca/en/','/','/ca/fr/','/de/de/','/fr/fr/','/at/de/','/ch/de/','/ch/fr/','/uk/en/'];\n var categoryPaths = ['/ca/en/mattresses/', '/mattresses/', '/ca/en/products/', '/products/', '/ca/fr/matelas/', '/ca/fr/produits/', '/de/de/matratzen/', '/fr/fr/matelas/', '/at/de/matratzen/', '/ch/de/matratzen/', '/ch/fr/matelas/', '/uk/en/mattresses/', '/adjustable-bed-frames/', '/mattresses-p/'];\n var blogPage = url.indexOf('blog.') > -1;\n var faqsPage = url.indexOf('faqs') > -1;\n var homePage = homePaths.indexOf(pathName) > -1;\n var categoryPage = categoryPaths.indexOf(pathName) > -1 || (pathName.indexOf('/bedding/') > -1 && pathName.indexOf('/buy/') === -1) || (pathName.indexOf('/bed-frames/') > -1 && pathName.indexOf('/buy/') === -1) || (pathName.indexOf('/gifts/') > -1 && pathName.indexOf('/buy/') === -1) || pathName.indexOf('bundles/v1') > -1 && jQuery('div[class*=\"FilterGridCard\"]').length > 0;\n var cartPage = bouncex.utils.getNestedProp('window.__STORE__.order.currentCheckoutStepe') !== undefined;\n var otherNotTrackedPage = window.location.pathname.indexOf('/reviews/') > -1 || window.location.pathname.indexOf('/avis/') > -1 || window.location.pathname.indexOf('/account') > -1 || window.location.pathname.indexOf('/returns') > -1 || window.location.pathname.indexOf('/mattress-size-comparison-guide') > -1|| window.location.pathname.indexOf('/login') > -1;\n\n if (productPage && !faqsPage && !blogPage && !homePage && !categoryPage && !cartPage && !otherNotTrackedPage) {\n return 'product';\n } else if (blogPage) {\n return 'blog';\n } else if (homePage) {\n return 'home';\n } else if (categoryPage) {\n return 'category';\n } else if (otherNotTrackedPage){\n return false;\n } else if (cartPage){\n return 'cart';\n }\n})();","trigger":""},{"name":"casper_value_supress_promo","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"window.localStorage.getItem('suppress-promo') ? true : false;","trigger":""},{"name":"zip_code_tracked","polling":"none","persist":"no","page_types":[],"testmode":true,"default":"false","code":"window.fastlyGeo.postal_code;","trigger":""},{"name":"session_vid","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"/* needed for session_count */\nnull;","trigger":""},{"name":"session_count","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"0","code":"null;","trigger":""},{"name":"survey_q1","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"survey_q2","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"survey_q3","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"using_edge_browser","polling":"none","persist":"no","page_types":[],"testmode":true,"default":"false","code":"bouncex.browser.edge !== false;","trigger":"pageload"},{"name":"disable_iframe_messaging","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"XD.receiveMessage = function() {return false;};","trigger":"pageload"},{"name":"curr_url","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"encodeURIComponent(window.location.href);","trigger":"pageload"},{"name":"promo_code_applied","polling":"none","persist":"visit","page_types":[],"testmode":true,"default":"false","code":"(function(){\n\tvar data = window.dataLayer;\n\n\tif (data) {\n for (var i=0; i 0) {\n\t\t\t\treturn true;\n\t\t\t}\n }\n }\n return null;\n})();","trigger":"pageload"},{"name":"native_scroll_to_top_button","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"bcxeme","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"markdown_price","polling":"all","persist":"no","page_types":["product"],"testmode":true,"default":"false","code":"(function() {\n var prices = jQuery(\"[class*='SelectInputValueLabel']\").text().replace(/[^0-9.$]/g,'').split('$');\n return prices.length >= 3 ? prices[1] : false;\n})();","trigger":"pageload"},{"name":"atc_clickable","polling":"all","persist":"no","page_types":["product"],"testmode":false,"default":"false","code":"jQuery('.add-to-cart').attr('disabled') !== 'disabled';","trigger":"pageload"},{"name":"coupon","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"bouncex.utils.getParam('promo_code') || bouncex.utils.getParam('promo_code') || null;","trigger":"pageload"},{"name":"submitdisclaimer","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null","trigger":"pageload"},{"name":"ctrl_ecap_headline","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null","trigger":"pageload"},{"name":"promo_couponcode","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null","trigger":"pageload"},{"name":"ctrl_psubmit_subheadline","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null","trigger":"pageload"},{"name":"ctrl_id_promo_headline","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null","trigger":"pageload"},{"name":"ctrl_id_promo_subheadline","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null","trigger":"pageload"},{"name":"ctrl_learnmore_headline","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null","trigger":"pageload"},{"name":"ctrl_learnmore_subheadline","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null","trigger":"pageload"},{"name":"promo_id_rtb","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null","trigger":"pageload"},{"name":"promo_ecap_rtb","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null","trigger":"pageload"},{"name":"promo_psubmit_rtb","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null","trigger":"pageload"},{"name":"ctrl_id_prehead","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"shipping_message","polling":"vars","persist":"no","page_types":[],"testmode":false,"default":"false","code":"jQuery('#shipping-message').text();","trigger":"pageload"},{"name":"disclaimer_ad","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"sms_postsubmit_subhead","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"rtbmessage2copy","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"rtbmessage2cta","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"rtbmessage2url","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"existing_sub","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"native_overlay_active","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"(function(){\n var anyVisible = false;\n jQuery('[class*=\"DefaultOverlay\"]').each(function(){\n if(jQuery(this).css('visibility') === \"visible\"){\n anyVisible = true\n }\n })\n return anyVisible\n})()","trigger":"pageload"},{"name":"disclaimer_new","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"promo_subhead2","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"ecap_prehead","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"sms_exit_header","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"sms_exit_prehead","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"post_submit_url","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"post_submit_disclaimer","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"sms_entrancesubhead","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"exit_ecap_subhead","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"ecap_prehead2","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"sms_prehead","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"sms_subhead2","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"sms_subhead","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"postsubmitsubhead","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"cornertabcta","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"inlinezonesubhead","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"inlinezoneheader","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"is_mattress","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"bouncex.utils.url.allowParams().indexOf('mattresses') > -1;","trigger":"pageload"},{"name":"promo_echo_rtb_copy2","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"promo_echo_rtb_url2","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"new_test_rtv","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"ibx_cart_qty","polling":"all","persist":"visit","page_types":[],"testmode":true,"default":"false","code":"(function() {\n if (window.location.href.indexOf('/checkout') > -1) {\n return Number(jQuery('[class^=CartCount]').text().replace(/[^0-9]/g, ''));\n } else {\n if(bouncex.state.mobile) {\n return Number(jQuery('button[aria-label*=\"Cart\"] span').text().replace(/[^0-9]/g, '')) || 0;\n } else {\n var $itemQuantities = jQuery('output[class*=\"QuantityCount\"]');\n var totalQty = 0;\n \n for(var i = 0; i < $itemQuantities.length; i ++){\n var ItemQty = Number($itemQuantities.eq(i).text().replace(/[^0-9]/g, ''));\n totalQty += ItemQty;\n }\n return totalQty;\n }\n }\n})(); ","trigger":"pageload"},{"name":"pdp_material","polling":"all","persist":"no","page_types":["product"],"testmode":true,"default":"","code":"(function() {\n if (window.location.href.indexOf(\"mattresses\") > -1) {\n var material = bouncex.utils.getParam(\"material\");\n if (material) return material;\n \n var baseId = bouncex.utils.url.allowParams().split(\"mattresses/\").pop().split(\"/\")[0],\n defaults = {\n\t\t'casper-nova' : 'hybrid',\n\t\t'casper-wave' : 'hybrid',\n\t\t'casper-original' : 'foam',\n\t\t'casper-element' : 'foam',\n\t };\n\t \n\t if (defaults[baseId]) return defaults[baseId];\n }\n return \"\";\n})();\n","trigger":"pageload"},{"name":"pillow_quiz_step_two","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"jQuery('div[data-qa=\"render-result\"]:visible').length > 0;","trigger":"pageload"},{"name":"ctrl_learnmore_subheadline2","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"promo_subhead3","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"thankyou_subhead2","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"msbd_prod_name","polling":"all","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"(function() {\n var triggerCampaigns = [1447841,1452276,1452277,1447679,1451315,1452279,1452280,1452199,1452200,1452202,1452203];\n var currentCampaign;\n \n for (var i = 0; i < triggerCampaigns.length; i++) {\n currentCampaign = triggerCampaigns[i];\n if ( bouncex.utils.getNestedProp('bouncex.campaigns[' + currentCampaign + '].ad_shown') ) {\n return bx_selected_product.name || '';\n }\n }\n return null;\n})();","trigger":"pageload"},{"name":"msbd_prod_size","polling":"all","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"(function() {\n var triggerCampaigns = [1447841,1452276,1452277,1447679,1451315,1452279,1452280,1452199,1452200,1452202,1452203];\n var currentCampaign;\n \n for (var i = 0; i < triggerCampaigns.length; i++) {\n currentCampaign = triggerCampaigns[i];\n if ( bouncex.utils.getNestedProp('bouncex.campaigns[' + currentCampaign + '].ad_shown') ) {\n return window.bx_selected_product && window.bx_selected_product.size;\n }\n }\n return null;\n})();","trigger":"pageload"},{"name":"show_results_campaign","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null; ","trigger":"pageload"},{"name":"test_group_a","polling":"none","persist":"visit","page_types":[],"testmode":true,"default":"false","code":"null;","trigger":"pageload"},{"name":"submitted_no_deployment","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"novahybridqv_prod_size","polling":"all","persist":"no","page_types":[],"testmode":true,"default":"false","code":"jQuery('div[aria-expanded=\"true\"]:contains(\"Nova Hybrid\") form span[class*=\"SelectInputValueLabe\"]').is(':visible') && jQuery('div[aria-expanded=\"true\"]:contains(\"Nova Hybrid\") form span[class*=\"SelectInputValueLabe\"]').text().replace(/[^a-zA-Z]/g,'').toUpperCase();","trigger":"pageload"},{"name":"hybrid_offer","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"(function(){\n var product_sku = bouncex.utils.getNestedProp('window.bx_selected_product.sku', '').replace(/[0-9]/g, '');\n\n switch (product_sku) {\n case 'NOVAHYBTWIN':\n return 250;\n break;\n case 'NOVAHYBTWINXL':\n return 300;\n break;\n case 'NOVAHYBFULL':\n return 350;\n break;\n case 'NOVAHYBQUEEN':\n case 'NOVAHYBKING':\n case 'NOVAHYBCALKING':\n return 500\n break;\n default:\n return false;\n break;\n }\n})();","trigger":"pageload"},{"name":"exit_prehead","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"exit_header","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"show_timer","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"submitted_to_quiz","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"product_sku","polling":"vars","persist":"no","page_types":["category","product"],"testmode":false,"default":"false","code":"jQuery('div[data-qa = \"quick-view-purchaser\"]').length > 0 \n || jQuery('[aria-expanded= \"true\"]').length > 0 \n || bouncex.website.pts === 'product' ? \n bouncex.utils.getNestedProp('window.bx_selected_product.sku') \n || bouncex.utils.getNestedProp('window.bx_product.name')\n : false;","trigger":"pageload"},{"name":"ecap_header","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"qv_id","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"(jQuery('.modal-content .full-pdp-link').attr('href') || '').replace(/.html$/g, '').split('/').pop();","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":{"et_rid":"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":"// bouncex.log('test')","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 Casper mktg txts (like cart reminders) to this #, per terms.","eventSharing":true,"shqId":"jfymmkxjif-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":"270804997","ga4_measurement_id":"G-SY292B36VT"} ; 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":"0109586821763416266dd874f087ef69","creativesBaseStyles":"a53944a2","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_005dce26d317b1a438255f8f3d35049d.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); } 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(); }})();