MCP’s global exit intent pop up template fires when a user indicates they are about to leave a desktop website. To change this pop up to appear after a delay instead, use pageElementLoaded
with a timeout.
function apply(context, template) {
if (!context.contentZone) return;
return SalesforceInteractions.DisplayUtils
.bind(buildBindId(context))
// Wait until an element in the dom has loaded
.pageElementLoaded(".hero-section")
.then(() => {
if (SalesforceInteractions.cashDom("#evg-exit-intent-popup").length > 0) return;
setTimeout(function () {
const html = template(context);
SalesforceInteractions.cashDom("body").append(html);
// Other template code
}, 3000);
});
}
Tracking
To capture interactions in a custom built Web Template, add CampaignStat tracking to the Clientside tab. E.g. in the setDismissal
click function:
// Track dismissal
const trackDismissal = {
experienceId: context.experience,
control: false,
stat: "Dismissal"
};
SalesforceInteractions.mcis.sendStat({ campaignStats: [trackDismissal] });