fix(surveys): exclude web-only surveys on Android - #690
Open
dustinbyrne wants to merge 1 commit into
Open
Conversation
Contributor
🦔 ReviewHog reviewed this pull requestFound 1 must fix, 0 should fix, 0 consider. Published 1 finding (view the review). |
Contributor
|
ReviewHog Alpha 🦔 If you find any issues helpful - please reply "valid", "invalid", etc., for evaluation purposes 🙏 |
Surveys scoped to the web via a CSS `selector` or `url` display condition were leaking onto native Android because those conditions were not checked during survey matching. Exclude every survey with a non-empty `url` or `selector`, including surveys that also have device-type or event targeting. Android cannot evaluate the web condition, so native targeting alone must not make the survey eligible. This matches the behavior in posthog-ios and posthog-react-native. Generated-By: PostHog Code Task-Id: 0fc1a1b9-118e-48f1-8c40-d399f533d150
dustinbyrne
force-pushed
the
posthog-code/exclude-web-only-surveys
branch
from
August 11, 2026 16:05
e5fc46d to
8ee7722
Compare
dustinbyrne
marked this pull request as ready for review
August 11, 2026 16:56
Contributor
|
Reviews (1): Last reviewed commit: "fix(surveys): exclude web-only surveys o..." | Re-trigger Greptile |
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
Why: Surveys scoped to the web via a CSS
selectororurldisplay condition were leaking onto native Android and rendering as inert prompts with non-functional targeting.PostHogSurveysIntegration.getActiveMatchingSurveys()did not checkconditions.urlorconditions.selector. Android cannot evaluate either condition, so matching native device-type or event targeting is not enough to make such a survey eligible.This brings posthog-android in line with the canonical
surveyscontract in PostHog/sdk-specs and the behavior already shipped in posthog-ios and posthog-react-native.Analogous of PostHog/posthog-ios#733
What changed
urlorselectorcondition.💚 How did you test it?
./gradlew :posthog-android:testDebugUnitTest --tests 'com.posthog.android.surveys.PostHogSurveysWebConditionsTest'make testmake checkFormat📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Fully autonomous
Authored by PostHog Code. A Changeset entry was added since the repo uses Changesets rather than direct CHANGELOG edits.
Created with PostHog Code