For AI agents: a documentation index is available at /docs/llms.txt. Append .md to any page URL for markdown, or send Accept: text/markdown.
Configure time-based matching
이 페이지는 아직 귀하의 언어로 번역되지 않았습니다. 현재 작업 중이므로 곧 다시 확인해 주십시오.
Time-based matching connects replays to analytics events using device IDs and overlapping time windows. Use it to find the recording around an event when your pipeline sends timestamps without session IDs, such as events delivered through S3.
If your analytics events include session IDs, use Amplitude session matching. If your project groups sessions by an event property, configure custom session matching.
Prerequisites
- Install the Session Replay Standalone SDK in your browser application.
- Send the same device ID to Session Replay and on your analytics events.
- Include event timestamps in your analytics pipeline so Amplitude can match events to replay time windows.
How time-based matching works
Amplitude groups event activity into 30- or 60-minute windows and matches recordings with the same device ID that overlap those windows. The matching has slightly less precision at session boundaries than matching Amplitude sessions.
The standalone SDK still needs a sessionId to group and upload replay data. With time-based matching, you can generate that ID on the frontend. The ID doesn't need to appear on analytics events, but it must be a valid Unix timestamp in milliseconds for the server to accept the upload.
Select the matching window
The organization setting applies to all projects in your organization. Review the matching options before changing it.
- Go to Organization Settings > Session Replay.
- Select Time-based event matching.
- Select a 30- or 60-minute window.
- Use the same window size for the frontend replay session ID in the SDK setup below.
Set a replay session ID
Configure the standalone SDK with a timestamp-based replay ID:
- Set
WINDOW_MSto60 * 60 * 1000for a 60-minute window, or30 * 60 * 1000for a 30-minute window. - Round the current time down to the start of that window to generate
sessionId. - Initialize the SDK with that
sessionId, your project API key, and the samedeviceIdyour analytics pipeline sends. - Call
setSessionIdwhen the time window changes. Your application must detect that change; the standalone SDK doesn't manage sessions automatically.
import * as sessionReplay from "@amplitude/session-replay-browser";
const WINDOW_MS = 60 * 60 * 1000;
const now = Date.now();
const sessionId = now - (now % WINDOW_MS);
await sessionReplay.init(AMPLITUDE_API_KEY, {
deviceId: "your_analytics_device_id",
sessionId,
sampleRate: 1,
}).promise;
// Run this when your application detects a new time window.
const nextWindowTime = Date.now();
await sessionReplay.setSessionId(nextWindowTime - (nextWindowTime % WINDOW_MS))
.promise;
The example uses a sample rate of 1 for testing. After verification, restore your production sample rate. Refer to Standalone SDK configuration for additional options.
Verify time-based matching
- Capture a test session and send a known analytics event during the recording.
- Check that the analytics event and replay use the same device ID, and that the event timestamp falls within the recorded activity.
- Find the test replay using that event. Open the replay and confirm that it shows the activity around the event.
- Test across a time-window boundary. Confirm that your application updates
sessionIdand continues to capture replay data.
If matching fails, check the device IDs, event timestamps, and the selected organization window. Use Session Replay troubleshooting to diagnose capture and playback failures.
이 내용이 도움이 되었나요?