Skip to content

Triggers

The trigger answers a simple question: at what point during the visitor’s time on the page does the popup appear? Three trigger types, configured on the stage’s Overview tab in the Trigger card.

The default. The popup is scheduled the moment the page is ready (DOMContentLoaded). No delay, no scroll dependency.

Pick this when you want maximum visibility — sale announcements, important notices, cookie banners that need consent before the visitor interacts. The downside is interruption: visitors see it before they’ve engaged with the page.

The popup is scheduled with setTimeout(triggerValue * 1000) after the page is ready. The Trigger value field becomes a number input labeled Delay (seconds).

Pick this when you want the visitor to settle in before being interrupted — typically 5–15 seconds. Common pattern: newsletter prompts, lead magnets, exit-style nudges.

The popup is scheduled when the visitor has scrolled past triggerValue% of the page (computed against document.documentElement.scrollHeight minus viewport height). The Trigger value field becomes a number input labeled Scroll percentage, accepting 0–100.

Pick this when popping up should signal engagement — the visitor scrolled past the hero, so they’re interested enough to deserve the offer. Common values: 30% (page started), 50% (page mid), 80% (page bottom — last-chance prompt).

The Trigger value field is hidden when Trigger type = Immediately. When Trigger type changes, the field label and validation adapt:

Trigger typeLabelValid range
Immediately on page load(hidden)n/a
After delay (seconds)Delay (seconds)positive number
On scroll (% of page)Scroll percentage0–100

The trigger schedules when the popup would fire. Frequency (Targeting → Frequency) then decides whether it actually fires for this visitor or whether they’ve already used up their session / N-day window / permanent dismissal.

In other words: the trigger says “now is the time”, frequency says “yes, this visitor is eligible”. Both must pass before the popup mounts and the impression event fires.

How the trigger interacts with the storefront engine

Section titled “How the trigger interacts with the storefront engine”
  1. The page loads and the footer hook injects [data-p2lab-stage].
  2. The JS plugin posts to /p2lab-stage/resolve with the page context.
  3. The backend filters by sales channel / page / rule / schedule and returns matching stages — each with its trigger config.
  4. For every returned popup that isn’t already suppressed by frequency, the plugin schedules it according to its trigger:
    • immediate_show() called right away
    • delaysetTimeout(triggerValue * 1000) then _show()
    • scroll → scroll listener on window, fires _show() at the threshold and removes the listener
  5. On _show(), the impression event is recorded and the popup mounts.

If the visitor closes the popup before the engine considers it shown (e.g. they navigate away before the delay fires), no impression event is recorded.