This guide covers both URL Contains and Pages (Wildcards) restrictions in the PopMate WHMCS addon module.
1. Overview
PopMate provides two different URL restriction methods that work together to provide precise control over when popups are displayed:
- URL Contains - Simple phrase matching for basic targeting
- Pages (Wildcards) - Advanced wildcard pattern matching for precise targeting
Tip: Both restrictions use AND logic - if both are set, both must pass for the popup to show.
2. URL Contains Restriction
How It Works
- Simple substring matching using
stripos()
(case-insensitive) - Single value - one phrase per restriction
- Searches anywhere in the current URL
Syntax
Text to search for in URL
Examples
URL Contains Setting | Current URL | Result |
---|---|---|
cart.php |
https://domain.com/cart.php |
✅ SHOW |
cart.php |
https://domain.com/cart.php?promo=SAVE20 |
✅ SHOW |
invoices |
https://domain.com/clientarea.php?action=invoices |
✅ SHOW |
products |
https://domain.com/clientarea.php?action=products&id=123 |
✅ SHOW |
support |
https://domain.com/clientarea.php |
❌ HIDE |
Use Cases
- Simple targeting: Show popup on any page containing "cart.php"
- Keyword matching: Show popup on pages with "invoices" in URL
- Quick setup: Easy to configure for basic needs
3. Pages (Wildcards) Restriction
How It Works
- Advanced pattern matching with wildcard support
- Multiple values separated by commas
- Three types of patterns with different matching logic
Syntax
*action=invoices, cart.php, /
Pattern Types
A. Wildcard Patterns (*pattern
)
- Starts with
*
followed by the pattern to match - Matches if the pattern appears anywhere in the URL
- Case-insensitive matching
Examples:
*action=invoices → Matches URLs ending with "action=invoices" *action=quotes → Matches URLs ending with "action=quotes" *clientarea.php → Matches URLs containing "clientarea.php" *cart.php → Matches URLs containing "cart.php"
B. Main Page Only (/
)
- Special pattern for homepage only
- Universal detection - works on any WHMCS installation
- Matches homepage regardless of installation path
Examples:
/ → Matches homepage on any installation: - domain.com/ - domain.com/whmcs/ - whmcs.domain.com/
C. Exact Page Matching
- No wildcard - exact substring matching
- Works like URL Contains but within the Pages system
Examples
Pages Setting | Current URL | Result |
---|---|---|
*action=invoices |
https://domain.com/clientarea.php?action=invoices |
✅ SHOW |
*action=invoices |
https://domain.com/clientarea.php?action=quotes |
❌ HIDE |
*action=invoices, *action=quotes |
https://domain.com/clientarea.php?action=invoices |
✅ SHOW |
*action=invoices, *action=quotes |
https://domain.com/clientarea.php?action=quotes |
✅ SHOW |
/ |
https://domain.com/ |
✅ SHOW |
/ |
https://domain.com/clientarea.php |
❌ HIDE |
cart.php, *action=invoices |
https://domain.com/cart.php |
✅ SHOW |
4. How Both Work Together
Logic
Both restrictions use AND logic:
- If both are set, both must pass for popup to show
- If only one is set, that one must pass
- If neither is set, no URL restriction applies
Example Scenarios
Scenario 1: Both Set
URL Contains: "clientarea.php" Pages: "*action=invoices" Current URL: "https://domain.com/clientarea.php?action=invoices"
Result: ✅ SHOW (both pass)
Scenario 2: Both Set - One Fails
URL Contains: "cart.php" Pages: "*action=invoices" Current URL: "https://domain.com/clientarea.php?action=invoices"
Result: ❌ HIDE (URL Contains fails)
Scenario 3: Only URL Contains Set
URL Contains: "invoices" Pages: (empty) Current URL: "https://domain.com/clientarea.php?action=invoices"
Result: ✅ SHOW (URL Contains passes)
Scenario 4: Only Pages Set
URL Contains: (empty) Pages: "*action=invoices" Current URL: "https://domain.com/clientarea.php?action=invoices"
Result: ✅ SHOW (Pages passes)
5. Admin Interface Usage
URL Contains Field
- Type: Single text input
- Placeholder:
e.g., cart.php, invoices, products
- Help: "Show popup only on pages containing this text anywhere in the URL (single phrase only)"
Pages Field
- Type: Single text input
- Placeholder:
e.g., *action=invoices, cart.php, /
- Help: "Provide specific wildcard URLs where the popup should be available. Use comma to separate multiple pages. Supports: *pattern (wildcard), / (main page), exact (no wildcard)"
6. Best Practices
When to Use URL Contains
- Simple targeting: Basic phrase matching
- Quick setup: Easy to configure
- Single pattern: One specific text to match
When to Use Pages (Wildcards)
- Precise targeting: Specific URL patterns
- Multiple pages: Targeting several related pages
- Complex patterns: Advanced URL matching
- Homepage targeting: Main page only
When to Use Both
- Extra precision: Double-check URL matching
- Fallback logic: URL Contains as backup for Pages
- Complex scenarios: Multiple targeting requirements
7. Real-World Examples
Marketing Campaigns
URL Contains: "cart.php" Pages: "*action=checkout" Description: Show promotional popup only on cart and checkout pages
Service Notifications
URL Contains: "invoices" Pages: "*action=invoices" Description: Show payment reminder only on invoice pages
Homepage Welcome
URL Contains: (empty) Pages: "/" Description: Show welcome popup only on homepage
Product Promotions
URL Contains: "products" Pages: "*action=products" Description: Show product promotions on product pages
Support Pages
URL Contains: "support" Pages: "*action=support, *action=knowledgebase" Description: Show help popup on support and knowledgebase pages
8. Troubleshooting
Common Issues
Issue: Popup not showing on homepage
Solution: Use Pages field with
/
for universal homepage detectionIssue: Popup showing on wrong pages
Solution: Use Pages (Wildcards) for more precise targeting instead of URL Contains
Issue: Multiple patterns not working
Solution: Ensure patterns are separated by commas in Pages field