Skip to content

get_session_replay_url(): Add timestamp option to deep-link to current moment in replay #547

Description

@Qvestro

Problem

The current get_session_replay_url() method returns a replay URL but provides no way to link to a specific moment in the replay. The SDK internally knows when the session recording started, but doesn't expose this as a computed timestamp in the URL.

Proposed Solution

Add an optional timestamp parameter. When set to 'now', the SDK should automatically calculate the elapsed seconds since the replay session started and append replay_timestamp to the generated URL:

// Current behavior (unchanged)
mixpanel.get_session_replay_url();
// => https://mixpanel.com/projects/replay-redirect?replay_id=...&distinct_id=...&token=...

// New: automatically compute timestamp for "right now"
mixpanel.get_session_replay_url({ timestamp: 'now' });
// => ...&replay_timestamp=1037.62

The SDK already tracks the session recording start time internally — this just exposes it as part of the URL.

Use Cases

  • Error tracking: In an error handler, call get_session_replay_url({ timestamp: 'now' })to get a link that jumps directly to the moment the error occurred
  • Bug reports: Attach a replay URL that points to exactly when the user clicked "Report Bug"
  • Alerting: Include deep-links in Slack/email alerts that jump straight to the relevant moment
  • Support tools: Link support agents directly to the point where a user experienced an issue

Additional Context

The replay_timestamp query parameter already works in Mixpanel's UI URLs:
https://mixpanel.com/project/{id}/view/{id}/app/profile#distinct_id=...&replay_id=...&replay_timestamp=1037.6158

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions