> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt # Control which sessions to record – Session replay pocket guide [](/pocket-guides.md)Aa [](/pocket-guides/session-replay/101.md)[](/pocket-guides/session-replay/protecting-user-privacy.md) # Control which sessions to record – Session replay pocket guide 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](/docs/session-replay/how-to-control-which-sessions-you-record.md). 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 name1 e.g., Error Tracking, Feature Testing Sample rate (%)2 100 Minimum duration (seconds)3 No minimum Match type4 ANY condition matches Conditions5 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. 1 – One 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. | 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: - 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. | 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](https://app.posthog.com/#panel=max:!Set%20up%20Session%20Replay%20trigger%20groups%3A%20record%20100%25%20of%20sessions%20that%20visit%20my%20checkout%20URL%2C%20and%205%25%20of%20everything%20else) | | 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](https://app.posthog.com/#panel=max:!Set%20up%20a%20Session%20Replay%20trigger%20group%20that%20records%20only%20sessions%20where%20a%20user%20on%20my%20paying-customer%20feature%20flag%20hit%20an%20exception) | | 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](https://app.posthog.com/#panel=max:!Set%20up%20a%20Session%20Replay%20trigger%20group%20that%20records%20sessions%20on%20my%20marketing%20pages%20only%20when%20they%20last%20at%20least%2010%20seconds) | ## 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. See also: [Control which sessions you record](/docs/session-replay/how-to-control-which-sessions-you-record.md) · [Recording retention](/docs/session-replay/recording-retention.md) · [Pricing](/session-replay/pricing.md) · [Privacy controls](/pocket-guides/session-replay/protecting-user-privacy.md) [‹ Session Replay 101](/pocket-guides/session-replay/101.md)[All guides](/pocket-guides.md)p. 2 of 7[Privacy ›](/pocket-guides/session-replay/protecting-user-privacy.md)