Repository navigation
feat: add registerOptions and unregisterOptions - #715
Merged
Merged
Conversation
Global capture options, the options counterpart of register(), so apps stop relying on registering legacy option properties such as $cookieless_mode. An event's own options win key by key, beforeSend sees the result, and reset() clears them. iOS, macOS and Android call wrapper-only native APIs, so the native SDKs gain no public API. Windows and Linux keep them in the Dart core. Web registers known options as their legacy properties, since posthog-js has no options. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 9, 2026
Contributor
There was a problem hiding this comment.
PostHog Review · Standard · reviewed 6b34cdc: 1 Should fix.
See this review and its findings in PostHog Review. Comment @posthog review --deep for a Deep review. A Deep review takes longer and looks deeper than a Standard review.
Contributor
posthog-flutter Compliance ReportDate: 2026-11-09T18:47:23.854347+00:00 ✅ All Tests Passed!232/232 tests passed Capture_V1 Tests✅ 105/105 tests passed View Details
Capture_Ai_V1 Tests✅ 110/110 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
eli-r-ph
approved these changes
Nov 9, 2026
eli-r-ph
left a comment
There was a problem hiding this comment.
human and assorted robots think this looks great thanks for the updates! 🚀
6 of 17 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 Motivation and Context
Capture v1 moved
$process_person_profile,$cookieless_mode,$ignore_sent_atand$product_tour_idinto per-eventoptions, but 6.0 had no way to set an option for every event: the migration guide told apps to register the legacy property instead, which is the shim we want docs and the wizard to move people off. Eli asked for global options on the client SDKs too (capture v1 tracking thread;SD-17in the v1 rubric; it reverses the client exemption on sdk-specs#146).This adds
Posthog().registerOptions(Map)andunregisterOptions(String key), named like posthog-node's:beforeSendsees and can change the result, they persist across restarts, andreset()clears them, likeregister().@_spi(PostHogInternal), feat: let wrapper SDKs register capture options for every event posthog-android#954 behind@PostHogInternal), so the native SDKs gain no public API and every natively built event gets them, including lifecycle,$feature_flag_calledand crash events.beforeSend, and on$identify,$create_aliasand$groupidentify, which don't pass throughbeforeSend.The migration guide's "There are no global options" line now points to
registerOptions, and the 6.0 changeset has a line for it.💚 How did you test it?
$identify/$create_alias/$groupidentify, registeredprocess_person_profilereplaces the personless default, unregister and reset, persistence), desktop plugin (beforeSendsees registered options and can remove them), method channel (registerOptions/unregisterOptionsarguments, null values dropped), web (legacy property mapping, unregister).flutter testpasses forcore/posthog_core_test.dart,posthog_flutter_io_test.dartandposthog_flutter_desktop_test.dart;flutter test --platform chrome test/posthog_flutter_web_handler_test.dartpasses the new tests (three existing app-version tests there need the build-injected app version and fail locally without it).flutter analyze,make checkFormatKotlinandmake checkFormatSwiftare clean;scripts/check-api-dart.sh --updateregenerated the API snapshot.How to test locally
CI can't build iOS or Android until posthog-ios and posthog-android 4.0 ship. To try it:
feat/v4-register-options-wrapper, runCI=false ./gradlew :posthog:publishToMavenLocal :posthog-android:publishToMavenLocal -PcoreVersion=7.1.81 -PandroidVersion=4.1.81 -x signMavenPublication(any version above the highest 4.x in~/.m2), and addmavenLocal()toexample/android/build.gradle.kts's repositories.posthog_flutter/darwin/posthog_flutter/Package.swiftat a local checkout of posthog-ios onfeat/v4-register-options-wrapperwith.package(path: ".../posthog-ios")(the folder must be namedposthog-ios).Posthog().registerOptions({'cookieless_mode': true}), capture an event, and check itsoptionsin abeforeSendcallback or the request body.📝 Checklist
If releasing new changes
.changeset/v6-major-release.md🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Written with Claude Code under Anna's direction. Native support stays wrapper-only by design: iOS and Android apps keep
register()super properties. On web,unregisterOptions('cookieless_mode')also removes a$cookieless_modethe app registered withregister(), since both are the same posthog-js super property.🤖 Generated with Claude Code