Skip to content

fix: uninstall integrations when the user opts out - #839

Open
o-mid wants to merge 1 commit into
PostHog:mainfrom
o-mid:fix/opt-out-uninstall-integrations
Open

o-mid wants to merge 1 commit into
PostHog:mainfrom
o-mid:fix/opt-out-uninstall-integrations

Conversation

@o-mid

@o-mid o-mid commented Oct 4, 2026

Copy link
Copy Markdown

💡 Motivation and Context

Fixes #242. While opted out, the SDK already drops events, but integrations such as session replay and lifecycle autocapture kept running. This uninstalls all integrations on optOut() and reinstalls them on optIn(), starting session replay with resumeCurrent = false so a new session is created after consent returns.

Flutter: posthog-flutter uses this SDK on Android; opt-out should stop replay/autocapture there too once this ships.

💚 How did you test it?

  • :posthog:test — PostHogTest.optOut uninstalls integrations and optIn reinstalls them, existing optIn notifies PostHogOptInReceiver integrations updated for reinstall.

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran pnpm changeset to generate a changeset file

Made with Cursor

Tear down autocapture and session replay while opted out, then reinstall on opt-in with a new replay session. Fixes PostHog#242.
@o-mid
o-mid requested a review from a team as a code owner October 4, 2026 09:03
@o-mid

o-mid commented Oct 4, 2026

Copy link
Copy Markdown
Author

CI note: Build & Test / Lint / Changeset hygiene runs are showing action_required on this fork PR. Maintainer workflow approval is needed before full CI runs. Wiz scans passed. Fixes #242 — happy to adjust if you prefer a narrower integration pause API than full uninstall/reinstall.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stop all integrations like session replay and autocapture on opt-out

1 participant