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.

Trigger groups

Configure custom recording triggers with individual sampling rates per group. Recording will start if any of the recording trigger groups match.

Group name
e.g., Error Tracking, Feature Testing
Sample rate (%)
100
Minimum duration (seconds)
No minimum
Match type
ANY condition matches
Conditions
Event triggers
Add event
URL patterns (regex)

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.

Add URL
Feature flag
Add flag

No conditions added yet. A trigger group will match all sessions if there are no conditions.

Fig. 1One trigger group: the conditions that start a recording, and the sample rate and minimum duration that thin it.

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.

ControlReach for it when
Sample rateSelect N% of sessions to record at random.
Minimum durationDiscard sessions that are too short or are bounces.
Event triggersOnly sessions where something specific happened, like someone visiting the pricing page.
URL patternsOnly record sessions that match your URL patterns, like checkout.
Feature flagYou'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:

  • Groups are combined with OR logic, so a session records if it matches any of them
  • Inside a group, the match type decides whether a session needs any of the conditions or all of them
  • The sample rate is applied last to the matching set of sessions.

Examples

Each example below combines trigger groups. Hand the prompt to PostHog AI and it sets the group up for you.

ExampleHow it worksSet it up
Record every checkout session, and 5% of everything elseTwo 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 exceptionOne 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 bouncesOne 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.