Amplitude provides a wrapper for integrating Rudderstack and Amplitude's Session Replay.
This integration snippet supports Rudderstack Cloud-mode.
Use the latest version of the Session Replay SDK, which is 1.19.4
Use npm or yarn to install the package. This includes the Amplitude Session Replay SDK.
npm install @amplitude/session-replay-browser --save
yarn add @amplitude/session-replay-browser
For information about the sessionReplayOptions
, see the Session Replay Standalone SDK configuration section.
import * as sessionReplay from "@amplitude/session-replay-browser"; amplitude.init(AMPLITUDE_API_KEY, user_id, config).promise.then(() => { window.rudderAnalytics.ready(function() { const rudderAnonymousId = rudderAnalytics.getAnonymousId(); sessionReplay.init(AMPLITUDE_API_KEY, { deviceId: rudderAnonymousId, sessionId: rudderAnalytics.getSessionId(), sampleRate: .1 // 10% of sessions will be captured }).promise; // Update track method to include sessionReplayProperties const rudderAnalyticsTrack = rudderAnalytics.track; rudderAnalytics.track = function (eventName, eventProperties, options, callback) { const sessionReplayProperties = sessionReplay.getSessionReplayProperties(); eventProperties = { ...eventProperties, ...sessionReplayProperties, }; rudderAnalyticsTrack(eventName, eventProperties, options, callback); }; // Update page method to include sessionReplayProperties const rudderAnalyticsPage = rudderAnalytics.page; rudderAnalytics.page = function (category, name, properties, options, callback) { const sessionReplayProperties = sessionReplay.getSessionReplayProperties(); properties = { ...properties, ...sessionReplayProperties, }; rudderAnalyticsPage(category, name, properties, options, callback); }; sessionReplay.set(rudderAnalytics.getSessionId()) }); });
This integration updates Rudderstack's request architecture, which ensures that all track
and page
events include the required Amplitude Session Replay ID
event property.
Amplitude maps the Rudderstack Anonymous ID to the Amplitude Device ID, and the Rudderstack Session ID to the Amplitude Session ID. If you use another field for device ID, contact Amplitude Support.
Session Replay isn't compatible with ad blocking software.
For troubleshooting information, see Session Replay Standalone SDK | Troubleshooting
March 18th, 2025
Need help? Contact Support
Visit Amplitude.com
Have a look at the Amplitude Blog
Learn more at Amplitude Academy
© 2025 Amplitude, Inc. All rights reserved. Amplitude is a registered trademark of Amplitude, Inc.