URL pattern matching
Learn how to use URL patterns to control when and where your content appears in your application
Overview
URL pattern matching is a powerful feature in Usertour that helps you control exactly where your content appears. You can use it to:
- Auto-start onboarding flows or product tours
- Progress to the next step based on URL changes
- Mark checklist tasks as completed when users reach certain pages
- Control where specific content appears in your application
Note: These URL pattern rules apply to Current page conditions only. For Navigate to page actions, you’ll need to use the full URL and can insert user attributes for dynamic values.
Quick Reference
Here are the key rules to remember:
- Only specify the URL parts you care about - omit the rest
- Use
-
as a wildcard to match anything - Use
:segment
to match a single dynamic segment - You can specify multiple patterns to include or exclude
Common Patterns
1. Exact Path Matching
This matches any domain with exactly this path.
✅ Matches:
https://example.com/app/dashboard
http://example.com/app/dashboard
https://other-example.com/app/dashboard
❌ Does not match:
https://example.com/app
https://example.com/app/dashboard/sub
https://example.com/app/dashboard/sub/page
2. Including Subpaths
The *
matches everything (including nothing).
✅ Matches:
https://example.com/app
https://example.com/app/projects
https://example.com/app/projects/1
https://other-example.com/app
https://example.com/applications
❌ Does not match:
https://example.com/settings
3. Only Subpaths
Note the /
before the *
.
✅ Matches:
https://example.com/app/projects
https://example.com/app/projects/1
https://other-example.com/app/projects
❌ Does not match:
https://example.com/app
https://example.com/applications
4. Dynamic Path Segments
:project
matches any single path segment (anything except /
).
✅ Matches:
https://example.com/projects/1/details
https://example.com/projects/2/details
❌ Does not match:
https://example.com/projects/1/details/edit
https://example.com/projects/1/history
5. Mixing Dynamic Segments and Subpaths
✅ Matches:
https://example.com/app/apple/projects/1
https://example.com/app/banana/projects/1
https://example.com/app/banana/projects/1/details
❌ Does not match:
https://example.com/app/apple/projects
6. Specific Domain
✅ Matches:
https://app.com/
https://app.com/any/path
❌ Does not match:
https://www.app.com/
https://not-app.com/
7. Dynamic Subdomain
✅ Matches:
https://www.app.com/
https://www.app.com/any/path
https://dashboard.app.com/
❌ Does not match:
https://app.com/
https://multiple.levels.app.com/
https://www.not-app.com/
8. Mix Domain and Path
✅ Matches:
https://dashboard.example.com/app/apple/projects
https://dashboard.example.com/app/apple/projects/1
URL Structure
Let’s break down a URL into its components:
Scheme
The part before ://
(usually http
or https
).
- Usually optional in patterns
- Only specify if you need to match a specific scheme
Domain
The part between ://
and the first /
.
Dynamic Subdomains
To match dynamic subdomains (e.g. apple.app.com
and banana.app.com
), use a colon and an arbitrary name such as :company.app.com
. :company
will match a non-empty subdomain, meaning it will not include .
. The name after :
does not matter and is currently not used for anything.
:company.app.com
and :subdomain.app.com
are equivalent and will match:
apple.app.com
banana.app.com
They will not match:
app.com
(missing subdomain)more.apple.app.com
(more subdomains)
Wildcard Domains
You can also use *
as a wildcard character to match any number of subdomains.
*.app.com
will match both one.app.com
and one.two.app.com
, but not app.com
.
*app.com
will match app.com
, but will also match myapp.com
.
Path
In a URL, the path is the part that comes after the domain and before either the query parameters (starting with ?
) or the fragment (starting with #
).
Basic Rules
- Paths MUST start with a forward slash
/
- If you omit the leading
/
(e.g.app/projects
), the system will treatapp
as a domain - The correct pattern should be
/app/projects
Dynamic Path Segments
Use :paramName
to match dynamic path segments:
✅ Will match:
/app/apple/projects
/app/banana/projects
❌ Won’t match:
/app/projects
(missing company segment)/app/apple/projects/1
(path too deep)
Tip: Parameter names like
:company
or:slug
are just identifiers - you can name them anything, they don’t affect the matching logic
Wildcard Matching
Use *
to match any path:
-
/app/*
- ✅ Matches
/app/one
,/app/one/two
- ❌ Does not match
/app
- Note: Requires at least one segment after
/app/
- ✅ Matches
-
/app*
- ✅ Matches
/app
,/applications
- Note: Matches anything that starts with
app
- ✅ Matches
-
/*/projects
- ✅ Matches
/app/projects
,/app/one/two/three/projects
- Note: Matches projects at any depth
- ✅ Matches
Combining Patterns
You can mix dynamic segments and wildcards in the same pattern:
This pattern will:
- Match any path at the start
- Capture a specific customer
- Capture a specific invoice
- Match any remaining path
Query
The part that comes after ?
and before #
in a URL.
Basic Rules
- Query parameters are key-value pairs (e.g.
key=value
) - Multiple parameters are separated by
&
- Order doesn’t matter
- Extra parameters are ignored
- Parameter values are optional
Examples
?fruit=apple&tab=analytics
will match:
?fruit=apple&tab=analytics
?tab=analytics&fruit=apple
(different order, same result)?other=test&fruit=apple&tab=analytics
(extra params ignored)
Wildcard Matching
- Match values starting with specific text:
- Match any value:
Fragment
The part that comes after #
in a URL.
Fragment Patterns
Fragments follow the same rules as paths:
- Dynamic segments:
- Wildcards:
Tip: In single-page applications (SPAs), fragments often act like paths and can be matched using the same patterns