Skip to content

Commit 1e8081d

Browse files
authored
docs: Document trailing slash stripping for exact URL matching (#15188)
## Changes Documents the trailing slash stripping behavior for exact URL matching in product tours and surveys, based on [PostHog/posthog#48497](PostHog/posthog#48497). ### Updated files - **`contents/docs/product-tours/targeting.mdx`** – Added a note after the URL conditions table explaining that trailing slashes are stripped from both URLs when using exact matching. - **`contents/docs/surveys/creating-surveys.mdx`** – Added a clarification to the URL targeting bullet point in Display conditions that trailing slashes are stripped for exact matching. Also fixed a missing Oxford comma. ### Context PR #48497 added a UI clarification message in the product tour configuration that appears when "Exact" URL match type is selected: "Trailing slashes are stripped when matching exact URLs." Since surveys share the same URL matching infrastructure (`SurveyMatchType`), both docs pages are updated to reflect this behavior.
1 parent 4434d50 commit 1e8081d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

contents/docs/product-tours/targeting.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ Show tours on specific pages using URL matching.
2020
| **Contains** | URL must contain the string | `/dashboard` matches any URL with `/dashboard` |
2121
| **Regex** | URL must match the pattern | `/users/[0-9]+` |
2222

23+
24+
> **Note:** When using **Exact** matching, trailing slashes are stripped from both the target URL and the current page URL before comparison. This means `https://app.example.com/dashboard` and `https://app.example.com/dashboard/` are treated as the same URL.
25+
2326
The URL is matched against the full `window.location.href`.
2427

2528
## User targeting

contents/docs/surveys/creating-surveys.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ You can display your survey to specific users based on:
279279

280280
- **Linked feature flag:** Whether a user has a specific [feature flag](/docs/feature-flags) enabled. For example, if you're rolling out a new landing page using a feature flag `new-landing-page`, you can gather feedback only from users who have that flag enabled. This is also a way to show surveys to cohorts (but it must be a [non-behavioral one](/docs/feature-flags/common-questions#why-cant-i-use-a-cohort-with-behavioral-filters-in-my-feature-flag)).
281281

282-
- **URL targeting:** Show when URL either contains a string, exactly matches a string, matches a regex. The URL targeting is evaluated against `window.location.href`.
282+
- **URL targeting:** Show when URL either contains a string, exactly matches a string, or matches a regex. When using exact matching, trailing slashes are stripped before comparison. The URL targeting is evaluated against `window.location.href`.
283283

284284
- **Device types targeting:** Show when the device type either contains a string, exactly matches a string or matches a regex. The device type targeting is evaluated by parsing the [userAgent](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent) on the client-side, possible values are: Desktop, Mobile, Tablet, Console, and Wearable. You can also target device types using _Person and group properties_ (Latest or Initial Device type), but these properties aren't immediately available on the first page load for unidentified persons. Only available from posthog-js version 1.214.0 forward.
285285

0 commit comments

Comments
 (0)