- Groups are combined with
ORlogic, so a session records if it matches any of them - Inside a group, the
match typedecides whether a session needs any of the conditions or all of them - The sample rate is applied last to the matching set of sessions.
Control which sessions to record
If you get thousands or millions of visitors a day, you can't watch every replay. PostHog gives you a few knobs to keep only the useful sessions and keep costs low.
Trigger groups
Sessions are recorded when they meet the conditions of a trigger group. These rules decide when a session recording begins and ends.
Configure custom recording triggers with individual sampling rates per group. Recording will start if any of the recording trigger groups match.
Matches if the user visits a matching URL at any point during the session. For more control, use a $pageview event trigger with property filters.
No conditions added yet. A trigger group will match all sessions if there are no conditions.
The controls
Every trigger group is built from the same five controls. Conditions decide which sessions match; sample rate and minimum duration thin what's left.
| Control | Reach for it when |
|---|---|
| Sample rate | Select N% of sessions to record at random. |
| Minimum duration | Discard sessions that are too short or are bounces. |
| Event triggers | Only sessions where something specific happened, like someone visiting the pricing page. |
| URL patterns | Only record sessions that match your URL patterns, like checkout. |
| Feature flag | You're rolling something out and want the sessions of the people who got it. |
How groups play together
It can be difficult to understand exactly how these rules play together. A few things hold in every case:
Examples
Each example below combines trigger groups. Hand the prompt to PostHog AI and it sets the group up for you.
| Example | How it works | Set it up |
|---|---|---|
| Record every checkout session, and 5% of everything else | Two groups. The first has a URL pattern for your checkout path and a 100% sample rate. The second has no conditions at all and a 5% sample rate. The first group catches checkouts, the second groups applies a 5% sample on everything else. | Set up |
| Record sessions where a paying customer hit an exception | One group, match type set to all: an event trigger on your exception event, plus a feature flag you've rolled out to paying customers. | Set up |
| Record marketing-site visits, but not bounces | One group with URL patterns for your marketing pages and a minimum duration of 10 seconds. Sessions shorter than that are never recorded. | Set up |
Sane defaults
If you don't know what to set yet, start here:
- Record 100% of sessions. Turn the sample rate down once you know how much you're actually recording, not before. Be realistic about how many you plan to watch.
- Set a minimum duration of 2 seconds or more. A one-second bounce is billed like any other recording with nothing in it to watch, this will reduce junk volume.