Route targeting allows you to show popups only on specific pages or routes in your application. The SDK uses theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/MagicFeedback/deepdots-popup-sdk/llms.txt
Use this file to discover all available pages before exploring further.
segments.path field to match the current URL against your targeting rules.
How Route Targeting Works
When a popup definition includessegments.path, the SDK evaluates the current route before showing the popup:
- User navigates to a page
- SDK checks if the current URL matches any path in
segments.path - Popup shows only if there’s a match and conditions are met
segments.path is the only segment currently evaluated by the SDK runtime. Other segment fields may be used for organization but won’t affect popup display.Basic Path Matching
Homepage
Target the root path:- ✅
https://example.com/ - ✅
https://example.com(trailing slash optional) - ❌
https://example.com/about
Specific Pages
Target named routes:- ✅
https://example.com/pricing - ✅
https://example.com/features - ✅
https://example.com/contact - ❌
https://example.com/about
Hash Routes
Support single-page applications with hash routing:- ✅
https://example.com/#/home - ✅
https://example.com/#/dashboard - ❌
https://example.com/#/profile
Path Matching Rules
The SDK normalizes and compares URLs using these rules:Full URL Matching
If the path starts withhttp:// or https://, it’s matched as a complete URL:
- ✅ Exact match required
- ❌ Won’t match
http://example.com/pricing(protocol must match) - ❌ Won’t match
https://other.com/pricing(domain must match)
Path Fragment Matching
If the path starts with/, it’s matched as a path fragment:
- ✅ Matches if the current URL contains the path
- ✅ Works with any domain
- ✅ Example:
https://example.com/pricing
Relative Path Matching
If the path doesn’t start withhttp://, https://, or /, it’s matched against the pathname:
- ✅ Matches the pathname exactly
- ✅ Example: If pathname is
pricing, it matches - ❌ Won’t match
/pricingor/pages/pricing
URL Normalization
The SDK normalizes URLs before comparison:Trailing Slashes
Removed from the end of URLs:index.html
Removed from URLs:Advanced Examples
Multiple Pages
Target several related pages:Hash Route Application
Target specific views in a single-page app:Combining Full URLs and Paths
Mix different path types:No Path = All Routes
If you don’t specifysegments.path, the popup can appear on any route:
Exit Popups and Route Targeting
For exit triggers,segments.path specifies the source routes to watch:
Source Code Reference
Path matching logic is insrc/core/deepdots-popups.ts:247-283:
Debugging Path Matching
Enable debug mode to see path matching logs:- Current pathname and href
- Candidate paths being evaluated
- Whether each path matched
- Why popups were blocked
Common Patterns
Onboarding flows
Onboarding flows
Target welcome and setup pages:
E-commerce checkout
E-commerce checkout
Target conversion funnel pages:
Content pages
Content pages
Target blog or documentation:
Dashboard sections
Dashboard sections
Target specific app features:
Limitations
To target multiple related pages, list them explicitly:Best Practices
Be specific
Be specific
Target pages where feedback is most valuable:
Group related routes
Group related routes
Test hash routes carefully
Test hash routes carefully
Ensure hash routes include the
#:Use debug mode
Use debug mode
Verify path matching during development:
Next Steps
Exit Popups
Use route targeting with exit triggers
Event Triggers
Combine routes with business events
Server Mode
Manage route targeting remotely
Client Mode
Define route targeting inline