Skip to content

Black Friday 50% off your first year on all premium plugins and the Suite.

See the deals

Divi Smart Popup: Hooks and filters

Divi Smart Popup’s JavaScript API (D5PE.open, close, convert), its d5pe:open, d5pe:close and d5pe:convert events, and markup classes.

2 min read · Updated 5 November 2026

PHP actions and filters

Divi Smart Popup is mostly extended in the browser, with the API and events below. On the server it has one action and one filter, both about page caches (since 2.1.4):

  • do_action( 'd5pe_purge_page_cache', $reason ) runs when a live popup is switched on, edited, switched off or deleted ($reason is popup_changed), and when a scheduled campaign starts or ends (schedule). Hook it to clear a server, host or CDN cache the plugin does not know.
  • apply_filters( 'd5pe_purge_page_cache_enabled', true, $reason ): return false to stop Divi Smart Popup asking page caches to clear.

Everything else is extended in the browser.

JavaScript API

On pages where at least one popup is printed, window.D5PE is available:

  • D5PE.open( id ) — opens the popup. Explicit, so it ignores frequency rules and site-wide limits. Closes an open modal-style popup first if both are modal-style.
  • D5PE.close( id ) — closes it, as the close button would.
  • D5PE.convert( id ) — records a conversion and runs the popup’s After a conversion action. Use it for forms Divi Smart Popup cannot see, such as a multi-step form that finishes in an iframe.

The ID is the number shown on the popup’s Design step. A popup that is not printed on the page (inactive, or not targeted there) is ignored.

Events

Dispatched on document as CustomEvents, with the popup ID in event.detail.id:

  • d5pe:open — after a popup opens.
  • d5pe:close — when a popup starts closing.
  • d5pe:convert — when a conversion is recorded.

Markup

  • href="#d5pe-open-{ID}" or class d5pe-open-{ID} — opens that popup.
  • href="#d5pe-close" or class d5pe-close — closes the popup it is in.
  • class d5pe-dismiss — closes it and never shows it to that visitor again.
  • Extra CSS classes and Elements that close the popup on the Advanced step.

Example: send conversions to your analytics

document.addEventListener( 'd5pe:convert', function ( e ) {
	if ( window.gtag ) {
		window.gtag( 'event', 'popup_conversion', { popup_id: e.detail.id } );
	}
} );

Load your script after the page, for example in Divi → Theme Options → Integration. In previews and test mode nothing is counted in the statistics, but the events still fire.

Did this answer the question? No — open a support request