JavaScript API
Triggers cover most popups: a delay, exit intent, scrolling, or an idle visitor. When your own code should decide instead, such as after a button click or a finished checkout, show the popup with window.pupop.
Before you start
The page needs your site's embed snippet, from the Install section of the site's settings in the dashboard. The snippet loads asynchronously, so window.pupop exists only once it has run. Call it from an event handler, or guard the call with window.pupop?. as below.
window.pupop.show(popupId)
Shows a published popup straight away, whatever its triggers, pages, devices and frequency. A popup already on screen closes first. Stats count the showing under the Script trigger, like any other.
document.querySelector("#talk-to-sales").addEventListener("click", () => {
window.pupop?.show("c2b0042c-b111-4730-90c3-a80adb9ed71e");
});Find the popup id in the popup editor's Settings tab, under Show from your code, which can also copy the call for you. A draft, an unpublished popup, or an id from another site shows nothing. A call made before the site's popups have loaded waits for them.
A popup with no triggers only ever shows this way. That suits popups that belong to a step in your own flow.
window.pupop.hide()
Closes the popup on screen, if there is one, and cancels a show still waiting for the popups to load. Closing this way isn't counted as the visitor dismissing it.
When something goes wrong
Neither call ever throws. If the snippet is missing, the site is paused, or the id doesn't match a live popup, nothing happens and your page carries on.
