Trigger rules — page URL, visitor properties, time on page, custom events

Updated May 22, 2026

Every Yaplet outreach campaign — banners, proactive messages, surveys, and product tours — shares one trigger engine. You define three things: when to fire (the trigger event), where to fire (page rules), and who should see it (visitor conditions). All three are optional; omit any of them and that dimension is unrestricted.

Trigger events

A trigger event is what causes Yaplet to evaluate whether a campaign should show. Pick one per campaign:

Event When it fires Typical use
Session start Once per visitor session. A session resets after 3 hours of inactivity. Welcome messages, first-visit tours, onboarding surveys.
Page view Every time the visitor navigates to a page (including the first load). Combine with page rules to restrict to specific URLs. Page-specific banners, product tour on the /dashboard page, NPS after visiting /settings.
Custom event When your app calls Yaplet.trackEvent("your-event"). Evaluates the campaign at that exact moment. Post-purchase survey, onboarding tour after first project created, churn-risk banner for inactive users.

Adding a delay

On any trigger event you can add a delay in seconds. The campaign will wait that long after the event fires before showing. This prevents campaigns from interrupting visitors the instant a page loads.

Custom event — "Always trigger" mode

By default a custom event respects your frequency cap — if a visitor already saw the campaign, the event won't fire it again. If you want the event to always show the campaign regardless of history (for example, a "Show tour" button in your UI), switch the custom event to Always trigger. This bypasses the frequency cap entirely for that event.

Page rules

Page rules filter the trigger to a specific URL or set of URLs. Add one or more rules; they combine with AND logic by default (every rule must match). Switch the group to OR if you want any matching rule to qualify.

Operator Example Matches
equals https://app.example.com/dashboard Exact URL match only.
contains /pricing Any URL that includes that string anywhere.
starts with https://app.example.com/ Any URL beginning with that prefix.
ends with /checkout Any URL ending with that suffix.
glob pattern https://app.example.com/projects/*/settings * matches any single path segment. Useful for dynamic IDs.
regex ^https://app\.example\.com/(dashboard|home)$ Full ECMAScript regular expression. For complex multi-path rules.

Time on page

Add a time on page rule to only trigger the campaign after the visitor has spent a minimum number of seconds on the current page. Unlike the delay on the trigger event (which is a one-time wait), the time-on-page counter resets every time the visitor navigates to a new page.

Example: trigger after 30 seconds on any page matching /pricing — only visitors who've read the page long enough qualify.

Visitor conditions

Visitor conditions let you restrict a campaign to a specific audience segment. Add one or more conditions; combine them with AND (every condition must be true) or OR (any one condition qualifies).

Attribute What it tests
Country Visitor's detected country (GeoIP). Useful for locale-specific campaigns.
Plan The plan string you pass in Yaplet.identify({ plan: "pro" }). Target trial vs. paid users.
Email The visitor's email, set via Yaplet.identify().
External ID Your internal user ID, set via Yaplet.identify().
Name Visitor's display name from Yaplet.identify().
First seen When the visitor first used the widget. Test against a date to target new vs. old visitors.
Last seen The most recent session. Target visitors who haven't been back in a while.
Session count Total number of sessions. session_count = 1 means the very first visit.
Custom attributes Any key–value pair you pass in Yaplet.identify({ myKey: "myValue" }). Unlimited custom fields.

Each condition supports comparison operators: equals, not equals, greater than, less than, contains, not contains, and (for dates) before / after.

How the rules combine

When you have multiple rules in a group, they all use the same AND/OR toggle at the top of the group. You can also nest groups — for example: (country = Germany OR country = Austria) AND plan = trial.

Weight and prioritisation

If multiple campaigns of the same type qualify for the same visitor at the same moment, Yaplet picks the one with the highest weight value. You set the weight when creating the campaign. Only one banner, one message, one survey, and one tour can trigger per event — they don't stack.

What's next?

Now that you understand trigger rules, set how often a campaign repeats with Frequency caps, or go back to the specific format you're working with: proactive messages, banners, tours, or surveys.

Did this article answer your question?