`;
// 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 = () => (`
${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 - animated';
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 - animated';
let eventJourneyCTA = 'vworq-hh-win prizes-animated';
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 - animated';
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 - animated`;
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')?.toLowerCase();
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} - animated`;
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')?.toLowerCase();
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} - animated`;
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} - animated`;
let eventJourneyCTA = `vworq-hh-1-${quizTitle}-animated`;
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} - animated`;
let eventJourneyCTA = `vworq-hh-2-${quizTitle}-animated`;
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 - animated`;
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} - animated`;
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} - animated`;
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: 2: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_3_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="1739333374850"]')).remove();
var ctx=vwo_$(x),el;
/*vwo_debug log("Revert","content",""); vwo_debug*/;
el=vwo_$('[vwo-element-id="1739333374787"]');
el.revertContentOp().remove();
return vwo_$('head')[0] && vwo_$('head')[0].lastChild; } catch(e) {} })("HEAD")}}, C_722219_763_1_2_0:{ fn:function(log,nonce=''){return (function(x) {var el,ctx=vwo_$(x);
/*vwo_debug log("remove",".cmp-marquee-promotion"); vwo_debug*/(el=vwo_$(".cmp-marquee-promotion")).vwoCss({display:"none !important"});})(".cmp-marquee-promotion")}}, C_722219_997_1_2_0:{ fn:function(){return (function(x) { try{
// Start variation JS
void (function loadVariation(timeInFuture) {
// Main Test object
const test = {
// Some test specific global letiables
id: "EXP-1",
// 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 () {
const cookieName = "quotationData"; // cookie name
const cookieExpiryDays = 90;
const dataPopulationCookieName = "data-population-cookie";
/// *** Utility functions *** ///
// Utility function to get selected index
const getSelectedIndex = (selector, selectedClass = '-selected') => {
return [...document.querySelectorAll(selector)].findIndex(item => item.classList.contains(selectedClass));
}
// Utility function to get payment index
const getPaymentIndex = (selector, selectedClass = '-selected') => {
return [...document.querySelectorAll(selector)].findIndex(item => item.parentElement.classList.contains(selectedClass));
}
// Utility function to select an option by text content
function selectOptionByText(selector, textContent) {
document.querySelectorAll(selector).forEach(item => {
if (item.textContent.trim() === textContent) {
item.click();
}
});
}
// Utility function to set input value and dispatch event
function setInputValue(selector, value) {
const inputElement = document.querySelector(selector);
if (inputElement) {
inputElement.value = value;
inputElement.dispatchEvent(new Event('input'));
}
}
// Utility function to click a radio button by index
function clickRadioButtonByIndex(selector, index) {
const buttons = document.querySelectorAll(selector);
if (buttons[index]) {
buttons[index].click();
}
}
// function clickRadioButtonForGCS(selector, index) {
// const buttons = document.querySelectorAll(selector);
// if (buttons[index]) {
// buttons[index].parentElement.click();
// }
// }
// Utility function to click an input element by ID
function clickInputById(id) {
const inputElement = document.querySelector(`#${id}`);
if (inputElement) {
inputElement.click();
}
}
// Utility function to Function to set cookie
function setCookie(cname, cvalue, exdays) {
const d = new Date();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
const expires = `expires=${d.toUTCString()}`;
document.cookie = `${cname}=${cvalue}; ${expires}; path=/; domain=.adobecqms.net`;
};
// Utility function to Function to get cookie
function getCookie(cname) {
const name = cname + "=";
const decodedCookie = decodeURIComponent(document.cookie);
const ca = decodedCookie.split(';');
for (var i = 0; i < ca.length; i++) {
let c = ca[i].trim();
if (c.indexOf(name) === 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
// // Utility function to delete cookie
// function deleteCookie(name) {
// document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; domain=.greateasternlife.com`;
// }
/// *** Utility functions *** ///
// function to set or update quotation cookie
const setOrUpdateQuoteDataInCookie = (quotationData) => {
if (!quotationData || typeof quotationData !== 'object') return;
const saveCookie = (data) => {
setCookie(cookieName, JSON.stringify(data), cookieExpiryDays);
};
const existingCookie = getCookie(cookieName);
if (!existingCookie) {
saveCookie(quotationData);
//console.log("Quotation data saved as a new cookie.");
return;
}
let existingData;
try {
existingData = JSON.parse(existingCookie);
} catch (error) {
//console.error("Failed to parse existing cookie:", error);
saveCookie(quotationData);
return;
}
if (existingData.productJourney === quotationData.productJourney) {
// Same product journey, update values
const updatedData = { ...existingData, ...quotationData };
saveCookie(updatedData);
//console.log("Updated existing quotation data.");
} else {
saveCookie(quotationData);
//console.log("Replaced quotation data with a new product journey.");
}
};
// function to set Great Protector Active quote data
function getQuoteDataGPA() {
if (window.location.pathname !== '/sg/en/personal-accident-insurance/200201/get-quotation.html') return;
let productJourney = 'GREAT Protector Active';
let insuredFor = document.querySelector('label[for="insured"] +.multiselect .multiselect-single-label')?.textContent;
let idSelector = document.querySelectorAll('label[for="thirdPartyIdType"] +.multiselect .multiselect-single-label , label[for="idType"] +.multiselect .multiselect-single-label')[0];
let idType = idSelector?.textContent;
let birthDate = document.querySelector('input#birthdayInput')?.value;
let planOptionsIndex = getSelectedIndex('.plan-options .cmp-radio');
let addOnSelection = document.querySelectorAll('.checkbox-custom .cmp-checkbox-custom.-selected').length > 0;
let paymentCycle = getPaymentIndex('#paymentFrequency-Monthly , #paymentFrequency-Annual');
// Initializing an empty object
let quotationData = {};
// Adding properties only if the values are available
if (productJourney) quotationData.productJourney = productJourney;
if (insuredFor) quotationData.insuredFor = insuredFor;
if (idType) quotationData.idType = idType;
if (birthDate) quotationData.birthDate = birthDate;
if (planOptionsIndex !== -1) quotationData.planOptionsIndex = planOptionsIndex;
if (paymentCycle !== -1 && document.querySelectorAll('.checkbox-custom .cmp-checkbox-custom.-selected').length > -1) {
//alert('check 01')
quotationData.addOnSelection = addOnSelection
}
if (paymentCycle !== -1) quotationData.paymentCycle = paymentCycle;
// Store or update quotation data in cookie
if (insuredFor && idType && birthDate) setOrUpdateQuoteDataInCookie(quotationData);
}
// get value of data population cookie to populate data
let dataPopulationCookieValue = getCookie(dataPopulationCookieName);
// set session storage based on cookie value
// if (dataPopulationCookieValue) {
// sessionStorage.setItem("data-population", "true");
// deleteCookie("data-population-cookie");
// }
// Main function to handle form data population based on the pathname
function handleDataPopulation(productData, loadAgain = false) {
const pathname = window.location.pathname;
const { productJourney } = productData;
// Actions for Great Protector Active
if (pathname === '/sg/en/personal-accident-insurance/200201/get-quotation.html' && productJourney === 'GREAT Protector Active') {
if (productData.insuredFor && loadAgain) {
selectOptionByText('label[for="insured"] + .multiselect .multiselect-option', productData.insuredFor);
}
setTimeout(function () {
if (productData.idType && loadAgain) {
selectOptionByText('label[for="thirdPartyIdType"] + .multiselect .multiselect-option , label[for="idType"] + .multiselect .multiselect-option', productData.idType);
}
if (productData.birthDate && loadAgain) {
setInputValue("#birthdayInput", productData.birthDate);
}
}, 500)
setTimeout(function () {
if (productData.planOptionsIndex > -1) {
clickRadioButtonByIndex('.plan-options .cmp-radio input', productData.planOptionsIndex);
setTimeout(function () {
let targetContent = document.querySelectorAll('.plan-options .cmp-radio input + label .radio-select-label-selected')[0];
if (targetContent) {
targetContent.textContent = 'Pre-selected';
}
}, 1000)
}
if (productData.addOnSelection) {
setTimeout(function () {
clickInputById('selectedExtraPlan-undefined');
if (productData.paymentCycle > -1) {
setTimeout(function () {
if (document.querySelector('label[for="paymentFrequency-Annual"] .cmp-text.font-normal span').textContent.length > 3) {
clickRadioButtonByIndex('#paymentFrequency-Monthly , #paymentFrequency-Annual', productData.paymentCycle);
}
}, 1500);
}
}, 500)
} else {
if (productData.paymentCycle > -1) {
setTimeout(function () {
if (document.querySelector('label[for="paymentFrequency-Annual"] .cmp-text.font-normal span').textContent.length > 3) {
clickRadioButtonByIndex('#paymentFrequency-Monthly , #paymentFrequency-Annual', productData.paymentCycle);
}
}, 1500);
}
}
}, 2000)
}
}
function loadData() {
if (dataPopulationCookieValue !== 'true') return;
(function pollForFormload() {
if (
document.querySelector('input[name="agentMobileNumber"]') &&
document.querySelectorAll('#paymentFrequency-Annual , #packageItem-W05I1-annual').length > 0
) {
const existingCookie = getCookie(cookieName);
const productData = existingCookie ? JSON.parse(existingCookie) : {};
// Handle form filling based on the current page
handleDataPopulation(productData);
} else {
setTimeout(pollForFormload, 25);
}
})();
}
// function to handle click events
function eventHandler(event) {
const { target } = event;
//console.log('target:', target);
if (
window.location.pathname === '/sg/en/personal-accident-insurance/200201/get-quotation.html' &&
target.closest('.cmp-button a') &&
(
target.textContent.includes('View benefits') ||
target.closest('.cmp-button a[href*="https://buy-uat-greateasternlife.adobecqms.net/sg/en/personal-accident-insurance/200201/quick-check.html"]'))
) {
if (target.textContent.includes('View benefits')) loadData();
getQuoteDataGPA();
//alert('working GPA');
}
}
// Initialize product data from cookie
const existingCookie = getCookie(cookieName);
const productData = existingCookie ? JSON.parse(existingCookie) : {};
// Handle form data population based on the current page
if (dataPopulationCookieValue === 'true') {
handleDataPopulation(productData, true);
}
document.body.addEventListener('click', eventHandler);
},
};
// Return if the test ran already!
if (document.querySelector(`.${test.id}`)) return;
// Polling conditions
if (document.readyState === "complete") {
try {
// Activate test
test.init();
// Success log
//console.log('Vertis Digital: EXP-1: V: 1:12');
} 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")}}, ct997_11fd5df3bdf6d6f8b7b1bbf21173a0ed:{ fn:function(executeTrigger, vwo_$) {
(function () {
if (location.pathname !== '/sg/en/personal-accident-insurance/200201/get-quotation.html') return;
const productsPurchasedCookieName = "personalization_products_purchased";
const quotationDataCookieName = "quotationData";
const dataPopulationCookieName = "data-population-cookie";
// Function to get cookie
function getCookie(cname) {
const name = cname + "=";
const decodedCookie = decodeURIComponent(document.cookie);
const cookies = decodedCookie.split(';');
for (const cookie of cookies) {
const c = cookie.trim();
if (c.indexOf(name) === 0) {
return c.substring(name.length);
}
}
return "";
}
const productsPurchasedStr = getCookie(productsPurchasedCookieName);
const productPurchaseData = productsPurchasedStr ? JSON.parse(productsPurchasedStr) : [];
//const quotationDataCookieValue = getCookie(quotationDataCookieName);
//const dataPopulationCookieValue = getCookie(dataPopulationCookieName);
const productsViewedCTAArr = [
{ "name": "GREAT Protector Active" }
];
// Check if any product from productsViewedCTAArr is in productPurchaseData
const hasMatchingProduct = productsViewedCTAArr.some(viewedProduct =>
productPurchaseData.some(purchasedProduct => purchasedProduct.name === viewedProduct.name)
);
// console.log('hasMatchingProduct:', hasMatchingProduct);
// console.log('quotationDataCookieValue:', quotationDataCookieValue);
// console.log('dataPopulationCookieValue:', dataPopulationCookieValue);
// Activation conditions
// const shouldActivate = (
// (!hasMatchingProduct && quotationDataCookieValue === '') ||
// (!hasMatchingProduct && quotationDataCookieValue && dataPopulationCookieValue === 'true')
// )
if (!hasMatchingProduct) {
//alert('activate');
executeTrigger();
}
})()
}}, GL_722219_963_post:{ fn:function(VWO_CURRENT_CAMPAIGN, VWO_CURRENT_VARIATION,nonce = ""){}}, GL_722219_963_pre:{ fn:function(VWO_CURRENT_CAMPAIGN, VWO_CURRENT_VARIATION,nonce = ""){try{;
var _vwoCurrentPageUrl = window.location.href; var matchRegex = VWO._.matchRegex;vwo_$('[vwo-widget-id]').remove();vwo_$('html').get(0).classList.forEach((cl)=>{var mpClass=cl.match(/(?:\s|^)(vwo_p_s_[0-9a-f]{32})(?:\s|$)/);mpClass && (['vwo_p_s_baf0439c6ee7eeb30695dbb63777c8a1','vwo_p_s_529d06731882814587edcdb7fcb47719','vwo_p_s_117ea7d82ad4208c01b4c082cbb1dcbe','vwo_p_s_b4e3c967173ff0c7334aa142c9f54d98','vwo_p_s_c1156e4acc492a4b12f5b24e80ca04d4','vwo_p_s_a192231b2113d157699dea212968af5a','vwo_p_s_f5e15ac35b42d3a7242aa2f738572873','vwo_p_s_db54451655d6fbb590be3ae44920e36f'].indexOf(mpClass[1])!=-1) && vwo_$('html').removeClass(mpClass[1]);});if(matchRegex(_vwoCurrentPageUrl,'^https:\/\/greateasternlife\.com\/sg\/en\/personal-insurance\/our-products\/personal-accident-insurance\/essential-protector-plus\.html\/?(?:[?#].*)?$')){vwo_$('html').addClass('vwo_p_s_baf0439c6ee7eeb30695dbb63777c8a1')} else if(matchRegex(_vwoCurrentPageUrl,'^https:\/\/greateasternlife\.com\/sg\/en\/personal-insurance\/our-products\/personal-accident-insurance\/great-golden-protector\.html\/?(?:[?#].*)?$')){vwo_$('html').addClass('vwo_p_s_529d06731882814587edcdb7fcb47719')} else if(matchRegex(_vwoCurrentPageUrl,'^https:\/\/greateasternlife\.com\/sg\/en\/personal-insurance\/our-products\/personal-accident-insurance\/great-junior-protector\.html\/?(?:[?#].*)?$')){vwo_$('html').addClass('vwo_p_s_117ea7d82ad4208c01b4c082cbb1dcbe')} else if(matchRegex(_vwoCurrentPageUrl,'^https:\/\/greateasternlife\.com\/sg\/en\/personal-insurance\/our-products\/personal-accident-insurance\.html\/?(?:[?#].*)?$')){vwo_$('html').addClass('vwo_p_s_b4e3c967173ff0c7334aa142c9f54d98')} else if(matchRegex(_vwoCurrentPageUrl,'^https:\/\/greateasternlife\.com\/sg\/en\/personal-insurance\/rewards-and-promotions\/promotions-and-events\/2024\/geapp-exclusive-deals\.html\/?(?:[?#].*)?$')){vwo_$('html').addClass('vwo_p_s_c1156e4acc492a4b12f5b24e80ca04d4')} else if(matchRegex(_vwoCurrentPageUrl,'^https:\/\/greateasternlife\.com\/sg\/en\/personal-insurance\/our-products\/personal-accident-insurance\/great-protector-active\.html\/?(?:[?#].*)?$')){vwo_$('html').addClass('vwo_p_s_a192231b2113d157699dea212968af5a')} else if(matchRegex(_vwoCurrentPageUrl,'^https:\/\/greateasternlife\.com\/sg\/en\/personal-insurance\/rewards-and-promotions\.html\/?(?:[?#].*)?$')){vwo_$('html').addClass('vwo_p_s_f5e15ac35b42d3a7242aa2f738572873')} else if(matchRegex(_vwoCurrentPageUrl,'^https:\/\/wpr-uat\.greateasternlife\.com\/sg\/en\/personal-insurance\/our-products\/personal-accident-insurance\.html\/?(?:[?#].*)?$')){vwo_$('html').addClass('vwo_p_s_db54451655d6fbb590be3ae44920e36f')}
}catch(e){}}}, R_722219_963_1_2_61:{ fn:function(log,nonce=''){return (function(x) {
if(!vwo_$.fn.vwoRevertHtml){
return;
};
var el,ctx=vwo_$(x);
/*vwo_debug log("Revert","editElement","html.vwo_p_s_db54451655d6fbb590be3ae44920e36f #eppbuynow"); vwo_debug*/(el=vwo_$("html.vwo_p_s_db54451655d6fbb590be3ae44920e36f #eppbuynow")).vwoRevertAttr(),el.vwoRevertCss();})("html.vwo_p_s_db54451655d6fbb590be3ae44920e36f #eppbuynow")}}, C_722219_963_1_2_61:{ fn:function(log,nonce=''){return (function(x) {var el,ctx=vwo_$(x);
/*vwo_debug log("editElement","html.vwo_p_s_db54451655d6fbb590be3ae44920e36f #eppbuynow"); vwo_debug*/(el=vwo_$("html.vwo_p_s_db54451655d6fbb590be3ae44920e36f #eppbuynow")).vwoAttr({href:"#"}),el.vwoCss({transition:"none !important"});})("html.vwo_p_s_db54451655d6fbb590be3ae44920e36f #eppbuynow")}}, C_722219_963_1_2_49:{ fn:function(log,nonce=''){return (function(x) {var el,ctx=vwo_$(x);
/*vwo_debug log("editElement","html.vwo_p_s_c1156e4acc492a4b12f5b24e80ca04d4 .leo-row--gap-xs > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(2) > div:nth-of-type(2) > p:nth-of-type(6) > b:nth-of-type(1) > a:nth-of-type(1)"); vwo_debug*/(el=vwo_$("html.vwo_p_s_c1156e4acc492a4b12f5b24e80ca04d4 .leo-row--gap-xs > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(2) > div:nth-of-type(2) > p:nth-of-type(6) > b:nth-of-type(1) > a:nth-of-type(1)")).html("Buy now").vwoAttr({href:"https://buy.greateasternlife.com/sg/en/personal-accident-insurance/200201/get-quotation.html?template=post&campCode=C8DISC&aid=GEAPP&utm_campaign=gels_clvm_aw_ds_pageapp1124&utm_source=other_geapp&utm_medium=text-link&utm_content=postlogin&utm_term=pa8geapp_postcpbuy_gpa"});})("html.vwo_p_s_c1156e4acc492a4b12f5b24e80ca04d4 .leo-row--gap-xs > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(2) > div:nth-of-type(2) > p:nth-of-type(6) > b:nth-of-type(1) > a:nth-of-type(1)")}}, C_722219_998_1_2_0:{ fn:function(){return (function(x) { try{
var _vwo_sel = vwo_$("");
!vwo_$("head").find("#1736837447668").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-1-Home",
// 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 () {
const cookieName = "quotationData";
const dataPopulationCookieName = "data-population-cookie";
// Function to get cookie
function getCookie(cname) {
const name = cname + "=";
const decodedCookie = decodeURIComponent(document.cookie);
const cookies = decodedCookie.split(';');
for (const cookie of cookies) {
const c = cookie.trim();
if (c.indexOf(name) === 0) {
return c.substring(name.length);
}
}
return "";
}
// Utility function to Function to set cookie
function setCookie(cname, cvalue, exmin) {
const d = new Date();
d.setTime(d.getTime() + (exmin * 60 * 1000));
const expires = `expires=${d.toUTCString()}`;
document.cookie = `${cname}=${cvalue}; ${expires}; path=/; domain=.greateasternlife.com`;
};
// function to trigger GA events
function gaEventTrigger(eventAction, eventLabel, eventSubCategory = '', eventJourneyCTA = '') {
dataLayer.push({
event: "vwoEvent",
eventDetails: {
category: "[vwo] floating banner - ab test - expose",
action: eventAction,
label: eventLabel
},
...(eventSubCategory ? { contentSubcategory: eventSubCategory } : {}),
...(eventJourneyCTA ? { journeyCta: eventJourneyCTA } : {})
});
};
const existingCookie = getCookie(cookieName);
const productData = existingCookie ? JSON.parse(existingCookie) : {};
const productLinks = {
'GREAT Protector Active': 'https://buy-uat-greateasternlife.adobecqms.net/sg/en/personal-accident-insurance/200201/get-quotation.html'
}
let productName = productData?.productJourney;
let productRedirect = productLinks[productData?.productJourney];
const crossIcon = `
`;
const createBanner = (productName) => (`
${crossIcon}
Ready to complete your purchase for ${productName}?
Secure your coverage now
Resume my purchase
`);
// Retrieve banner view count from localStorage or default to 0
let bannerViewCount = parseInt(localStorage.getItem('bannerViewCount') || '0', 10);
// Check session storage for the 'viewInSession' flag, defaulting to 'show'
const viewInSession = sessionStorage.getItem('viewInSession') || 'show';
// Update session storage if not already set
if (viewInSession === 'show') {
sessionStorage.setItem('viewInSession', 'show');
// Increment and update banner view count in localStorage
bannerViewCount += 1;
localStorage.setItem('bannerViewCount', bannerViewCount);
}
if (
productData &&
productData.productJourney &&
location.pathname === '/sg/en/personal-insurance.html' &&
!document.querySelector('.product-purchase-banner-section') &&
bannerViewCount <= 2 &&
viewInSession !== 'dont show'
) {
// insert the banner
document.querySelector('main .cmp-container > .aem-Grid').insertAdjacentHTML('beforeend', createBanner(productName));
// trigger impression event
let eventLabel = (`[vwo_ce_rtg] resume orion journey floating banner - ${productName}`).toLowerCase();
let eventSubCategory = productName.toLowerCase();
gaEventTrigger('impression', eventLabel, eventSubCategory);
// set banner view count to session & local storage
sessionStorage.setItem('viewInSession', 'seen');
// function for click events
function clickHander(event) {
const { target } = event;
//console.log('target: ', target);
if (target.closest('.banner-icon-section svg')) {
document.querySelector('.product-purchase-banner-section').classList.add('hide-banner');
sessionStorage.setItem('viewInSession', 'dont show');
// trigger click event to Close CTA
let eventLabel = (`[vwo_ce_rtg] resume orion journey floating banner - ${productName}`).toLowerCase();
let eventSubCategory = productName.toLowerCase();
gaEventTrigger('close', eventLabel, eventSubCategory);
}
if (target.closest('.banner-button.new-button') && productRedirect) {
// trigger click event to CTA
let eventLabel = (`[vwo_ce_rtg] resume orion journey floating banner - ${productName} - Resume my purchase`).toLowerCase();
let eventSubCategory = productName.toLowerCase();
let eventJourneyCTA = ("vworf-" + productName).toLowerCase();
gaEventTrigger('click', eventLabel, eventSubCategory, eventJourneyCTA);
setCookie(dataPopulationCookieName, "true", 15);
window.location.href = productRedirect;
}
}
// Add event listener on click event.
document.body.addEventListener('click', clickHander);
}
},
};
// Return if the test ran already!
if (document.querySelector(`.${test.id}`)) return;
// Polling conditions
if (document.querySelector('main .cmp-container > .aem-Grid')) {
try {
// Activate test
test.init();
// Success log
console.log('Vertis Digital: Home: EXP-1: V: 1:11');
} 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")}}, ct_7783c1b5a37a28d2d48816aa87a09f4a:{ 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_c1d2789ab9f7415aa438042c9bb7cd9c:{ 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_514c92ff1ab85933586546d6ec18aec5:{ 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_cbb73702f57faed15ee0829091863373:{ 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_965_1_2_26:{ fn:function(log,nonce=''){return (function(x) {var el,ctx=vwo_$(x);
/*vwo_debug log("remove","html.vwo_p_s_b4e3c967173ff0c7334aa142c9f54d98 .breadcrumb > ul:nth-of-type(1)"); vwo_debug*/(el=vwo_$("html.vwo_p_s_b4e3c967173ff0c7334aa142c9f54d98 .breadcrumb > ul:nth-of-type(1)")).vwoCss({display:"none !important"});})("html.vwo_p_s_b4e3c967173ff0c7334aa142c9f54d98 .breadcrumb > ul:nth-of-type(1)")}}, R_722219_965_1_2_25:{ fn:function(log,nonce=''){return (function(x) {
if(!vwo_$.fn.vwoRevertHtml){
return;
};
var el,ctx=vwo_$(x);
/*vwo_debug log("Revert","content","html.vwo_p_s_117ea7d82ad4208c01b4c082cbb1dcbe .cmp-image__link"); vwo_debug*/(el=vwo_$("html.vwo_p_s_117ea7d82ad4208c01b4c082cbb1dcbe .cmp-image__link")).revertContentOp(),(el=vwo_$("html.vwo_p_s_117ea7d82ad4208c01b4c082cbb1dcbe .cmp-image__link")).vwoRevertCss();})("html.vwo_p_s_117ea7d82ad4208c01b4c082cbb1dcbe .cmp-image__link")}}, C_722219_965_1_2_25:{ fn:function(log,nonce=''){return (function(x) {var el,ctx=vwo_$(x);
/*vwo_debug log("content","html.vwo_p_s_117ea7d82ad4208c01b4c082cbb1dcbe .cmp-image__link"); vwo_debug*/el=vwo_$("html.vwo_p_s_117ea7d82ad4208c01b4c082cbb1dcbe .cmp-image__link"),vwo_$("html.vwo_p_s_117ea7d82ad4208c01b4c082cbb1dcbe .cmp-image__link").each((function(){this.__vwoControlOuterHTML=this.__vwoControlOuterHTML||this.outerHTML,vwo_$(this).vwoAttr("href","#"),vwo_$(this).vwoAttr("target",""),vwo_$(this).vwoAttr("id","gjpbuynow3"),vwo_$(this).children().eq(0).vwoAttr("src","/content/dam/corp-site/great-eastern/sg/gels-ftrp-imc-cm/geapp-images/ge-app-exclusive-offer-pa/geapp-pa-offer-pdtpage-gjp.jpg")})),(el=vwo_$("html.vwo_p_s_117ea7d82ad4208c01b4c082cbb1dcbe .cmp-image__link")).vwoCss({transition:"none !important"});})("html.vwo_p_s_117ea7d82ad4208c01b4c082cbb1dcbe .cmp-image__link")}}, ct_97e79efe5c34332a6250ceee4164bef9:{ 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_985_1_2_0:{ fn:function(){return (function(x) { try{
function setCookie(e,t,o){const i=new Date;i.setTime(i.getTime()+24*o*60*60*1e3);const n="expires="+i.toUTCString();document.cookie=e+"="+t+";"+n+";path=/; domain=.greateasternlife.com"}setCookie("lastPageVisited","product",180);
return vwo_$('head')[0] && vwo_$('head')[0].lastChild; } catch(e) {} })("HEAD")}}, ct_a26b7809c1a646c8955514539c0502d6:{ 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_fc2d49fcbf40a510ce450a3b975fdedd:{ 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_6e08f71752cf41b8b65ca2ab3ed42227:{ 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_965_1_2_0:{ fn:function(log,nonce=''){return (function(x) {;})("HEAD")}}, R_722219_965_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="1730706741820"]');
el.revertContentOp().remove();})("HEAD")}}, C_722219_965_1_2_1:{ fn:function(log,nonce=''){return (function(x) {
try{
var _vwo_sel = vwo_$("`);
!vwo_$("head").find('#1730706741967').length && vwo_$('head').append(_vwo_sel);}catch(e) {console.error(e)}
try{}catch(e) {console.error(e)}
try{document.documentElement.classList.contains("vwo_p_s_b4e3c967173ff0c7334aa142c9f54d98");}catch(e) {console.error(e)}
return vwo_$('head')[0] && vwo_$('head')[0].lastChild;})("head")}}, C_722219_965_1_2_2:{ fn:function(log,nonce=''){return (function(x) {
try{
var _vwo_sel = vwo_$("`);
!vwo_$("head").find('#1730706741967').length && vwo_$('head').append(_vwo_sel);}catch(e) {console.error(e)}
try{}catch(e) {console.error(e)}
try{if(document.documentElement.classList.contains("vwo_p_s_a192231b2113d157699dea212968af5a")){var currentURL=window.location.href.split("?").pop(),clickURL="https://buy.greateasternlife.com/sg/en/personal-accident-insurance/200201/get-quotation.html?campCode=C8DISC&template=post";$("#gpabuynow").on("click",(function(){window.location.href=clickURL+"&"+currentURL}))}}catch(e) {console.error(e)}
return vwo_$('head')[0] && vwo_$('head')[0].lastChild;})("head")}}, C_722219_965_1_2_3:{ fn:function(log,nonce=''){return (function(x) {
try{
var _vwo_sel = vwo_$("`);
!vwo_$("head").find('#1730706741968').length && vwo_$('head').append(_vwo_sel);}catch(e) {console.error(e)}
try{}catch(e) {console.error(e)}
try{if(document.documentElement.classList.contains("vwo_p_s_117ea7d82ad4208c01b4c082cbb1dcbe")){var currentURL=window.location.href.split("?").pop(),clickURL="https://buy.greateasternlife.com/sg/en/personal-accident-insurance/200202/get-quotation.html?template=post&campCode=C8DISC";$("#gjpbuynow").on("click",(function(){window.location.href=clickURL+"&"+currentURL}))}}catch(e) {console.error(e)}
return vwo_$('head')[0] && vwo_$('head')[0].lastChild;})("head")}}, C_722219_965_1_2_4:{ fn:function(log,nonce=''){return (function(x) {
try{
var _vwo_sel = vwo_$("`);
!vwo_$("head").find('#1730706741969').length && vwo_$('head').append(_vwo_sel);}catch(e) {console.error(e)}
try{}catch(e) {console.error(e)}
try{if(document.documentElement.classList.contains("vwo_p_s_529d06731882814587edcdb7fcb47719")){var currentURL=window.location.href.split("?").pop(),clickURL="https://buy.greateasternlife.com/sg/en/personal-accident-insurance/200203/get-quotation.html?template=post&campCode=C8DISC";$("#ggpbuynow").on("click",(function(){window.location.href=clickURL+"&"+currentURL}))}}catch(e) {console.error(e)}
return vwo_$('head')[0] && vwo_$('head')[0].lastChild;})("head")}}, 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
Update of contact details via the Great Eastern App is not applicable to Dependants' Protection Scheme policies. We'll require you to complete and submit the Update of personal particulars form.
Follow our guide to keep your contact details up-to-date so you can receive one-time passwords (OTPs) and updates to your policies.
Great Eastern App
1
Sign in to the Great Eastern App using your Singpass or Great ID.
2
Tap Services from the bottom menu.
3
Tap Personal particulars.
4
Tap Update contact details.
5
Tap Update with Singpass MyInfo button at the bottom of the screen. If you don't wish to use Singpass, tap Update manually with form.
6
Sign in with Singpass to retrieve your details.
7
Select the items you'd like to update.
8
Confirm your updated contact details are accurate, check the box to accept the terms and conditions, and tap Submit.