Overview
Exit triggers let you show popups after a user leaves a specific route. Unlike traditional exit intent that blocks navigation, these popups appear on the destination page after a configured delay. This is perfect for “before you go” or “how was your experience” feedback flows that don’t interrupt the user’s navigation.How Exit Triggers Work
User is on a matching route
The SDK monitors navigation and checks if the current route matches a popup’s
segments.path configuration.User navigates away
When the user leaves the matching route (via anchor click, hash navigation, or
history.pushState), the SDK queues the exit popup.Pending exit popups are stored in
sessionStorage until they’re shown or discarded.Basic Example
Here’s how the demo website (examples/index.html → examples/product.html) implements exit popups:
Popup Definition for Exit Triggers
Configure an exit popup in your Deepdots dashboard or client-mode definition:Key Properties
| Property | Description |
|---|---|
triggers.type | Set to "exit" |
triggers.value | Delay in seconds after navigation |
segments.path | Routes where exit should be monitored |
The
value is the delay after navigation completes, not during navigation.Navigation Support
Exit triggers work with all common navigation patterns:- Anchor Links
- Hash Routing
- History API
Path Matching
Thesegments.path array supports multiple formats:
Path matching is exact. Use separate entries for paths with and without trailing slashes if needed.
Complete Working Example
Here’s a full implementation with exit tracking:demo-sdk.js
Use Cases
Page Feedback
Ask “How helpful was this page?” after users navigate away
Feature Discovery
Show tips about features on the next page after leaving
Content Rating
Request article ratings after users finish reading
Exit Survey
Gather feedback when users leave critical flows
Testing Exit Popups
Check SessionStorage
Open DevTools → Application → Session StorageLook for keys like:
deepdots_pending_exit_popupsdeepdots_survey_states
Navigate Between Routes
- Visit a page with an exit trigger configured
- Navigate to a different page
- Wait for the configured delay
- The popup should appear
Advanced: Client Mode with Exit Triggers
You can test exit popups locally without an API:Common Issues
Popup doesn't show after navigation
Popup doesn't show after navigation
Popup shows too early/late
Popup shows too early/late
The
triggers.value is in seconds, not milliseconds:Path matching not working
Path matching not working
Remember:
- Paths are exact match (case-sensitive)
- Include both
/pageand/page/if needed - Hash routes need the
#prefix:"/#/home"
API Reference
Exit Trigger Schema
Best Practices
- Keep delays short: 2-5 seconds is ideal. Users forget context quickly.
- Use cooldowns: Don’t show exit popups on every navigation.
- Target specific routes: Only monitor high-value pages.
- Test across browsers: Different browsers handle history API slightly differently.
- Monitor sessionStorage: Exit state persists across page loads in the same tab.
Next Steps
Basic Integration
Learn SDK fundamentals and setup
Business Events
Trigger popups from application logic