Mattress Selector Quiz - Find A Perfect Mattress for You (2024)

Meet your perfect mattress.

Every mattress is designed by the sleep experts at Sleap Authority Labs to optimize your sleep. Find your perfect match with a few easy questions.

Will take just 60 seconds

' ); const quizSelector = '.quiz-step[data-step="' + index + '"]'; $(quizSelector).append( '

' + question.title + "

" ); $(quizSelector).append( '

' + question.description ? question.description : "" + "

" ); $(quizSelector).append('

'); question.answers.map((answer, answerIndex) => { const inputId = "q-" + index + "-a-" + answerIndex; const variantId = "answer" + index + answerIndex; $(quizSelector + " > .quiz__variants").append( '' ); $(quizSelector + " > .quiz__variants").append( '' ); if (answer.description) { $(quizSelector + " > .quiz__variants > #" + variantId).append( '' + answer.description + "" ); } if (answer.icon) { $(quizSelector + " > .quiz__variants > #" + variantId).append( 'Mattress Selector Quiz - Find A Perfect Mattress for You (11)' ); } $(quizSelector + " > .quiz__variants > #" + variantId).append( "" + answer.title + "" ); }); }); } function updateProgress() { $(".progerss-bar-inner").text( (curStep + 1).toString() + " of " + data.questions.length ); const widthStep = 100 / data.questions.length; const newWidth = widthStep * (curStep + 1); $(".progerss-bar-inner").css("width", newWidth + "%"); } function showNextStep() { const question = data.questions[curStep]; $('.quiz-step[data-step="' + (curStep - 1).toString() + '"]').removeClass( "quiz-step_active" ); $('.quiz-step[data-step="' + (curStep + 1).toString() + '"]').removeClass( "quiz-step_active" ); $('.quiz-step[data-step="' + curStep + '"]').addClass("quiz-step_active"); updateProgress(); // Question impression window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event: "dynamic_yield_quiz", type: "quiz_impression", title: question ? question.title : "Queston is undefined", sub_title: curStep, }); } // Function will show blured results & email dialog function finalizeQuiz() { $(".js-back").hide(); $(".progerss-bar").hide(); $( '.quiz-step[data-step="' + (data.questions.length - 1).toString() + '"]' ).removeClass("quiz-step_active"); $(".js-quiz-submit").hide(); $(".loading").show(); setTimeout(function () { $(".loading").hide(); $('.quiz-step[data-step="email"]').addClass("quiz-step_active"); // Email input impression window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event: "dynamic_yield_quiz", type: "quiz_impression", title, sub_title: "email_impression", }); }, 3000); const answerKey = results .map((r, index) => (data.questions[index].skip ? "*" : r)) .join("_"); finalResult = data.results.find((r) => r.answers.includes(answerKey)); $(".result__name").text(finalResult.title); $(".result__media img").attr("src", finalResult.image); $(".result__controls a").attr("href", finalResult.link); $(".result__controls a").text(finalResult.buttonText); $(".result__descriptions").text("“" + finalResult.review.description + "”"); $(".result__verified span").text(finalResult.review.author); $(".result__review-title").text(finalResult.review.title); } // Checks whether submit button should be disabled function btnDisabled() { const result = $('input[name="q-' + curStep + '"]:checked').val(); if (Boolean(result)) { $(".js-quiz-submit").prop("disabled", false); } else { $(".js-quiz-submit").prop("disabled", true); } } setDataDom(); // Initial impression window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event: "dynamic_yield_quiz", type: "impression", title, sub_title: "mainpage_impression", }); $(".js-intro").click(function (e) { e.preventDefault(); // Procceed to first question window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event: "dynamic_yield_quiz", type: "click", title, sub_title: btnStartText, }); quizStarted = true; $(".intro").hide(); $(".quiz").css("display", "flex"); $(".progerss-bar").show(); $(".btn__back").show(); $(".js-back").hide(); showNextStep(); btnDisabled(); }); $('input[type="checkbox"], input[type="radio"]').change(function () { btnDisabled(); }); $(".js-back").click(function (e) { e.preventDefault(); curStep = curStep - 1; showNextStep(); if (curStep === 0) { $(".js-back").hide(); } const answerIndex = results.pop(); const inputId = "q-" + curStep + "-a-" + answerIndex; $('input[id="' + inputId + '"]').prop("checked", true); btnDisabled(); }); $(".js-quiz-submit").click(function () { // Save answer const result = $('input[name="q-' + curStep + '"]:checked').val(); const answer = data.questions[curStep]; results.push(result); // Reset answer for the next question $('input[name="q"]').prop("checked", false); curStep = curStep + 1; // Show back button after the first question if (curStep > 0) { $(".js-back").show(); } btnDisabled(); if (curStep < data.questions.length) { // Capture Quiz Answer const question = data.questions[curStep - 1]; window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event: "dynamic_yield_quiz", type: "quiz_click", title: question ? question.title : "Question is not defined", sub_title: question?.answers[result]?.title, }); showNextStep(); } else { finalizeQuiz(); } }); $(".js-capture").click(function (e) { e.preventDefault(); var email = $(this).siblings('input[type="email"]').val().trim(); if (email.length > 0) { var email1 = CryptoJS.SHA1(email.toString().toLowerCase()); var email5 = CryptoJS.MD5(email.toString().toLowerCase()); const utms = window.location.search ? window.location.search + `&dg=${email1}` : `?dg=${email1}`; $(".result__controls a").attr("href", finalResult.link + utms); window.dataLayer.push({event: "finished_quiz"}); window.dataLayer.push({ event: "product_impression", products: [{ product_name: finalResult.title, upsell_button_text: "Shop Nectar Now", }], }); window.dataLayer.push({ event: "created_lead", email, hashedEmailMD5: email5.toString(), hashedEmailSHA1: email1.toString(), signUpType: "lead", widget: "quiz_email_submitted", }); $(".quiz-step").removeClass("quiz-step_active"); $(".footer").hide(); $('.quiz-step[data-step="result"]').addClass("quiz-step_active"); setTimeout(() => { // Product result impression window.dataLayer.push({ event: "dynamic_yield_quiz", type: "quiz_impression", title: finalResult.title, sub_title: "product_impression", href: finalResult.link + utms, image_source: finalResult.image, tags: { email }, }); }, 500) } }); $("#shop_CTA").click(function () { window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event: "dynamic_yield_quiz", type: "quiz_click", title, sub_title: finalResult.buttonText, }); }); $("#cEmail").keyup(function () { var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if ($(this).val().length > 0 && filter.test($(this).val().trim())) { $(".js-capture").prop("disabled", false); } else { $(".js-capture").prop("disabled", true); } }); $(".quiz-close-btn").click(function () { const question = data.questions[curStep - 1]; window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event: "dynamic_yield_quiz", type: "close", title, sub_title: question ? question.title : btnStartText, }); // FIXME: CLOSE OVERLAY HERE or REMOVE COMPLETELY });});

