Articles on: Where Notifications Appear

URL pattern targeting: Using Regex for advanced targeting

Use regular expressions (Regex) to target specific URLs or page patterns. This advanced feature lets you show notifications on custom pages, specific collections, or any URL pattern you define.


Use "Specific Pages (Regex)" option and enter a regular expression pattern to match URLs. Useful for targeting specific collections, products, or custom pages.


Advanced Feature: Regex requires some technical knowledge. Start with standard page options first, only use regex if you need it.



What is Regex


  • Regular expression = pattern matching for URLs
  • Advanced feature for precise page targeting
  • Requires some technical knowledge
  • Very powerful for specific needs


Common Patterns


All Product Pages:

^/products/.*
  • Matches: /products/iphone-14, /products/laptop, etc.


Specific Collection:

.*/collections/sale.*
  • Matches: /collections/sale, /collections/sale-summer, etc.


Multiple Collections:

.*/collections/(sale|clearance|new).*
  • Matches: sale, clearance, or new collections


Specific Product:

^/products/iphone-14$
  • Matches: Only /products/iphone-14 (exact match)


Pages Containing Word:

.*sale.*
  • Matches: Any URL with "sale" in it


Testing Your Pattern


  • Use online regex testers
  • Test with actual URLs from your store
  • Verify it matches what you want
  • Be careful: Wrong pattern = no notifications


Common Mistakes:
  • Forgetting .* for wildcards
  • Using wrong anchors (^ and $)
  • Not escaping special characters
  • Testing in admin instead of storefront


When to Use


Use Case

Use Regex?

Alternative

Need very specific page targeting

✅ Yes

Standard options

Targeting custom pages

✅ Yes

N/A

Multiple specific collections

✅ Yes

Create multiple campaigns

Simple page types

❌ No

Use dropdown instead

Not familiar with regex

❌ No

Use standard options


Next Steps:

  • Start with standard page options first
  • Only use regex if you need it
  • Test thoroughly before going Live
  • See "How do I show notifications on specific pages?" for basics


Updated on: 03/01/2026

Was this article helpful?

Share your feedback

Cancel

Thank you!