You can use below code for Mailercloud webform customization
1. How to add delay on a pop-up form when embedding it on a website?
<script charset="utf-8" type="text/javascript" src="https://js.mailercloud.com/popup/form.js"></script>
<script>
var delayInMilliseconds = 2000; //2 second (You can customise this variable for delay)
setTimeout(function() {
(function() { mcpopup.create({ formId: "YndGVUAxMjQwOEAwMDAwMA==" }) })();
}, delayInMilliseconds);
</script>
2. Can I set the pop-up form to be displayed only when the user scrolls to the bottom of the page?
<script charset="utf-8" type="text/javascript" src="https://js.mailercloud.com/popup/form.js"></script>
<script>
window.onscroll = function(ev) {
if ((window.innerHeight + window.scrollY) >= document.body.scrollHeight) {
(function() { mcpopup.create({ formId: "YndGVUAxMjQwOEAwMDAwMA==" }) })();
}
};
</script>
3. How to show a popup ONCE per session?
<script charset = "utf-8" type = "text/javascript" src = "https://js.mailercloud.com/popup/form.js" > </script>
<script>
function setCookie(name, value, days)
{ var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days 24 60 60 1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/";
}
function getCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
}
var showPopup = getCookie("show_popup");
if (showPopup !== "2") {
(function() {
mcpopup.create({
formId: "YndGVUAxMjQwOEAwMDAwMA=="
})
})();
}
setCookie("show_popup", "2", 30); //set "show_popup" cookie, expires in 30 days
</script>