It is possible to close a popup from your code, without user interaction, through the Wisepops' JS Callbacks feature.

Let's say we want our popup to be closed 5 minutes after being displayed, if not closed before by the visitor

Create a Before-popup-display Callback

Go to the JS section, and paste the following callback that is triggered on the Before popup display event:

// Automatically close the popup after a delay
var delay = 5 * 60 * 1000; // 5 mins
setTimeout(function () {
}, delay);

The event.detail.popup object is available only when listening to the Before popup display event. It exposes various methods, including one to close the popup.

Here we used the Wisepops interface to add the JS callbacks. You might want to write this code on your own website instead (to make it work on multiple popups or to inject back-end variables). Please refer to this article to learn how to do so.

Did this answer your question?