URL targeting is a Session Replay setting that lets you define which pages should trigger a session replay. By creating URL match rules, you can focus replay capture on the pages that matter most to you, such as your checkout flow, key landing pages, or specific user journeys. When a user visits a URL that matches your rules, Contentsquare automatically starts capturing their session for replay.
This article explains how to set up URL targeting, the match options available, and includes examples of URLs that match (or don't match) each option.
How to set up URL targeting for replays
Only users with Admin or Expert user permissions can set up URL targeting for replays.
- Click your profile icon in the top-right corner.
Select Projects and users.
- Go to the Replays tab.
- Use the dropdown to choose a match condition (see options below).
In the text field, enter the URL or URL component you want to target.
- Click Save.
To turn URL targeting on or off:
Click the toggle next to Replay targeting to enable or disable it.
URL targeting options
A URL is made up of several parts. Contentsquare checks up to five of these when matching your targeting rules:
- protocol
- domain
- path
- query strings
- fragments
You can target sessions using one of eight match conditions:f
- URL matches exactly: Targets a specific URL, including it's protocol, query string and fragment.
- URL contains: Targets any page whose URL includes the text you enter. Case-sensitive.
- URL starts with: Targets any page whose URL begins with the text you enter, including the protocol.
- URL ends with: Targets any page whose URL ends with the text you enter.
- URL does not match exactly: Targets all URLs except the one you specify.
- URL does not contain: Targets pages whose URL does not include the text you enter. Case-sensitive.
- URL does not start with: Targets pages whose URL does not begin with the text you enter.
- URL does not end with: Targets pages whose URL does not end with the text you enter.
URL targeting examples
URL matches exactly
Example URL input: https://www.example.com/pages/?x=1
| Result | Example URL | Reason |
|---|---|---|
| Match | https://www.example.com/pages/?x=1 | All URL parts match exactly. |
| No match | https://www.example.com/pages/ | The query string ?x=1 is missing |
| No match | https://www.example.com/pages/subpage | The 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 fragment #2 means the URL is no longer an exact match. |
URL contains
Example URL input: subpage
| Result | Example URL | Reason |
|---|---|---|
| Match | https://www.example.com/subpage/info | The URL path contains subpage. |
| Match | https://www.example.com/category/product-subpage-launch/ | The word subpage appears within a path segment. |
| Match | https://www.example.com/help/?q=subpage_results | The word subpage appears in the query string. |
| No match | https://www.example.com/mainpage | The URL does not contain the exact string subpage |
| No match | https://www.example.com/SUBPAGE/details | The 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 | Reason |
|---|---|---|
| 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.