");vwo_$('head').append(_vwo_sel);return vwo_$('head')[0] && vwo_$('head')[0].lastChild;})("HEAD")}}, R_722219_759_1_2_0:{ fn:function(log,nonce=''){return (function(x) {
if(!vwo_$.fn.vwoRevertHtml){
return;
};
var ctx=vwo_$(x),el;
/*vwo_debug log("Revert","content",""); vwo_debug*/;
el=vwo_$('[vwo-element-id="1733126851444"]');
el.revertContentOp().remove();})("HEAD")}}, C_722219_759_1_2_1:{ fn:function(log,nonce=''){return (function(x) {})(".leo-col-6")}}, R_722219_759_1_2_1:{ fn:function(log,nonce=''){return (function(x) {
if(!vwo_$.fn.vwoRevertHtml){
return;
};
})(".leo-col-6")}}, C_722219_1027_1_2_0:{ fn:function(){return (function(x) { try{
var _vwo_sel = vwo_$("");
!vwo_$("head").find("#1739333374834").length && vwo_$('head').append(_vwo_sel);
// Start variation JS
void (function loadVariation(timeInFuture) {
// Main Test object
const test = {
// Some test specific global letiables
id: "EXP-10-V1",
// Test init
init: function () {
// Add a test specific classname to the body element
document.body.classList.add(test.id);
// Below function calls order is important
test.mainJS();
},
// Main JS
mainJS: function () {
/* ---- LOGO ---- */
const quizLogo = `
`;
const crossIcon = `
`;
const newCrossIcon = `
`;
/* ---- DATA ---- */
// quiz data
const collections = [
{
quizName: "Healthy heart, Happy life - Quiz 1",
quizNumber: "quiz 1",
className: "healthy-heart-quiz-one",
image: "https://www.greateasternlife.com/content/dam/corp-site/great-eastern/sg/gels-dme-rewards/health-programme/heart-health/gels-dme-rewards-heart-health-quiz-1.jpg",
coverImage: "https://www.greateasternlife.com/content/dam/corp-site/great-eastern/sg/gels-dme-rewards/health-programme/heart-health/gels-dme-rewards-heart-health-quiz-1.jpg",
url: "https://www.greateasternlife.com/sg/en/personal-insurance/lifepedia/healthy-heart-happy-life/heart-health-and-you-quiz-1.html",
header: "Healthy heart, Happy life - Quiz 1",
quizDate: "Jan 06, 2025",
promoCopy: "Answer 3 simple questions and win an exclusive prize from Eu Yan Sang worth $15!",
questionOne: [
"1. One should see a ____________ if he/she is experiencing chest pain and shortness of breath as it could be a possible sign of heart disease and heart failure.",
["Cardiologist", "Dentist", "Gastroenterologist"]
],
questionTwo: [
"2. These chronic conditions – diabetes, high blood pressure, and high ___________ (also known as the “Three Highs”), are usually asymptomatic and may be unnoticed. It has been observed that patients are also developing these conditions at an increasingly earlier age.",
["Blood count", "Cholesterol", "Fever"]
]
},
{
quizName: "Healthy heart, Happy life - Quiz 2",
quizNumber: "quiz 2",
className: "healthy-heart-quiz-two",
image: "https://www.greateasternlife.com/content/dam/corp-site/great-eastern/sg/gels-dme-rewards/health-programme/heart-health/gels-dme-rewards-heart-health-quiz-2.jpg",
coverImage: "https://www.greateasternlife.com/content/dam/corp-site/great-eastern/sg/gels-dme-rewards/health-programme/heart-health/gels-dme-rewards-heart-health-quiz-2-thumbnail.jpg",
url: "https://www.greateasternlife.com/sg/en/personal-insurance/lifepedia/healthy-heart-happy-life/huat-the-heart-wants-quiz-2.html",
header: "Healthy heart, Happy life - Quiz 2",
quizDate: "Jan 20, 2025",
promoCopy: "Answer 3 simple questions and win an exclusive prize from Fitness First worth $60!",
questionOne: [
"1. Even though pineapple tarts are everywhere for the festive season, I should limit my intake to ____ pieces because it is equivalent to 7 teaspoons of sugar, which is within our recommended daily intake of 10 teaspoons.",
["2", "4", "6"]
],
questionTwo: [
"2. Nian gao, nian gao, in the box… which is the most calorie-loaded of them all?",
["Steamed", "Fried"]
]
},
];
// quiz image links
const imageUrls = [
"https://www.greateasternlife.com/content/dam/corp-site/great-eastern/sg/gels-dme-rewards/health-programme/heart-health/gels-dme-rewards-heart-health-quiz-1.jpg",
"https://www.greateasternlife.com/content/dam/corp-site/great-eastern/sg/gels-dme-rewards/health-programme/heart-health/gels-dme-rewards-heart-health-quiz-2.jpg",
"https://www.greateasternlife.com/content/dam/corp-site/great-eastern/sg/gels-dme-rewards/health-programme/heart-health/gels-dme-rewards-heart-health-quiz-2-thumbnail.jpg"
];
// array of quiz pages
const quizPages = [
'/sg/en/personal-insurance/lifepedia/healthy-heart-happy-life/heart-health-and-you-quiz-1.html',
'/sg/en/personal-insurance/lifepedia/healthy-heart-happy-life/huat-the-heart-wants-quiz-2.html',
];
// array of pages to show quiz logo
const variationPages = [
'/sg/en/personal-insurance/lifepedia.html',
'/sg/en/personal-insurance/lifepedia/medical-coverage.html',
'/sg/en/personal-insurance/lifepedia/life-protection.html',
'/sg/en/personal-insurance/lifepedia/lifestyle-protection.html',
'/sg/en/personal-insurance/lifepedia/savings-and-investment.html',
'/sg/en/personal-insurance/lifepedia/retirement-income.html',
'/sg/en/personal-insurance/lifepedia/career.html',
'/sg/en/personal-insurance/rewards-and-promotions.html'
];
/* ---- Utility Functions ---- */
// // image preload function
function preloadImages(imageUrls) {
imageUrls.forEach(url => {
const img = new Image();
img.src = url;
});
}
// function to validate and process quiz data
function validationAndProcessQuizData(quizUrl, quizNumber) {
// Cache form elements
const formSection = document.querySelector('.form-section');
const questionOneInput = document.querySelectorAll('.form-group-one .radio-item input:checked')[0];
const questionTwoInput = document.querySelectorAll('.form-group-two .radio-item input:checked')[0];
// Validation: Check if questions are answered
const isEmpty = !(questionOneInput?.value) || !(questionTwoInput?.value.trim());
const existingError = formSection.querySelector('.error-copy');
const errorHtml = `
Please complete the questions.
`
if (isEmpty) {
// Add error message if it doesn't exist
if (!existingError) {
formSection.insertAdjacentHTML('beforeend', errorHtml);
formSection.classList.add('form-error');
return; // Exit the function
}
return;
}
// Remove error if validation passes
if (existingError) {
existingError.remove();
}
formSection.classList.remove('form-error');
// Prepare quiz data
const quizData = [
quizUrl.trim(),
questionOneInput.value.trim(),
questionTwoInput.value.trim(),
];
// Store the data in session storage
sessionStorage.setItem('quizData', JSON.stringify(quizData));
// step 3 - continue CTA click
let quizName = quizNumber.toLowerCase();
let eventLabel = `[vwo_ce_rtg] rewards quiz - healthy heart - step 3 - continue - ${quizName} - static`;
let eventJourneyCTA = `vworq-hh-3-${quizName}-static`;
gaEventTrigger('click', eventLabel, eventJourneyCTA);
// Redirect to the quiz URL
window.location.href = quizUrl;
}
// function to trigger GA events
function gaEventTrigger(eventAction, eventLabel, eventJourneyCTA = '') {
dataLayer.push({
event: "vwoEvent",
eventDetails: {
category: "[vwo] sticky icon",
action: eventAction,
label: eventLabel
},
contentSubcategory: "healthy heart quiz",
...(eventJourneyCTA ? { journeyCta: eventJourneyCTA } : {})
});
};
// fuction to detect touch device
const isTouchDevice = () => {
return (
'ontouchstart' in window || // Check for touch events
navigator.maxTouchPoints > 0 || // Check for touch points
navigator.msMaxTouchPoints > 0 // Microsoft-specific touch points
);
};
/* ---- HTML Templates Markup and Functions ---- */
// create Quiz cards markup
const createQuizCard = (className, coverImage, header, quizDate) => {
return (`
`;
// function to create inner content for modal level two
let modalTwoInnerContent = (className, title, promoCopy) => (`
${title}
${promoCopy}
Start now
`);
//function to generate radio buttons
function generateRadioButtons(options, groupName) {
// Helper function to generate a single radio item
const createRadioItem = (option, index) => {
const id = `${groupName}-option-${index + 1}`; // Unique ID for each option
return `
`;
};
// Generate all radio items
const radioItems = options.map((option, index) => createRadioItem(option, index)).join("");
// Wrap the radio items in the section structure
return `
${radioItems}
`;
}
// function to create inner content for modal level two
let modalThreeInnerContent = (className, questionOne, questionTwo) => (`
`);
// function to create markup for modals on level two and three
let quizModalfn = (className, quizName, image, modalInnerHtml, modalClassNameOne, modalClassNametwo) => (`
${quizCrossButton}
${quizCrossButton}
${modalInnerHtml}
`);
// markup for quiz modal level one
let quizModalLV1 = `
${quizCrossButton}
Take our simple quizzes and win instant rewards today!
Take part in our simple quizzes and win instant rewards today!
${QuizCards}
`;
// function to create the initial modal markup
let modalMarkup = () => (`
${quizModalLV1}
`);
/* ---- DOM Manipulation ---- */
// current url path
const currentPath = window.location.pathname;
// Dom manipulation for quiz variation
if (variationPages.includes(currentPath)) {
// preload images
preloadImages(imageUrls);
// insert quiz icon
if (document.querySelector('.quiz-icon-container')) return;
document.querySelector('main.container .cmp-container > .aem-Grid').insertAdjacentHTML('beforeend', quizIconHtml);
let eventLabel = '[vwo_ce_rtg] rewards quiz - healthy heart - win prizes - static';
gaEventTrigger('impression', eventLabel);
// insert modal markup
document.querySelectorAll('main.container .cmp-container > .aem-Grid')[0].insertAdjacentHTML('beforeend', modalMarkup())
// click handler function for variation pages
function clickHandler(event) {
const { target } = event;
//console.log('target: ', target);
// Utility: Toggle modal visibility
const toggleModal = (selector, addClass, removeClass) => {
const modal = document.querySelector(selector);
if (modal) {
if (addClass !== null) modal.classList.add(addClass);
if (removeClass !== null) modal.classList.remove(removeClass);
}
};
// Utility: Map class names to modal numbers
const getModalNum = () => {
if (target.closest('.healthy-heart-quiz-one')) return 0;
if (target.closest('.healthy-heart-quiz-two')) return 1;
if (target.closest('.word-search-edition-three')) return 2;
return null; // Default if no match found
};
// Utility: Clear form errors
const clearFormErrors = () => {
document.querySelector('.form-section .error-copy')?.remove();
document.querySelector('.form-section.form-error')?.classList.remove('form-error');
};
// Handle: Quiz icon click (open modal)
if (target.closest('.quiz-icon-container .quiz-icon')) {
toggleModal('.quiz-modal-container', 'modal--visible', 'modal--hidden');
// click on quiz icon
let eventLabel = '[vwo_ce_rtg] rewards quiz - healthy heart - win prizes - static';
let eventJourneyCTA = 'vworq-hh-win prizes-static';
gaEventTrigger('click', eventLabel, eventJourneyCTA);
}
// Handle: Quiz cross icon click (cross icon)
if (target.closest('.quiz-icon-container .cross-icon')) {
document.querySelector('.quiz-icon-container').classList.add('hide-quiz-icon');
// hide quiz icon
let eventLabel = '[vwo_ce_rtg] rewards quiz - healthy heart - win prizes - static';
gaEventTrigger('close', eventLabel);
return;
}
// Handle: Close modal
if (
target.closest('.modal-cross-button .cross-icon') ||
target.classList.contains('modal--visible')
) {
// step 1 modal - close
if (target.closest('.quiz-modal-content.quiz-level-one .modal-cross-button .cross-icon')) {
let eventLabel = `[vwo_ce_rtg] rewards quiz - healthy heart - step 1 - select quiz - static`;
gaEventTrigger('close', eventLabel);
}
// step 2 modal - close
if (target.closest('.quiz-modal-content.quiz-level-two .modal-cross-button .cross-icon')) {
let quizName = document.querySelector('.quiz-modal.quiz-modal-two')?.getAttribute('quiz-name').split('-')[1].toLowerCase().trim();
let eventLabel = `[vwo_ce_rtg] rewards quiz - healthy heart - step 2 - start now - ${quizName} - static`;
gaEventTrigger('close', eventLabel);
}
// step 3 - close
if (target.closest('.quiz-modal-content.quiz-level-three .modal-cross-button .cross-icon')) {
let quizName = document.querySelector('.quiz-modal.quiz-modal-three')?.getAttribute('quiz-name').split('-')[1].toLowerCase().trim();
let eventLabel = `[vwo_ce_rtg] rewards quiz - healthy heart - step 3 - continue - ${quizName} - static`;
gaEventTrigger('close', eventLabel);
}
toggleModal('.quiz-modal-container', 'modal--hidden', 'modal--visible');
document.querySelectorAll('.quiz-modal.quiz-modal-three, .quiz-modal.quiz-modal-two').forEach(modal => modal.remove());
toggleModal('.quiz-modal.quiz-modal-one', null, 'hide-modal'); // Unhide modal one
return;
}
// Handle: Click on modal cards
if (target.closest('.quiz-modal-one .quiz-card')) {
const modalNum = getModalNum();
if (modalNum !== null) {
const { quizName, quizNumber, className, image, promoCopy, details } = collections[modalNum];
const modalTwoInnerHtml = modalTwoInnerContent(className, quizName, promoCopy, details);
const modalTwoMarkup = quizModalfn(className, quizName, image, modalTwoInnerHtml, 'quiz-modal-two', 'quiz-level-two');
document.querySelector('.quiz-modal.quiz-modal-one').insertAdjacentHTML('afterend', modalTwoMarkup);
toggleModal('.quiz-modal.quiz-modal-one', 'hide-modal', null);
// step 1 - popup card click
let quizTitle = quizNumber.toLowerCase();
let eventLabel = `[vwo_ce_rtg] rewards quiz - healthy heart - step 1 - select quiz - ${quizTitle} - static`;
let eventJourneyCTA = `vworq-hh-1-${quizTitle}-static`;
gaEventTrigger('click', eventLabel, eventJourneyCTA);
}
return;
}
// Handle: Click on quiz start button in modal two
if (target.closest('.quiz-modal.quiz-modal-two .quiz-button')) {
const questionModalNum = getModalNum();
if (questionModalNum !== null) {
const { quizName, quizNumber, className, image, questionOne, questionTwo } = collections[questionModalNum];
const modalThreeInnerHtml = modalThreeInnerContent(className, questionOne, questionTwo);
const modalThreeMarkup = quizModalfn(className, quizName, image, modalThreeInnerHtml, 'quiz-modal-three', 'quiz-level-three');
document.querySelector('.quiz-modal.quiz-modal-one').insertAdjacentHTML('afterend', modalThreeMarkup);
toggleModal('.quiz-modal.quiz-modal-two', 'hide-modal', null);
// step 2 - start now CTA click
let quizTitle = quizNumber.toLowerCase();
let eventLabel = `[vwo_ce_rtg] rewards quiz - healthy heart - step 2 - start now - ${quizTitle} - static`;
let eventJourneyCTA = `vworq-hh-2-${quizTitle}-static`;
gaEventTrigger('click', eventLabel, eventJourneyCTA);
}
return;
}
// Handle: Click on quiz button in modal three (final action)
if (target.closest('.quiz-modal.quiz-modal-three .quiz-button')) {
const questionModalNum = getModalNum();
if (questionModalNum !== null) {
const { url, quizNumber } = collections[questionModalNum];
// Validate input and process quiz data
validationAndProcessQuizData(url, quizNumber);
}
return;
}
// Handle: Input focus (clear errors)
if (target.closest('input#form-quiestion-one') || target.closest('input#form-quiestion-two')) {
clearFormErrors();
return;
}
}
// Attach click handler to the document
document.body.addEventListener('click', clickHandler);
function touchStartEventHandler(event) {
const { target } = event;
//console.log('target touch: ', target);
// Utility: Toggle modal visibility
const toggleModal = (selector, addClass, removeClass) => {
const modal = document.querySelector(selector);
if (modal) {
modal.classList.add(addClass);
modal.classList.remove(removeClass);
}
};
// Handle: Close modal
if (
target.closest('.modal-cross-button .cross-icon') ||
target.classList.contains('modal--visible')
) {
// step 1 - close
if (target.closest('.quiz-modal-content.quiz-level-one .modal-cross-button .cross-icon')) {
let eventLabel = `[vwo_ce_rtg] rewards quiz - healthy heart - step 1 - select quiz - static`;
gaEventTrigger('close', eventLabel);
}
// step 2 - close
if (target.closest('.quiz-modal-content.quiz-level-two .modal-cross-button .cross-icon')) {
let quizName = document.querySelector('.quiz-modal.quiz-modal-two')?.getAttribute('quiz-name').split('-')[1].toLowerCase().trim();
let eventLabel = `[vwo_ce_rtg] rewards quiz - healthy heart - step 2 - start now - ${quizName} - static`;
gaEventTrigger('close', eventLabel);
}
// step 3 - close
if (target.closest('.quiz-modal-content.quiz-level-three .modal-cross-button .cross-icon')) {
let quizName = document.querySelector('.quiz-modal.quiz-modal-three')?.getAttribute('quiz-name').split('-')[1].toLowerCase().trim();
let eventLabel = `[vwo_ce_rtg] rewards quiz - healthy heart - step 3 - continue - ${quizName} - static`;
gaEventTrigger('close', eventLabel);
}
toggleModal('.quiz-modal-container', 'modal--hidden', 'modal--visible');
document.querySelectorAll('.quiz-modal.quiz-modal-three, .quiz-modal.quiz-modal-two').forEach(modal => modal.remove());
toggleModal('.quiz-modal.quiz-modal-one', null, 'hide-modal'); // Unhide modal one
return;
}
}
if (isTouchDevice()) {
document.body.addEventListener('touchstart', touchStartEventHandler)
}
}
// Dom manipulation to populate the quiz modal
if (quizPages.includes(currentPath)) {
// Retrieve and parse quiz data from sessionStorage
const quizData = sessionStorage.getItem('quizData');
if (quizData) {
try {
const [url, answerOne, answerTwo] = JSON.parse(quizData);
const currentUrl = window.location.href;
// Check if the current URL matches the stored URL
if (currentUrl.includes(url)) {
document.querySelectorAll(`.cmp-form .leo-radio__input input[value="${answerOne}"]`)[0].click();
document.querySelectorAll(`.cmp-form .leo-radio__input input[value="${answerTwo}"]`)[0].click();
}
} catch (error) {
//console.error('Failed to parse quiz data from sessionStorage:', error);
}
}
}
},
};
// Return if the test ran already!
if (document.querySelector(`.${test.id}`)) return;
// Polling conditions
if (document.querySelector('main.container .cmp-container > .aem-Grid')) {
try {
// Activate test
setTimeout(function () { test.init() }, 1000)
// Success log
console.log('Vertis Digital: EXP-10: V: 1:05');
} catch (error) {
// Error log
console.log(`Initialization Error:`, error);
}
} else {
Date.now() < timeInFuture
? setTimeout(loadVariation.bind({}, timeInFuture), 25)
: console.log("loadVariation timed out!");
}
})(Date.now() + 60000);
// End variation JS
return vwo_$('head')[0] && vwo_$('head')[0].lastChild; } catch(e) {} })("HEAD")}}, R_722219_1027_1_2_0:{ fn:function(){return (function(x) { try{
var el,ctx=vwo_$(x);
/*vwo_debug log("Revert","addElement","body"); vwo_debug*/(el=vwo_$('[vwo-element-id="1739333374770"]')).remove();
var ctx=vwo_$(x),el;
/*vwo_debug log("Revert","content",""); vwo_debug*/;
el=vwo_$('[vwo-element-id="1739333374834"]');
el.revertContentOp().remove();
return vwo_$('head')[0] && vwo_$('head')[0].lastChild; } catch(e) {} })("HEAD")}}, C_722219_1027_1_3_0:{ fn:function(){return (function(x) { try{
var _vwo_sel = vwo_$("");
!vwo_$("head").find("#1739333374787").length && vwo_$('head').append(_vwo_sel);
// Start variation JS
void (function loadVariation(timeInFuture) {
// Main Test object
const test = {
// Some test specific global letiables
id: "EXP-10-V2",
// Test init
init: function () {
// Add a test specific classname to the body element
document.body.classList.add(test.id);
// Below function calls order is important
test.mainJS();
},
// Main JS
mainJS: function () {
/* ---- LOGO ---- */
const crossIcon = `
`;
const newCrossIcon = `
`;
/* ---- DATA ---- */
// quiz data
const collections = [
{
quizName: "Healthy heart, Happy life - Quiz 1",
quizNumber: "quiz 1",
className: "healthy-heart-quiz-one",
image: "https://www.greateasternlife.com/content/dam/corp-site/great-eastern/sg/gels-dme-rewards/health-programme/heart-health/gels-dme-rewards-heart-health-quiz-1.jpg",
coverImage: "https://www.greateasternlife.com/content/dam/corp-site/great-eastern/sg/gels-dme-rewards/health-programme/heart-health/gels-dme-rewards-heart-health-quiz-1.jpg",
url: "https://www.greateasternlife.com/sg/en/personal-insurance/lifepedia/healthy-heart-happy-life/heart-health-and-you-quiz-1.html",
header: "Healthy heart, Happy life - Quiz 1",
quizDate: "Jan 06, 2025",
promoCopy: "Answer 3 simple questions and win an exclusive prize from Eu Yan Sang worth $15!",
questionOne: [
"1. One should see a ____________ if he/she is experiencing chest pain and shortness of breath as it could be a possible sign of heart disease and heart failure.",
["Cardiologist", "Dentist", "Gastroenterologist"]
],
questionTwo: [
"2. These chronic conditions – diabetes, high blood pressure, and high ___________ (also known as the “Three Highs”), are usually asymptomatic and may be unnoticed. It has been observed that patients are also developing these conditions at an increasingly earlier age.",
["Blood count", "Cholesterol", "Fever"]
]
},
{
quizName: "Healthy heart, Happy life - Quiz 2",
quizNumber: "quiz 2",
className: "healthy-heart-quiz-two",
image: "https://www.greateasternlife.com/content/dam/corp-site/great-eastern/sg/gels-dme-rewards/health-programme/heart-health/gels-dme-rewards-heart-health-quiz-2.jpg",
coverImage: "https://www.greateasternlife.com/content/dam/corp-site/great-eastern/sg/gels-dme-rewards/health-programme/heart-health/gels-dme-rewards-heart-health-quiz-2-thumbnail.jpg",
url: "https://www.greateasternlife.com/sg/en/personal-insurance/lifepedia/healthy-heart-happy-life/huat-the-heart-wants-quiz-2.html",
header: "Healthy heart, Happy life - Quiz 2",
quizDate: "Jan 20, 2025",
promoCopy: "Answer 3 simple questions and win an exclusive prize from Fitness First worth $60!",
questionOne: [
"1. Even though pineapple tarts are everywhere for the festive season, I should limit my intake to ____ pieces because it is equivalent to 7 teaspoons of sugar, which is within our recommended daily intake of 10 teaspoons.",
["2", "4", "6"]
],
questionTwo: [
"2. Nian gao, nian gao, in the box… which is the most calorie-loaded of them all?",
["Steamed", "Fried"]
]
},
];
// quiz icon links
const animatedIcon = "https://useruploads.visualwebsiteoptimizer.com/useruploads/722219/images/7a172faba185610e9d0a41c2db03373b_quizicon01.gif";
// quiz image links
const imageUrls = [
"https://useruploads.visualwebsiteoptimizer.com/useruploads/722219/images/2ec24e2a92a520a5701a7de9c9df9671_quizicon01hover.gif",
"https://useruploads.visualwebsiteoptimizer.com/useruploads/722219/images/7a172faba185610e9d0a41c2db03373b_quizicon01.gif",
"https://www.greateasternlife.com/content/dam/corp-site/great-eastern/sg/gels-dme-rewards/health-programme/heart-health/gels-dme-rewards-heart-health-quiz-1.jpg",
"https://www.greateasternlife.com/content/dam/corp-site/great-eastern/sg/gels-dme-rewards/health-programme/heart-health/gels-dme-rewards-heart-health-quiz-2.jpg",
"https://www.greateasternlife.com/content/dam/corp-site/great-eastern/sg/gels-dme-rewards/health-programme/heart-health/gels-dme-rewards-heart-health-quiz-2-thumbnail.jpg"
];
// array of quiz pages
const quizPages = [
'/sg/en/personal-insurance/lifepedia/healthy-heart-happy-life/heart-health-and-you-quiz-1.html',
'/sg/en/personal-insurance/lifepedia/healthy-heart-happy-life/huat-the-heart-wants-quiz-2.html',
];
// array of pages to show quiz logo
const variationPages = [
'/sg/en/personal-insurance/lifepedia.html',
'/sg/en/personal-insurance/lifepedia/medical-coverage.html',
'/sg/en/personal-insurance/lifepedia/life-protection.html',
'/sg/en/personal-insurance/lifepedia/lifestyle-protection.html',
'/sg/en/personal-insurance/lifepedia/savings-and-investment.html',
'/sg/en/personal-insurance/lifepedia/retirement-income.html',
'/sg/en/personal-insurance/lifepedia/career.html',
'/sg/en/personal-insurance/rewards-and-promotions.html'
];
/* ---- Utility Functions ---- */
// // image preload function
function preloadImages(imageUrls) {
imageUrls.forEach(url => {
const img = new Image();
img.src = url;
});
}
// function to validate and process quiz data
function validationAndProcessQuizData(quizUrl, quizNumber) {
// Cache form elements
const formSection = document.querySelector('.form-section');
const questionOneInput = document.querySelectorAll('.form-group-one .radio-item input:checked')[0];
const questionTwoInput = document.querySelectorAll('.form-group-two .radio-item input:checked')[0];
// Validation: Check if questions are answered
const isEmpty = !(questionOneInput?.value) || !(questionTwoInput?.value.trim());
const existingError = formSection.querySelector('.error-copy');
const errorHtml = `
Please complete the questions.
`
if (isEmpty) {
// Add error message if it doesn't exist
if (!existingError) {
formSection.insertAdjacentHTML('beforeend', errorHtml);
formSection.classList.add('form-error');
return; // Exit the function
}
return;
}
// Remove error if validation passes
if (existingError) {
existingError.remove();
}
formSection.classList.remove('form-error');
// Prepare quiz data
const quizData = [
quizUrl.trim(),
questionOneInput.value.trim(),
questionTwoInput.value.trim(),
];
// Store the data in session storage
sessionStorage.setItem('quizData', JSON.stringify(quizData));
// step 3 - continue CTA click
let quizName = quizNumber.toLowerCase();
let eventLabel = `[vwo_ce_rtg] rewards quiz - healthy heart - step 3 - continue - ${quizName} - animated`;
let eventJourneyCTA = `vworq-hh-3-${quizName}-animated`;
gaEventTrigger('click', eventLabel, eventJourneyCTA);
// Redirect to the quiz URL
window.location.href = quizUrl;
}
// function to trigger GA events
function gaEventTrigger(eventAction, eventLabel, eventJourneyCTA = '') {
dataLayer.push({
event: "vwoEvent",
eventDetails: {
category: "[vwo] sticky icon",
action: eventAction,
label: eventLabel
},
contentSubcategory: "healthy heart quiz",
...(eventJourneyCTA ? { journeyCta: eventJourneyCTA } : {})
});
};
// fuction to detect touch device
const isTouchDevice = () => {
return (
'ontouchstart' in window || // Check for touch events
navigator.maxTouchPoints > 0 || // Check for touch points
navigator.msMaxTouchPoints > 0 // Microsoft-specific touch points
);
};
/* ---- HTML Templates Markup and Functions ---- */
// create Quiz cards markup
const createQuizCard = (className, coverImage, header, quizDate) => {
return (`
`;
// function to create inner content for modal level two
let modalTwoInnerContent = (className, title, promoCopy) => (`
${title}
${promoCopy}
Start now
`);
//function to generate radio buttons
function generateRadioButtons(options, groupName) {
// Helper function to generate a single radio item
const createRadioItem = (option, index) => {
const id = `${groupName}-option-${index + 1}`; // Unique ID for each option
return `
`;
};
// Generate all radio items
const radioItems = options.map((option, index) => createRadioItem(option, index)).join("");
// Wrap the radio items in the section structure
return `
${radioItems}
`;
}
// function to create inner content for modal level two
let modalThreeInnerContent = (className, questionOne, questionTwo) => (`
`);
// function to create markup for modals on level two and three
let quizModalfn = (className, quizName, image, modalInnerHtml, modalClassNameOne, modalClassNametwo) => (`
${quizCrossButton}
${quizCrossButton}
${modalInnerHtml}
`);
// markup for quiz modal level one
let quizModalLV1 = `
${quizCrossButton}
Take our simple quizzes and win instant rewards today!
Take part in our simple quizzes and win instant rewards today!
${QuizCards}
`;
// function to create the initial modal markup
let modalMarkup = () => (`
`;document.querySelector("#section_banner").innerHTML=b;["GREAT Protector Active","GREAT Junior Protector","GoGreat Term Life","GREAT Prime Rewards","GREAT Maid Protect","Drive and Save Plus","GREAT CareShield"].includes(i)||document.querySelector(".leo-section-banner-content").classList.add("white-product"),r("impression",("[vwo_ce_rtg] homepage banner - "+i+" - "+d+" - "+u).toLowerCase(),i.toLowerCase()),document.body.addEventListener("click",(function(e){const{target:t}=e;if(t.closest(".vwo_homepage_herobanner_cta")){r("click",("[vwo_ce_rtg] homepage banner - "+i+" - "+d+" - "+u).toLowerCase(),i.toLowerCase(),("vwohp-"+i+"-"+u).toLowerCase())}}))}};if(!document.querySelector("."+r.id))if(document.querySelector("#section_banner"))try{r.init()}catch(e){console.log("Initialization Error:",e)}else Date.now() !productsPurchasedArr.some(b => b.name === a.name)
);
// Cross check master product infos
productsViewedArr = productsViewedArr.filter(
a => productsViewedCTAArr.some(b => b.name === a.name)
);
// Reduce to the latest X array items
productsViewedArr = productsViewedArr.slice(-productsViewedMaxItems);
let lastPageVisitedInfo = getCookie(lastPageVisitedCookieName);
// If there are last products viewed, run VWO campaign
if (
productsViewedArr.length &&
window.location.pathname === '/sg/en/personal-insurance.html' &&
lastPageVisitedInfo === 'product'
) {
let productName = productsViewedArr[0].name;
let activate = false;
let impressionDataStr = getCookie(IMPRESSION_COUNT_COOKIE);
let impressionData = impressionDataStr ? JSON.parse(impressionDataStr) : null;
const MAX_IMPRESSIONS = 3;
if (!impressionData) {
activate = true;
setCookie(
IMPRESSION_COUNT_COOKIE,
JSON.stringify({ product: productName, count: 1 }),
cookieExpiryDays
);
} else {
const { product, count } = impressionData;
if (product !== productName) {
activate = true;
setCookie(
IMPRESSION_COUNT_COOKIE,
JSON.stringify({ product: productName, count: 1 }),
cookieExpiryDays
);
} else if (count < MAX_IMPRESSIONS) {
activate = true;
setCookie(
IMPRESSION_COUNT_COOKIE,
JSON.stringify({ product: productName, count: count + 1 }),
cookieExpiryDays
);
} else {
activate = false;
}
}
if (activate) {
executeTrigger();
//alert('activate')
}
}
})()
}}, C_722219_819_1_2_2:{ fn:function(log,nonce=''){return (function(x) {var el,ctx=vwo_$(x);
/*vwo_debug log("remove",".footer"); vwo_debug*/(el=vwo_$(".footer")).vwoCss({display:"none !important"});})(".footer")}}, C_722219_816_1_2_1:{ fn:function(log,nonce=''){return (function(x) {var el,ctx=vwo_$(x);
/*vwo_debug log("remove",".header"); vwo_debug*/(el=vwo_$(".header")).vwoCss({display:"none !important"});})(".header")}}, C_722219_980_1_3_1:{ fn:function(log,nonce=''){return (function(x) {
try{
var _vwo_sel = vwo_$("`);
!vwo_$("head").find('#1737431535473').length && vwo_$('head').append(_vwo_sel);}catch(e) {console.error(e)}
try{}catch(e) {console.error(e)}
try{/*
// Flag to ensure the action happens only once
let firstTime = true;
function forceClickAndChange() {
if (firstTime) {
// Simulate a click on the icon-edit element
const iconEditButton = document.querySelector('.icon-edit');
if (iconEditButton) {
iconEditButton.click();
console.log(iconEditButton);
console.log("edit clicked");
}
//attempt to change sliderinput value
const changeValue = document.getElementById('sliderinput');
if (changeValue) {
changeValue.value = 4000;
console.log("amount changed v2");
}
// Change the value of the modalvalue span
const modalValueSpan = document.querySelector(".modelValue");
if (modalValueSpan) {
modalValueSpan.textContent = 4000;
console.log("amount changed v1");
}
// Simulate a click on the icon-check element
const iconCheckButton = document.querySelector('.icon-check');
if (iconCheckButton) {
iconCheckButton.click();
console.log("edit check clicked");
// Set the flag to false to prevent future executions
}
firstTime = false;
}
}
// Call the function to initiate the process
forceClickAndChange();
*/
}catch(e) {console.error(e)}
return vwo_$('head')[0] && vwo_$('head')[0].lastChild;})("head")}}, C_722219_980_1_3_0:{ fn:function(log,nonce=''){return (function(x) {
try{
var _vwo_sel = vwo_$("`);
!vwo_$("head").find('#1737431535472').length && vwo_$('head').append(_vwo_sel);}catch(e) {console.error(e)}
try{}catch(e) {console.error(e)}
try{const inputField=document.querySelectorAll(".cmp-input__inputfield"),notificationDiv=document.querySelector(".education-message-notification");var spanElement=document.querySelector(".cmp-notification__icon.cmp-notification__icon--image"),childElement=spanElement.querySelector("img");function updateClassC(e){console.log("NEWVALUE",e);document.querySelector(".cmp-notification__text .cmp-notification__textcon")&&("4,000"===e||"4,800"===e||notificationDiv.classList.add("hidden"))}function sendValue(e){window.VWO=window.VWO||[],VWO.event=VWO.event||function(){VWO.push(["event"].concat([].slice.call(arguments)))},VWO.event("gcsSelectedRevenueAmount",{container5D41476F83DivAemCmpForm:e,gcsSlideValue2:e})}notificationDiv.classList.add("hidden"),console.log("GCS test started"),inputField.forEach(e=>{const t=e.querySelector(".modelValue");if(t){const e=()=>{console.log("Current value:",t.textContent),sendValue(t.textContent.trim())};e();new MutationObserver(()=>{e()}).observe(t,{attributes:!0,characterData:!0,childList:!0,subtree:!0,attributeOldValue:!0,characterDataOldValue:!0})}});}catch(e) {console.error(e)}
return vwo_$('head')[0] && vwo_$('head')[0].lastChild;})("head")}}, C_722219_980_1_2_0:{ fn:function(log,nonce=''){return (function(x) {
try{
var _vwo_sel = vwo_$("`);
!vwo_$("head").find('#1737431535466').length && vwo_$('head').append(_vwo_sel);}catch(e) {console.error(e)}
try{}catch(e) {console.error(e)}
try{const inputField=document.querySelectorAll(".cmp-input__inputfield"),notificationDiv=document.querySelector(".education-message-notification");var spanElement=document.querySelector(".cmp-notification__icon.cmp-notification__icon--image"),childElement=spanElement.querySelector("img");const slideAdd=document.querySelector(".vwo-slider");function updateClassC(e){console.log("NEWVALUE",e);const t=document.querySelector(".cmp-notification__text .cmp-notification__textcon");t&&("4,000"===e?(notificationDiv.classList.remove("hidden"),t.textContent="For $4,000 you can hire a trained domestic helper for caregiving and pay for rehabilitation and medical supply expenses.",childElement.src="/content/dam/gel-orion/pre-login-agency/sg/en/common-images/icons/icon-milestone-heart.png"):"4,800"===e?(notificationDiv.classList.remove("hidden"),t.textContent="$4,800 can bring you care by a loved one as well as rehabilitation and medical supplies.",childElement.src="/content/dam/gel-orion/pre-login-agency/sg/en/common-images/icons/icon-milestone-successful.png"):notificationDiv.classList.add("hidden"))}function sendValue(e){window.VWO=window.VWO||[],VWO.event=VWO.event||function(){VWO.push(["event"].concat([].slice.call(arguments)))},VWO.event("gcsSelectedRevenueAmount",{container5D41476F83DivAemCmpForm:e,gcsSlideValue2:e})}slideAdd.classList.add("slider-icons-wrapper"),inputField.forEach(e=>{const t=e.querySelector(".modelValue");if(t){const e=()=>{console.log("Current value:",t.textContent),updateClassC(t.textContent.trim()),sendValue(t.textContent.trim())};e();new MutationObserver(()=>{e()}).observe(t,{attributes:!0,characterData:!0,childList:!0,subtree:!0,attributeOldValue:!0,characterDataOldValue:!0})}});}catch(e) {console.error(e)}
return vwo_$('head')[0] && vwo_$('head')[0].lastChild;})("head")}}, ct_5215ff5c22dc94f8ba11d10604b76f9d:{ fn:function(executeTrigger, vwo_$, config) {
(function() {
if (!config || typeof config !== "object") {
return;
}
if (window.vwo_$(config.sel).length > 0) {
return executeTrigger();
}
window.VWO._.phoenixMT.once("vwo_mutObs." + config.triggerName, () => {
if (window.vwo_$(config.sel).length > 0) {
executeTrigger();
}
});
})()
}
}, ct_969ce375f56191050c360e633277bd5a:{ fn:function(executeTrigger, vwo_$, config) {
(function() {
if (!config || typeof config !== "object") {
return;
}
if (window.vwo_$(config.sel).length > 0) {
return executeTrigger();
}
window.VWO._.phoenixMT.once("vwo_mutObs." + config.triggerName, () => {
if (window.vwo_$(config.sel).length > 0) {
executeTrigger();
}
});
})()
}
}, C_722219_736_1_2_0:{ fn:function(log,nonce=''){return (function(x) {try{!function(){var e=window.location.pathname,t=[{name:"GREAT CareShield",productCategory:"health-insurance",cta1Text:"Learn more",cta1Url:"/sg/en/personal-insurance/our-products/health-insurance/great-careshield.html",cta2Text:"Buy now",cta2Url:"//buy.greateasternlife.com/sg/en/health-insurance/220402/get-quotation.html",bulletPoints:["Disability financial support starts from the inability to perform any ADL","Get up to 90% more in monthly benefits for caregiver's and children's expenses","Utilise your MediSave funds4 for enhanced coverage"]},{name:"GREAT Critical Cover Series",productCategory:"health-insurance",cta1Text:"Learn more",cta1Url:"/sg/en/personal-insurance/our-products/health-insurance/great-critical-cover.html",cta2Text:"Buy now",cta2Url:"//buy.greateasternlife.com/sg/en/life-insurance/220303/get-quotation.html",bulletPoints:["100% payout for every critical illness claim","Coverage continues over and over again, even after the first critical illness claim","Flexibility in choice of coverage"]},{name:"GoGreat Term Life",productCategory:"life-insurance",cta1Text:"Learn more",cta1Url:"/sg/en/personal-insurance/our-products/life-insurance/gogreat-term-life.html",cta2Text:"Buy now",cta2Url:"//buy.greateasternlife.com/sg/en/life-insurance/210301/get-quotation.html",bulletPoints:["Complete your protection needs from just S$0.21* a day","All-round protection till age 65","Hassle-free application"]},{name:"GREAT Protector Active",productCategory:"personal-accident-insurance",cta1Text:"Learn more",cta1Url:"/sg/en/personal-insurance/our-products/personal-accident-insurance/great-protector-active.html",cta2Text:"Buy now",cta2Url:"//buy.greateasternlife.com/sg/en/personal-accident-insurance/200201/get-quotation.html",bulletPoints:["Get up to S$3 million in coverage against accidents","Boost coverage by up to 1.5 times with Benefit Booster4","High medical expenses reimbursement"]},{name:"Essential Protector Plus",productCategory:"personal-accident-insurance",cta1Text:"Learn more",cta1Url:"/sg/en/personal-insurance/our-products/personal-accident-insurance/essential-protector-plus.html",cta2Text:"Buy now",cta2Url:"//buy.greateasternlife.com/sg/en/personal-accident-insurance/200204/get-quotation.html",bulletPoints:["Reimbursement of up to S$15,000 for medical expenses","Get daily income upon hospitalisation","Extra payout of up to S$8,000 for accidental injuries","Additional 20% coverage for ladies"]},{name:"GREAT Junior Protector",productCategory:"personal-accident-insurance",cta1Text:"Learn more",cta1Url:"/sg/en/personal-insurance/our-products/personal-accident-insurance/great-junior-protector.html",cta2Text:"Buy now",cta2Url:"//buy.greateasternlife.com/sg/en/personal-accident-insurance/200202/get-quotation.html",bulletPoints:["Up to 3 times payout upon Accidental Death and Permanent Disablement","Daily hospital cash benefit for up to 41 Infectious Diseases","Reimbursement of up to S$9,000 for Accidental Medical Expenses"]},{name:"GREAT Prime Rewards",productCategory:"wealth-accumulation",cta1Text:"Learn more",cta1Url:"/sg/en/personal-insurance/our-products/wealth-accumulation/great-prime-rewards.html",cta2Text:"Buy now",cta2Url:"//buy.greateasternlife.com/sg/en/life-insurance/220105/get-quotation.html",bulletPoints:["Receive regular income stream to suit your retirement needs","Boost your annual payouts by up to 1.82X†","Your capital is guaranteed1","Maximise retirement planning with SRS"]},{name:"GREAT Hospital Cash",productCategory:"health-insurance",cta1Text:"Learn more",cta1Url:"/sg/en/personal-insurance/our-products/health-insurance/great-hospital-cash.html",cta2Text:"Buy now",cta2Url:"//buy.greateasternlife.com/sg/en/health-insurance/230401/get-quotation.html",bulletPoints:["Assurance of hospital cash payouts after 12 hours^","Enjoy up to a lifetime of hospitalisation coverage","Enjoy more discounts on your premiums","Sign up online and start your coverage with ease"]},{name:"GREAT Golden Protector",productCategory:"personal-accident-insurance",cta1Text:"Learn more",cta1Url:"/sg/en/personal-insurance/our-products/personal-accident-insurance/great-golden-protector.html",cta2Text:"Buy now",cta2Url:"//buy.greateasternlife.com/sg/en/personal-accident-insurance/200203/get-quotation.html",bulletPoints:["Up to 300% payout and up to S$200 daily hospital cash benefit","Comprehensive post-accident benefits","Payouts of up to S$25,000 for fractures, dislocations or burns","Get 25% off premiums on 2nd life assured"]},{name:"PA Supreme",productCategory:"personal-accident-insurance",cta1Text:"Learn more",cta1Url:"/sg/en/personal-insurance/our-products/personal-accident-insurance/pa-supreme.html",cta2Text:"Buy now",cta2Url:"//greateasternlife.com/psu",bulletPoints:["High payout in an unfortunate event","Financial support for a swift recovery","Assurance of emergency support that counts"]}],a=`\n \n \n \n \n \n`,n='\n
`;
// function to create inner content for modal level two
let modalTwoInnerContent = (className, title, promoCopy) => (`
${title}
${promoCopy}
Start now
`);
//function to generate radio buttons
function generateRadioButtons(options, groupName) {
// Helper function to generate a single radio item
const createRadioItem = (option, index) => {
const id = `${groupName}-option-${index + 1}`; // Unique ID for each option
return `
`;
};
// Generate all radio items
const radioItems = options.map((option, index) => createRadioItem(option, index)).join("");
// Wrap the radio items in the section structure
return `
${radioItems}
`;
}
// function to create inner content for modal level two
let modalThreeInnerContent = (className, questionOne, questionTwo) => (`
`);
// function to create markup for modals on level two and three
let quizModalfn = (className, quizName, image, modalInnerHtml, modalClassNameOne, modalClassNametwo) => (`
${quizCrossButton}
${quizCrossButton}
${modalInnerHtml}
`);
// markup for quiz modal level one
let quizModalLV1 = `
${quizCrossButton}
Take our simple quizzes and win instant rewards today!
Take part in our simple quizzes and win instant rewards today!
${QuizCards}
`;
// function to create the initial modal markup
let modalMarkup = () => (`
Let's Reach for Great as you protect yourself from life's uncertainties and empower your financial freedom. Explore our life protection, health and wealth accumulation solutions today for all your tomorrows.