このページの内容

Targeted Replay Capture

Use Targeted Replay Capture (TRC) to focus your Session Replay quota on sessions that match criteria you define, such as events, event properties, user properties, or page URLs, rather than capturing all sessions or relying on random sampling. Use TRC when you need to observe specific behaviors or high-value segments; if you only need broad session coverage, adjust the global sample rate instead.

Configure TRC by adding conditions to the Sampling control in your project's Session Replay settings. Each condition can match events, event properties, user properties, or page URLs, and you can combine conditions with OR logic. The Session Replay SDK fetches targeting configurations from a remote config service and evaluates them at runtime to decide whether to capture a session.

Key capabilities

TRC defines the criteria that Amplitude uses to decide whether to capture a session, and helps you manage your Session Replay quota more efficiently.

Custom capture criteria

Define rules that capture replays based on:

  • Specific events: For example, Checkout Started.
  • Event properties: For example, plan = Pro.
  • User properties: For example, country = US.
  • Page URLs: For example, capture only sessions on /checkout or any URL matching a pattern.
  • Combinations: Combine these criteria with OR logic.

Configuration and quota management

Manage TRC through the Session Replay settings page by adding conditions to the Sampling control. Add, edit, and remove targeting conditions for each project. The UI estimates how much quota each condition uses based on historical traffic. Set different sample rates for different conditions to control which sessions Amplitude captures and how much quota each condition uses.

Use cases

  • Capture replays only for users who encounter errors or drop off at key points.
  • Focus on high-value user segments or critical product flows.
  • Capture sessions on specific pages or flows, such as checkout or onboarding.
  • Reduce noise and cost by avoiding unnecessary replay capture.

Configure Targeted Replay Capture

TRC requires Session Replay Browser SDK Plugin version @amplitude/plugin-session-replay-browser@1.22.0 or higher and permissions to manage Session Replay settings. URL matching requires plugin version 1.26.2+ or standalone SDK @amplitude/session-replay-browser@1.32.2+. If you haven't installed the plugin, do that first.

Configure TRC per project:

  1. Navigate to Settings > Organizational Settings > Session Replay Settings. For more information, refer to the Session Replay settings page.
  2. Select the project you want to configure.
  3. In the Sampling section, select Add Condition to create a new targeting condition.
  4. Define your targeting criteria for the condition.

Add multiple conditions and combine them with OR logic. Each condition can include:

  • Event types.
  • Event properties.
  • User properties.
  • Page URLs.

You must capture and send events, event properties, and user properties to Amplitude during the session for event- and property-based targeting conditions to work. Page URL conditions evaluate the user's current URL directly and don't require a matching event.

Page URL targeting

Page URL targeting lets you capture replays only when users visit specific pages or URL patterns. This capability is in beta for web Session Replay.

Page URL targeting requires one of the following SDK versions:

  • Plugin: @amplitude/plugin-session-replay-browser@1.26.2 or higher.
  • Standalone SDK: @amplitude/session-replay-browser@1.32.2 or higher.

To add a Page URL condition:

  1. In the Sampling section, select Add Condition and open the condition editor.
  2. Add a Page URL condition.
  3. Select an operator and enter a URL or pattern.
  4. Set the sample rate for the condition and save.

Supported operators:

Use Page URL targeting to focus replay capture on high-value flows such as checkout, onboarding, or account settings without capturing every session.

How Page URL targeting evaluates

The Session Replay SDK evaluates Page URL conditions against the user's current browser URL. On single-page applications, the SDK re-evaluates targeting when the URL changes. If the user navigates to a URL that no longer matches, capture stops for that session.

Capture timing for Page URLs

For Page URL conditions, replay capture begins when the user's URL matches the condition. Replays don't include activity from before the URL match.

SDK support

TRC requires the Amplitude Browser Analytics SDK with the Session Replay Browser SDK Plugin version @amplitude/plugin-session-replay-browser@1.22.0 or higher. Integrate both the Amplitude Browser Analytics SDK and the Session Replay Plugin into your setup to use TRC.

URL matching support requires one of the following:

  • Plugin: @amplitude/plugin-session-replay-browser@1.26.2 or higher.
  • Standalone SDK: @amplitude/session-replay-browser@1.32.2 or higher.

Standalone SDK limitations

The standalone SDK supports Page URL targeting only. Event-, property-, and user-based TRC conditions require the Session Replay Browser SDK Plugin with the Amplitude Browser Analytics SDK.

Evaluation timing

The SDK fetches the targeting configuration at session start. For event-, property-, and user-based conditions, the SDK uses that configuration for the entire session. If a matching event occurs later in the session, the SDK evaluates it against the configuration that was active at session start. Updates to targeting rules apply only to new sessions.

For Page URL conditions, the SDK also re-evaluates when the URL changes during the session, such as during single-page app navigation.

Capture timing

Session replay capture begins only after the targeting condition triggers. TRC has no "lookback" period. Replays don't capture activity before the condition triggers. For event-based conditions, capture starts when the matching event fires. For Page URL conditions, capture starts when the user's URL matches.

Was this helpful?