feat(surveys): add optional intro screen before the first question - #677
Open
jakesciotto wants to merge 2 commits into
Open
feat(surveys): add optional intro screen before the first question#677jakesciotto wants to merge 2 commits into
jakesciotto wants to merge 2 commits into
Conversation
Adds the leading mirror of the confirmation screen: an optional intro screen shown before question 1, configured via the new displayIntroScreen / introScreenHeader / introScreenDescription / introScreenDescriptionContentType / introScreenButtonText appearance fields. Exposed on the display model for custom delegates and rendered natively by the Compose UI module. Advancing past it records no response and sends no survey event. Intro copy is translatable like the thank-you message. Generated-By: PostHog Code Task-Id: 50ceca51-4b90-4b94-8e72-e01bce50073c
Contributor
Prompt To Fix All With AI### Issue 1
posthog/src/main/java/com/posthog/internal/surveys/SurveyTranslationApplier.kt:80-90
**Disabled intro sets survey language**
When `displayIntroScreen` is false or omitted but its translation contains different intro copy, these checks still set `matchedKey`, causing survey events to include `$survey_language` even though none of that translated content was displayed.
```suggestion
if (appearance?.displayIntroScreen == true) {
if (translation.introScreenHeader != null && translation.introScreenHeader != appearance.introScreenHeader) return true
if (translation.introScreenDescription != null &&
translation.introScreenDescription != appearance.introScreenDescription
) {
return true
}
if (translation.introScreenButtonText != null &&
translation.introScreenButtonText != appearance.introScreenButtonText
) {
return true
}
}
```
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "feat(surveys): add optional intro screen..." | Re-trigger Greptile |
Parity with the web renderer: the intro has no default header, so an intro with neither header nor description would draw an empty sheet with a lone button. Skips straight to question 1 instead; resolve() already normalizes blank intro copy to null, now locked by a test. Generated-By: PostHog Code Task-Id: 50ceca51-4b90-4b94-8e72-e01bce50073c
Contributor
posthog-android Compliance ReportDate: 2026-08-06 22:57:02 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
|
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
Surveys can show a confirmation ("thank you") screen after the last question, but there is no equivalent screen before the first one.
This is the posthog-android part of the cross-SDK intro screen rollout tracked in PostHog/posthog#74064. The web/RN renderer shipped in PostHog/posthog-js#4436; this PR brings the Android model layer and the Compose UI module to parity.
What it does:
SurveyAppearancefields (appended last so existing positionalcopy()/componentN()usages keep their meaning):displayIntroScreen,introScreenHeader,introScreenDescription,introScreenDescriptionContentType,introScreenButtonText. Mapped ontoPostHogDisplaySurveyAppearancefor custom delegates.IntroScreencomposable inposthog-android-surveys-compose, the leading mirror ofConfirmationScreen, shown bySurveySheetbefore the first question whendisplayIntroScreenis on. The description follows the module's existing TEXT-only rendering rule (HTML stays a known gap).onSubmitcall, no response recorded, no survey event. The X button keeps dismissing the whole survey with the normalsurvey dismissedevent, and the confirmation branch still wins for completed surveys.introScreenHeader/introScreenDescription/introScreenButtonText), wired throughSurveyTranslation, the translation applier's change gate, and the display mapping.survey.appearanceis all that's needed; no delegate interface changes.💚 How did you test it?
Unit tests added/extended:
SurveyAppearanceMappingTest: intro fields map onto the display appearance; missing fields default to disabled.SurveyTranslationsTest: JSON fixture now carries intro fields; translated header/button apply with untranslated description falling back, and the untranslated path renders originals.Written on Linux without a JVM/Android SDK, so Gradle did not run locally — please rely on CI (⚠️
make compile).posthog/api/posthog.apiwas updated by hand following the binary-compatibility-validator format; ifapiCheckdisagrees,make apiwill produce the canonical dump.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file (.changeset/survey-intro-screen.md, minor forposthog+posthog-android-surveys-compose)🤖 Agent context
Autonomy: Human-driven (agent-assisted)
rememberSaveableflag insideSurveySheet(survives configuration changes, never touchesonSubmit/onClose), and the new data-class fields were deliberately appended after the existing ones with defaults to avoid shiftingcomponentN/copypositions.Created with PostHog Code