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.
Trigger types
Section titled “Trigger types”Immediately on page load (immediate)
Section titled “Immediately on page load (immediate)”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.
After delay (seconds) (delay)
Section titled “After delay (seconds) (delay)”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.
On scroll (% of page) (scroll)
Section titled “On scroll (% of page) (scroll)”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).
Trigger value semantics
Section titled “Trigger value semantics”The Trigger value field is hidden when Trigger type = Immediately. When Trigger type changes, the field label and validation adapt:
| Trigger type | Label | Valid range |
|---|---|---|
| Immediately on page load | (hidden) | n/a |
| After delay (seconds) | Delay (seconds) | positive number |
| On scroll (% of page) | Scroll percentage | 0–100 |
How the trigger interacts with frequency
Section titled “How the trigger interacts with frequency”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”- The page loads and the footer hook injects
[data-p2lab-stage]. - The JS plugin posts to
/p2lab-stage/resolvewith the page context. - The backend filters by sales channel / page / rule / schedule and returns matching stages — each with its trigger config.
- For every returned popup that isn’t already suppressed by frequency, the plugin schedules it according to its trigger:
immediate→_show()called right awaydelay→setTimeout(triggerValue * 1000)then_show()scroll→ scroll listener onwindow, fires_show()at the threshold and removes the listener
- 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.
Where to go next
Section titled “Where to go next”- Frequency — how often the same visitor sees the popup.
- Schedule — date-range gating that applies before any trigger.
- Pages — which pages the popup is eligible on.
- Storefront → How stages render — the resolve/track lifecycle.