URL targeting allows you to start session capture for Session Replay when a user visits a specific URL. This article describes how to set up URL targeting, the available targeting options, and offers examples of URLs that would and wouldn’t match each of these options.
How to set up URL targeting for replays
- Click your profile icon (top right), followed by 'Project and users'.
- Select the 'Replays' tab.
- Use the dropdown menu to select the match type condition (see the URL targeting options below).
- In the text field, set your match criteria by entering a URL, or component of.
- Click 'Save'.
To enable / disable replay targeting:
Click the toggle next to 'Replay targeting:' to enable or disable it.
Available URL targeting options
To better understand how URL targeting works, it is good to understand the components that make up a URL. Contentsquare evaluates five different URL components when it looks for targeting matches:
- protocol
- domain
- path
- query strings
- fragments
Each of the URL targeting criteria can be based on one of the seven match type conditions listed below.
- URL matches exactly: Targets a specific URL, including the protocol, which can include a query string and fragment.
- URL contains: Target all pages which contain the entered text. This rule is case-sensitive
- URL starts with: Target all pages that have a URL, including the protocol, which starts with the entered text.
- URL ends with: Target all pages that have a URL that ends in the entered text.
- URL does not match exactly: Targets all URLs that do not match the specified URL, including the protocol, which can include a query string and fragment.
- URL does not contain: Target all pages which do not contain the entered text. This rule is case-sensitive.
- URL does not start with: Target all pages that have a URL, including the protocol, which do not start with the entered text.
- URL does not end with: Target all pages that have a URL that do not end in the entered text.
URL targeting examples
URL matches exactly
Example URL input: https://www.example.com/pages/?x=1
| Result | Example URL | Why? |
|---|---|---|
| Match | https://www.example.com/pages/?x=1 | All URL components are an exact match |
| No match | https://www.example.com/pages/ | The required query string ?x=1 is missing |
| No match | https://www.example.com/pages/subpage | The required query string ?x=1 is missing and the page path should not include /subpage |
| No match | https://www.example.com/pages/?x=1&y=1 | The URL has a non-matching query string &y=1 at the end of it |
| No match | https://www.example.com/pages/?x=1#2 | The URL has a non-matching URL fragment #2 at the end of it |
URL contains
Example URL input: subpage
| Result | Example URL | Why? |
|---|---|---|
| Match | https://www.example.com/subpage/info | The full text string subpage is present in the URL path |
| Match | https://www.example.com/category/product-subpage-launch/ | The full text string subpage is present within one of the URL path segments |
| Match | https://www.example.com/help/?q=subpage_results | The full text string subpage is present in the query parameters of the URL. |
| No match | https://www.example.com/mainpage | The URL does not contain the exact string subpage |
| No match | https://www.example.com/SUBPAGE/details | he rule is case-sensitive, and the URL contains SUBPAGE (all uppercase) |
| No match | https://www.example.com/sub-page/details | The URL contains sub-page (with a hyphen), not the exact continuous string subpage |
URL starts with
Example URL input: https://www.example.com/pages/
| Result | Example URL | Why? |
|---|---|---|
| Match | https://www.example.com/pages/ | The entire URL matches the target criteria |
| Match | https://www.example.com/pages/subpage | The URL starts with the matching URL, so it's still a match, even though the end includes /subpage |
| Match | https://www.example.com/pages/?x=1 | The URL starts with the target criteria, so it's still a match, even though the end includes the ?x=1 query string |
| Match | https://www.example.com/pages/?x=1&y=1 | The URL starts with the target criteria, so it's still a match, even though the end includes the ?x=1&y=1 query string |
| Match | https://www.example.com/pages/?x=1#2 | The URL starts with the target criteria, so it's still a match, even though the end includes the ?x=1 query string and #2 fragment |
| No match | https://example.com/pages/ | Part of the domain www. is not included and therefore does not match the criteria |
URL ends with
Example URL input: pages/
| Result | Example URL | Why? |
|---|---|---|
| Match | https://www.example.com/pages/ | The URL ends with the matching criteria pages/ |
| Match | https://www.example.com/folder/pages/ | The URL ends with the matching criteria pages/ |
| No match | https://www.example.com/pages/subpage | The URL path does not end with pages/ |
| Match | https://www.example.com/pages/?x=1 | The URL ends with the target criteria pages/, even though it also ends with a query string ?x=1 |
FAQs
Is Replay Targeting retroactive?
No, the targeting will only start for sessions that occur after the setting is saved.