Repository navigation
feat: add disableGeoip config - #720
Merged
Merged
Conversation
Let an app opt out of server-side GeoIP enrichment. With disableGeoip set, events carry $geoip_disable: true and feature flag requests send geoip_disable: true. iOS and macOS pass it to posthog-ios disableGeoIp, and the desktop core stamps events and the /flags body itself. posthog-android has no such option yet (PostHog/posthog-android#562), so the plugin marks events through a native beforeSend and flag requests still use GeoIP there. Flutter web only warns, as for other options posthog-js owns. Refs PostHog#424
marandaneto
previously approved these changes
Nov 12, 2026
marandaneto
left a comment
Member
There was a problem hiding this comment.
The code looks good; no qualifying findings. Verdict: correct.
Thank you for your contribution!
marandaneto
reviewed
Nov 12, 2026
6 tasks done
marandaneto
approved these changes
Nov 13, 2026
marandaneto
enabled auto-merge (squash)
November 13, 2026 13:59
marandaneto
approved these changes
Nov 13, 2026
marandaneto
left a comment
Member
There was a problem hiding this comment.
The code looks good; no qualifying findings. Verdict: correct.
Thank you for your contribution!
posthog Bot
added a commit
to PostHog/posthog.com
that referenced
this pull request
Nov 14, 2026
Add a "Disable GeoIP enrichment" section to the Flutter SDK docs for the new disableGeoIp config option (PostHog/posthog-flutter#720). It tells how to set the option, what it adds to events and flag requests, the Android minimum version, and the Flutter Web alternative. The version 5.61.0 is the next minor release from the pending changeset. The current release is 5.60.3. Generated-By: PostHog Desktop Task-Id: ee724bc8-7ac8-4545-952d-c3b94a44928e
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
Closes #424.
Apps can now opt out of server-side GeoIP enrichment, so PostHog doesn't infer the user's location from their IP address. With
disableGeoIp: true, events carry$geoip_disable: trueand feature flag requests sendgeoip_disable: true. Defaults tofalse./flagsdisableGeoIp(available at our 3.92.3 floor)disableGeoIp(minimum 3.77.0)before_sendAndroid forwards the option to native
PostHogAndroidConfig.disableGeoIp, released in posthog-android 3.77.0. The minimum Android SDK dependency is now 3.77.0. Native handling covers analytics events and feature flag requests without a pluginbeforeSendworkaround.Divergence from sdk-specs
Compared with the
capturerequirement "Client-level GeoIP control with per-call override":before_send. Here it's added after the FlutterbeforeSendon every platform, because native SDKs and the desktop core add SDK properties after Dart callbacks run. ThedisableGeoIpdartdoc notes that a callback can't see or remove it.$geoip_disablestays an event property on the v6 branch (it isn't inlegacyOptionProperties), so this shouldn't conflict with capture v1.💚 How did you test it?
/flagsbody sendsgeoip_disablefor both values.setupsendsdisableGeoIp;setup_request.jsonsnapshot updated.disableGeoIpforwarding for true, false, and omitted values. The true case failed before the native forwarding change and passes afterward.flutter test(1319 passing),./gradlew :posthog_flutter:testDebugUnitTest,make checkFormatDart analyzeDart checkApiDart.test/core/feature_flags_test.dart,test/core/posthog_core_test.dart, andtest/posthog_flutter_io_test.dartpassed.make checkFormatKotlin checkFormatDart analyzeDart checkApiDartandgit diff --checkpassed.The original contribution did not locally test the Swift change, native formatters, or browser tests. The review follow-up ran Kotlin and Swift formatting checks, but did not build Swift or run browser tests.
disableGeoIpto match Android/iOS; regenerated the API snapshot. Full Flutter VM suite: 1319 passed, 1 skipped; Android: 78 passed; finite compliance adapter suite: 25 passed. Kotlin/Dart/Swift formatting, Dart analysis, and API checks passed.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Written with Claude Code (Claude Opus 5.5 High) at my direction, test-first per seam (desktop core, platform channel, Android plugin), then reviewed against CONTRIBUTING.md and the sdk-specs GeoIP requirement. The initial implementation marked Android events behind a
shortcut:comment. The Pi-assisted review follow-up replaces that workaround with nativedisableGeoIpconfiguration and raises the Android minimum to 3.77.0. Web follows the existing warning pattern because the host app initializes posthog-js.