Skip to main content

Popups & Exit-Intent Builder

Goal​

Show a targeted overlay on the storefront and measure whether it worked. Popups are stored as records with their own content, design, trigger set and targeting rules; the storefront asks the plugin which popups apply to the current page and renders them. Displays and conversions are logged, and two variants of the same popup can be run against each other.

Tier and entitlement​

FieldValue
TierPremium
Entitlement keypopups
Admin tabpopups
Module keypopups
Settings prefixaiowc_pop_

Hooks register only when aiowc_module_enabled_popups is true and the licence permits the popups entitlement.

What the code does​

  • Popup records with a name, type, content, design payload, trigger list, targeting rules and a status that defaults to draft.
  • Six trigger types, whitelisted in Service/TriggerService.php: exit_intent, time_delay, scroll_depth, click, page_load and inactivity. Each trigger may carry an integer value — seconds for a delay or an inactivity window, a percentage for scroll depth.
  • Targeting evaluated server-side in Service/TargetingService.php against five rule groups: page URL fragments, product or post categories, device, user role, and excluded paths. Exclusions are applied before inclusions, so an excluded path always wins.
  • Cart and checkout suppression: when disable_on_cart_checkout is on, any URL containing /cart or /checkout short-circuits before the rules are read.
  • Display and conversion logging against a caller-supplied session ID.
  • A/B tests: variants attached to a popup, with a daily job that picks a winner using a normal-approximation z-test for proportions at a confidence threshold of 0.95, and ends the losing variants.

Settings​

Read through ModuleSettings with the aiowc_pop_ prefix; defaults are PopupsModule::DEFAULTS.

SettingDefaultMeaning
enable_popupstrueMaster switch for storefront rendering
disable_on_cart_checkouttrueSuppresses every popup on cart and checkout URLs
enable_mobile_popupstrueWhether popups are eligible on mobile devices
frequency_days7Days before the same visitor is shown a popup again
max_popups_per_session1Cap on popups shown in one visitor session

Admin screen​

Admin tab popups. The screen manages the popup list and the builder — content, design, triggers and targeting rules — and reads the per-popup analytics endpoint.

Database schema​

Created by Schema/PopupsSchema.php at schema version 1.0.0.

TableHolds
{prefix}aiowc_popupsThe popup itself: name, popup_type, content, design, triggers, rules, status
{prefix}aiowc_popup_displaysOne row per display, used for impression counts
{prefix}aiowc_popup_conversionsOne row per conversion, with a type and an optional data payload
{prefix}aiowc_popup_ab_testsVariants belonging to a popup, with their end timestamp

content, design, triggers and rules are stored as JSON text.

REST endpoints​

Namespace aiowc/v1. All responses use the shared envelope.

Management​

Permission: manage.

MethodPathPurposeRequired args
GET/popupsList popups, filterable by status and popup_type, paginated—
POST/popupsCreate a popup—
GET/popups/{id}Read one popupid
PUT / PATCH / POST/popups/{id}Update a popupid
DELETE/popups/{id}Delete a popupid
POST/popups/{id}/ab-testAdd an A/B variantid, variant_name
GET/popups/{id}/analyticsImpressions, conversions and variant figuresid

Storefront​

MethodPathPurposeRequired argsPermission
GET/popups/activePopups matching the current url, post_id and device—Rate-limited public read
POST/popups/{id}/displayLog a displayid, session_idPublic write check
POST/popups/{id}/convertLog a conversionid, session_id, conversion_typePublic write check

WordPress and WooCommerce integration​

HookEffect
wp_enqueue_scriptsLoads the popup assets
wp_footerPrints the bootstrap payload the client script reads

The module does not hook any WooCommerce order, product or email action, and registers no shortcode and no block. Its only WooCommerce-specific behaviour is the cart and checkout URL suppression above.

Emitted action​

ActionFired when
aiowc_popup_ab_winner_pickedThe daily job selects a winning variant; receives the popup ID and the winning variant ID

Background jobs​

Both run on the WordPress cron scheduler, daily.

HookPurpose
aiowc_popups_cleanupPrunes display rows older than 30 days. The retention window is a constant, not a setting
aiowc_popups_ab_winnerScans running A/B tests and ends the losers once a variant reaches 0.95 confidence

Entitlement limits​

The popups entitlement gates the module as a whole. The per-visitor caps — frequency_days and max_popups_per_session — are settings, not licence limits, and the module imposes no cap on how many popups may exist.