Repository navigation
feat: add disableGeoIp configuration - #971
Conversation
There was a problem hiding this comment.
PostHog Review · Standard · reviewed 05e5843: 1 Must 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.
posthog-android Compliance ReportDate: 2026-11-13 08:24:37 UTC ✅ All Tests Passed!46/46 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
dustinbyrne
left a comment
There was a problem hiding this comment.
Stateful/Android capture, flags handling and release metadata look consistent. The new setting is still ignored by the supported core stateless event pipeline; consider covering that path and adding its regression test before approval.
AI-assisted review.
ioannisj
left a comment
There was a problem hiding this comment.
🤖 An AI agent wrote this on behalf of @ioannisj.
No findings. I went through where $geoip_disable gets set for stateful and stateless events, the flags request default and the minimized $feature_flag_called allowlist, and it lines up with posthog-js and posthog-ios.
- Move "Upgrade your dependencies" and "Upgrade posthog-server" to During: both come down to declaring posthog-android 4.0.0. - Give the PostHogStateless break its own During section and checklist item. - Drop "Check timestamps and IDs": nothing in it changes but the request ID header, which the proxy section covers. - Say what staying on capture costs for $ai_* events, scope the intro to analytics and AI events, and say why follow ups can wait. - disableGeoIp exists now (main's #971), so the guide no longer says there's no GeoIP setting. Name the real remote config path. - Regenerate references/posthog-android-migration.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ange (#973) * docs: sort the Android 4.0.0 migration guide by when you make each change Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: keep the 4.0.0 guide's table cells to one value Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: move the posthog.com Android SDK page into the reference The posthog.com Android SDK page redirects to this reference once 4.0.0 ships, so its setup, how-to, and configuration sections now live in docs/getting-started.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: title a single migration guide's page with its H1 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 2eeb772) * docs: publish the root MIGRATION.md as the migration page Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit f7650a7) * Revert "docs: move the posthog.com Android SDK page into the reference" This reverts commit 0e67e30. * docs: add the Android facts from the retired posthog.com page that no other page has Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: move the Android one-API facts from getting-started into KDoc Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: preserve Android tracing setup * docs: name the SDK in versions, cut self-hosted notes, and split dashes and semicolons Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: address review on the reordered 4.0 migration guide - Move "Upgrade your dependencies" and "Upgrade posthog-server" to During: both come down to declaring posthog-android 4.0.0. - Give the PostHogStateless break its own During section and checklist item. - Drop "Check timestamps and IDs": nothing in it changes but the request ID header, which the proxy section covers. - Say what staying on capture costs for $ai_* events, scope the intro to analytics and AI events, and say why follow ups can wait. - disableGeoIp exists now (main's #971), so the guide no longer says there's no GeoIP setting. Name the real remote config path. - Regenerate references/posthog-android-migration.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: say flush doesn't block, and register persists across app restarts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: pass the migration page generator one guide Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: point the copy page button at posthog.com and reword the change categories Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: restore the self-hosted note on serving capture v1 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Anna Garcia <anna.g@posthog.com>
💡 Motivation and Context
Android apps cannot disable server-side GeoIP enrichment through SDK configuration. Flutter currently needs an Android workaround that marks events but does not cover feature flag requests. iOS already exposes
disableGeoIp.Closes #562. Supports the Flutter integration.
Add
PostHogConfig.disableGeoIp, inherited byPostHogAndroidConfig, with a default offalse. When enabled, both stateful and stateless analytics events carry$geoip_disable: true, and feature flag requests sendgeoip_disable: true. The event marker takes precedence over caller properties, matching iOS, butbeforeSendcan still change it. Replay snapshots do not receive the marker. Minimized$feature_flag_calledevents retain it.The event and request markers follow the capture spec. Existing explicit overrides in the internal flags API remain supported.
💚 How did you test it?
05e58433: two new tests failed because hooks saw missing or caller-supplied markers. The same tests pass after fixing the stateless builder. The three-test suite uses the public factory and real HTTP batching to cover capture, identify, alias, group, exception, and flag exposure events, defaults, caller precedence, and hooks that replace or remove the marker.JAVA_HOME=<JDK 17> make testJava: all 1,109 core tests passed../gradlew :posthog-android:testReleaseUnitTest --tests 'com.posthog.android.PostHogAndroidConfigTest': all 10 tests passed.make checkFormatandgit diff --checkpassed.make apiregenerated the API dump. API checks passed forposthog,posthog-android, andposthog-server.The initial full core run used JDK 21 and hit the pinned Byte Buddy version's unsupported-JDK error. The complete rerun passed on JDK 17, matching CI. No manual device testing was performed.
📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Implemented with the Pi coding agent using shell tools, GitHub CLI, Gradle, and pnpm in a dedicated worktree. The human directed Android parity with iOS. The option is inherited from core configuration without changing constructors. Pi session
01a1d05e-f658-73bd-a9c4-f36980c33245is local and has no public link.The diff-scoped cleanup and test authoring audit found no actionable issues. Review feedback identified that stateless capture uses a separate property builder. A follow-up commit applies the same marker there after merging caller properties and before hooks. Autoreview with Claude Opus 5.5 reviewed commit
b803d6db6e10d2ad5e6f916bbe3ca6486715ba4dagainstorigin/mainand reported no findings. Human review is required before merging.