Mattress Selector Quiz - Find A Perfect Mattress for You (2024)
Top Articles
Www Washoeschools Net Infinite Campus
Cracking Tunes: 10 Of The Greatest Musical Easter Eggs Hidden In Albums
Tyler Sis 360 Louisiana Mo
Overton Funeral Home Waterloo Iowa
Research Tome Neltharus
1970 Chevrolet Chevelle SS - Skyway Classics
Algebra Calculator Mathway
Computer Repair Tryon North Carolina
Oppenheimer & Co. Inc. Buys Shares of 798,472 AST SpaceMobile, Inc. (NASDAQ:ASTS)
Milk And Mocha GIFs | GIFDB.com
Tokioof
Ella Eats
Hood County Buy Sell And Trade
Tcu Jaggaer
Are They Not Beautiful Wowhead
Craighead County Sheriff's Department
Craigslist In Visalia California
Booknet.com Contract Marriage 2
Officialmilarosee
Conan Exiles: Nahrung und Trinken finden und herstellen
Is The Yankees Game Postponed Tonight
Outlet For The Thames Crossword
Ruse For Crashing Family Reunions Crossword
Mc Donald's Bruck - Fast-Food-Restaurant
Free Personals Like Craigslist Nh
Ceramic tiles vs vitrified tiles: Which one should you choose? - Building And Interiors
Regal Amc Near Me
Sherburne Refuge Bulldogs
Cona Physical Therapy
Bayard Martensen
Remnants of Filth: Yuwu (Novel) Vol. 4
Log in to your MyChart account
Mia Malkova Bio, Net Worth, Age & More - Magzica
Metra Union Pacific West Schedule
CARLY Thank You Notes
Back to the Future Part III | Rotten Tomatoes
Devotion Showtimes Near Mjr Universal Grand Cinema 16
Polk County Released Inmates
Soulstone Survivors Igg
Instafeet Login
888-822-3743
Disassemble Malm Bed Frame
Walgreens On Secor And Alexis
All Weapon Perks and Status Effects - Conan Exiles | Game...
Nimbleaf Evolution
Aurora Southeast Recreation Center And Fieldhouse Reviews
Craigslist Sparta Nj
Abigail Cordova Murder
Coleman Funeral Home Olive Branch Ms Obituaries
Joe Bartosik Ms
Zom 100 Mbti
Ihop Deliver
Latest Posts
Article information

Author: Gov. Deandrea McKenzie

Last Updated:

Views: 5848

Rating: 4.6 / 5 (46 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Gov. Deandrea McKenzie

Birthday: 2001-01-17

Address: Suite 769 2454 Marsha Coves, Debbieton, MS 95002

Phone: +813077629322

Job: Real-Estate Executive

Hobby: Archery, Metal detecting, Kitesurfing, Genealogy, Kitesurfing, Calligraphy, Roller skating

Introduction: My name is Gov. Deandrea McKenzie, I am a spotless, clean, glamorous, sparkling, adventurous, nice, brainy person who loves writing and wants to share my knowledge and understanding with you.