// バリアントごとに固有のCSSを適用して、他の要素のスタイリングに影響を与えないようにしています。
var compiledCSS = Engage.templating.compile(variant.assets.css)(variant);
var styleTag = document.getElementById('style-' + variant.ref);
styleTag.innerHTML = compiledCSS;
// End Adds a unique variant identifier to CSS when deployed to ensure CSS does not impact styling of other elements.
// bodyタグの前にHTMLを挿入することで、メールキャプチャバーのためのスペースを作ります。
insertHTMLBefore('body', 'pers-');
document.querySelector("#pers-"+variant.ref+ " #pers_TopBanner").style.display = "none";
const scrollPercentageInput = [[Scroll Percentage | enum(0,25,50,100)| 0 |{group: General, groupOrder: 1, order: 2}]]
if (scrollPercentageInput > 0) {
window.addEventListener('scroll', currentScrollPercentage);
// 現在のスクロールパーセンテージを計算し、バーを表示
function currentScrollPercentage()
const scrollPercentage = Math.round((document.documentElement.scrollTop + document.body.scrollTop) / (document.documentElement.scrollHeight - document.documentElement.clientHeight) * 100);
if (scrollPercentage > scrollPercentageInput){
window.removeEventListener('scroll', currentScrollPercentage);
document.querySelector("#pers-"+variant.ref+ " #pers_TopBanner").style.display = "block";
document.body.classList.add("show-TopBanner");
document.querySelector("#pers-"+variant.ref+ " #pers_TopBanner").style.display = "none";
document.body.classList.remove("show-TopBanner");
function showThankYou() {
document.querySelector("#pers-"+variant.ref+ " #pers-thank_you_modal").style.display = "flex";
function dismissThankYou() {
document.querySelector("#pers-"+variant.ref+ " #pers-thank_you_modal").style.display = "none";
const persSubmitPress = document.querySelector("#pers-"+variant.ref+ " #pers-modal_button");
const persThankYouClose = document.querySelector("#pers-"+variant.ref+ " #pers-thank_you_close");
const persThankYouBackdrop = document.querySelector("#pers-"+variant.ref+ " #pers-thank_you_backdrop");
const persCloseButtonPress = document.querySelector("#pers-"+variant.ref+ " #pers_TopBanner-close");
const persThankYou = document.querySelector("#pers-"+variant.ref+ " #pers-thank_you_modal");
function sendInteractionToPersonalize(eventType) {
"pointOfSale": Engage.settings.pointOfSale,
"interactionID": "OOB_EXP",
"interactionName": "EMAIL_BAR_SCROLL"
window.engage.event(eventType, eventData);
function sendIdentityEvent() {
"pointOfSale": Engage.settings.pointOfSale,
"email": document.getElementById("pers-email_input").value,
"id": document.getElementById("pers-email_input").value,
window.engage.identity(eventData);
persSubmitPress.onclick = function() {
if (document.getElementById("pers-email_input").value.length > 0) {
sendInteractionToPersonalize("INTERACTION_IDENTITY");
persCloseButtonPress.onclick = function() {
sendInteractionToPersonalize("INTERACTION_DISMISSED");
persThankYouClose.onclick = function() {
persThankYouBackdrop.onclick = function() {