Skip to main content

Triggers & Targeting

Control when the widget appears and who sees it.

How Triggers Work


Trigger Options

Configure when the widget should appear.

Delay Trigger

Show after a specified delay:

<pollarix-widget
collector-id="YOUR_ID"
api-key="YOUR_KEY"
delay="5000"
></pollarix-widget>

Scroll Depth Trigger

Show when user scrolls to a percentage of the page:

<pollarix-widget
collector-id="YOUR_ID"
api-key="YOUR_KEY"
scroll-depth="50"
></pollarix-widget>

Page Views Trigger

Show after the user has visited a number of pages in the session:

<pollarix-widget
collector-id="YOUR_ID"
api-key="YOUR_KEY"
page-views="3"
></pollarix-widget>

Exit Intent Trigger

Show when the user appears to be leaving the page:

<pollarix-widget
collector-id="YOUR_ID"
api-key="YOUR_KEY"
exit-intent="true"
></pollarix-widget>
Exit Intent Detection

The widget uses multiple signals to detect exit intent:

  • Mouse moving toward browser chrome (desktop)
  • Tab switching
  • Rapid scroll toward top of page
  • Extended idle time

Custom Event Trigger

Show when a custom JavaScript event fires:

<pollarix-widget
collector-id="YOUR_ID"
api-key="YOUR_KEY"
on-event="checkout-complete"
></pollarix-widget>

Combining Triggers

You can combine multiple triggers. The widget shows when any trigger fires:

widget.configure({
triggers: {
delay: 10000, // After 10 seconds
scrollDepth: 75, // OR after 75% scroll
exitIntent: true, // OR on exit intent
}
});

Targeting Rules

Control which users and pages see the widget.

URL Matching

Show only on specific URLs:

<pollarix-widget
collector-id="YOUR_ID"
api-key="YOUR_KEY"
url-match="/checkout/*"
></pollarix-widget>

URL Exclusion

Hide on specific URLs:

widget.configure({
targeting: {
urlExclude: '/admin/*'
}
});

URL Pattern Syntax

PatternMatches
/checkoutExact match
/checkout/*/checkout/ and one segment after
/checkout/**/checkout/ and any path after
**/successAny URL ending in /success

Device Targeting

Target specific device types:

<pollarix-widget
collector-id="YOUR_ID"
api-key="YOUR_KEY"
device="desktop"
></pollarix-widget>
ValueDescription
allAll devices (default)
desktopDesktop browsers only
mobileMobile devices only

Frequency Capping

Prevent survey fatigue by limiting how often users see the widget.

widget.configure({
frequency: {
minDaysBetween: 90, // Wait 90 days between displays
maxShowsPerUser: 3, // Show maximum 3 times ever
}
});

Testing with Force Show

During development, bypass frequency capping:

<pollarix-widget
collector-id="YOUR_ID"
api-key="YOUR_KEY"
force-show="true"
></pollarix-widget>

Clearing Throttle Data

Reset frequency data for testing:

// Via widget instance
widget.clearThrottle();

// Via global API
window.Pollarix.clearThrottle();

Complete Targeting Example

widget.configure({
// Show after 5 seconds OR on checkout pages
triggers: {
delay: 5000,
onEvent: 'checkout-complete',
},

// Only on product and checkout pages, not admin
targeting: {
urlMatch: '/products/**,/checkout/**',
urlExclude: '/admin/**',
device: 'all',
},

// Limit to once every 30 days, max 2 times
frequency: {
minDaysBetween: 30,
maxShowsPerUser: 2,
},
});

Trigger Reference

TriggerHTML AttributeJS PropertyDescription
Delaydelaytriggers.delayMilliseconds to wait
Scrollscroll-depthtriggers.scrollDepthPercentage (0-100)
Page Viewspage-viewstriggers.pageViewsNumber of pages
Exit Intentexit-intenttriggers.exitIntentBoolean
Custom Eventon-eventtriggers.onEventEvent name string

Targeting Reference

RuleHTML AttributeJS PropertyDescription
URL Matchurl-matchtargeting.urlMatchGlob pattern
URL Excludeurl-excludetargeting.urlExcludeGlob pattern
Devicedevicetargeting.deviceDevice type

Next Steps

Was this page helpful?