Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow modifying of rrweb events pre-sending #486

Closed
wants to merge 1 commit into from

Conversation

benjackwhite
Copy link
Collaborator

@benjackwhite benjackwhite commented Dec 7, 2022

Changes

User had a specific issue where their users would play back recordings from an internal page which is not accesible by posthog, whereas a different public version would be. What they wanted was to be able to modify the urls so that playback would always load from the public one.

I don't know if this is a good idea but this would be the client-side variant...

This would allow the user to do something like (ignoring how bad this would be performance-wise)

posthog.init('mykey', {
    session_recording: {
        processRecordingSnapshot: (event) => {
            let processed = JSON.stringify(event)
            processed = processed.replace("http://10.1.0.1", "http://my-public-dns.example.com")
           
            return JSON.parse(processed)
        },
    },
})

Concerns

  • This approach would be exposing the internals of event processing which could easily lead to bad user error...
  • Whilst it solves the problem it is quite hands-on and error prone. Do we instead want to try and solve this at playback?

Checklist

@eligro
Copy link

eligro commented Dec 7, 2022

Thank you. such a feature would be useful for me.

@eligro
Copy link

eligro commented Dec 7, 2022

re your code example, I think it should be return JSON.parse(processing) and not return JSON.parse(event)

@benjackwhite benjackwhite marked this pull request as ready for review December 16, 2022 10:57
@benjackwhite benjackwhite added the bump minor Bump minor version when this PR gets merged label Mar 20, 2023
@posthog-bot
Copy link
Collaborator

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

@posthog-bot
Copy link
Collaborator

This PR was closed due to lack of activity. Feel free to reopen if it's still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump minor Bump minor version when this PR gets merged stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants