Repository navigation
feat(app): PostHog paywall A/B test (control / outline / web) + flag-gated web onboarding - #21450
Merged
Merged
Conversation
…and flag-gated web onboarding paywall-variant multivariate flag (PostHog 957521) decides which paywall a free reader sees: control = the shipped PlansSheet, outline = native port of the soft paywall from PR #21412, web = a webview whose page is the variant (changed over the air). One router in front of every opener; paid readers and App Review builds (subscription UI hidden) never see a variant. Exposures are emitted as $feature_flag_called once per arm so PostHog Experiments attribute conversion, revenue, dismissals and Product Error per arm; every later event carries $feature/paywall-variant. onboarding-webview flag (957522) renders first-run onboarding from a web page after sign-in and consent; completion stays native. Both webviews fail open to the native UI on error, 4xx/5xx or a 10 s silence. Web pages: web/paywall (omi-paywall.vercel.app).
…r the debug onboarding rerun at startup routing
… and onboarding-webview as a rollout flag
…lytics_manager.dart under its line budget)
…the Outline palette is a declared fixed canvas
…exposure dedupe to the analytics identity Control is the experiment's denominator: the router now records the exposure for every eligible reader before the opener shows the sheet. The held arm and the once-per-arm exposure are keyed by the settled analytics identity, so an account switch re-reads its own arm and is exposed in its own right; an identity that changes while the reads are in flight yields control and holds nothing. Regression tests cover control exposure, hidden/paid readers, identity scoping, mid-read switches and per-identity dedupe.
YinkaAdepoju
pushed a commit
to YinkaAdepoju/omi
that referenced
this pull request
Oct 14, 2026
…eriment (BasedHardware#21450) Brings in Nik's paywall A/B test (PaywallRouter, flag paywall-variant) and flag-gated web onboarding. Resolution: - openUpgradePaywall: Superwall pilot (when on) -> PaywallRouter arm -> plans sheet; logs Paywall Opened once; forceNative carries the web variant's fallback so it never loops. - Onboarding: the activation ending's paywall asks the router before the onboarding sheet; the experiment's end-of-onboarding placement is skipped when the ending already offered a plan, so nobody sees two paywalls in a row. Keeps the debug onboarding rerun and the web onboarding entry; the first-capture step telemetry stays removed (BasedHardware#21396 revert). - l10n: main's keys kept; the reverted first-capture strings dropped again; regenerated. - Flag registry re-rendered; onboarding-activation-flow notes name its PostHog flag/experiment. Co-Authored-By: Claude Opus 5.5 <[email protected]>
YinkaAdepoju
pushed a commit
to YinkaAdepoju/omi
that referenced
this pull request
Oct 14, 2026
…, control) and the app-open re-ask Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
What changed and why
Mobile free→paid conversion is ~20% against ~50% for Pocket/Plaud. Nik is trialing several paywall redesigns and wants each one split-tested through PostHog, switchable per variant, and ideally changeable over the air. This PR adds that framework and the first variant.
Paywall A/B test (
paywall-variant, PostHog multivariate flag 957521, experiment 482365, dashboard 2207880)PaywallExperimentresolves the arm once per session from the flag + payload; anything unexpected iscontrol. Debug builds can force an arm with--dart-define=OMI_PAYWALL_VARIANT=outline|web.PaywallRouter.openVariantsits in front of every opener (usage page incl. the locked-row/deep-link routes, chat quota, freemium meter, contextual plans). Control, paid readers and hidden-subscription-UI builds (App Review) return false and thePlansSheetopens exactly as before.outline= native port of the soft paywall from design: device-first onboarding + soft trial paywall prototype (Graphite / Aurora) #21412 (Graphite direction) on the real catalog (Unlimited tier, yearly/monthly, saving derived from prices) and the shared checkout (PaywallCheckout, the same Stripe session + webview + analytics the sheet uses). "Use Free Plan" is always visible.web= a webview rendering the page named in the payload (web/paywall/index.html, deployed at https://omi-paywall.vercel.app). The page only renders; checkout stays native via a JS bridge. Dead page (error, 4xx/5xx, 10 s silence) falls back to the native sheet (forceNativePaywall).onboarding_paywall: trueadds a placement at the end of first-run onboarding (variants only; control is unchanged).$feature_flag_calledonce per analytics identity and arm, control included (the denominator), recorded by the router right before any paywall opens; the SDK's own exposure events are off. PostHog Experiments attribute Upgrade Succeeded, new MRR, dismissals and Product Error per arm;$feature/paywall-variantis registered as a super property for breakdowns. New eventsPaywall Variant Shown/Paywall Variant Fallback;onboardingadded to the paywall source enums.Web onboarding (
onboarding-webview, flag 957522, 0%)OnboardingWebviewGatecan route toWebOnboardingPage(web/paywall/onboarding.html). Bridge:set_name,permission(notifications/location/background via the existingPlatformOnboardingPermissionsSource),complete,fallback. Completion stays in the wrapper (_finishOnboarding, shared with the native completion screen). Any failure lands on the native step the reader left off at.--dart-define=OMI_ONBOARDING_WEBVIEW_URL=https://…andOMI_ONBOARDING_RERUN=1to walk onboarding again on a signed-in account.Adding a variant later: native = one new widget + a
PaywallVariantcase + a variant row in the flag; web = edit the page and redeploy, no app release.Both flags are live with control at 100% / rollout 0%, so no user sees any change until the split is set once this build is in the stores.
Product invariants affected
none
How it was verified
Simulator (iPhone 16 Pro, dev flavor built against the production profile + api.omi.me with a local, uncommitted profile-guard bypass; signed in as the free test account [email protected] via a Firebase custom token through the VM service, the repo's documented simulator workaround). Screenshots in
.agent-artifacts/ui-evidence/paywall-ab/(evidence.json inside).--dart-define=OMI_ONBOARDING_RERUN=1 OMI_ONBOARDING_WEBVIEW_URL=https://omi-paywall.vercel.app/onboarding OMI_PAYWALL_VARIANT=outline: after launch the web onboarding page rendered inside the app with the name pre-filled; Continue → step 2 greeted by name (set_name reached native); Location → native request → status posted back and the page re-labelled the button; Start using Omi → native completion ran and the end-of-onboarding placement showed the Outline paywall with the prod catalog (Unlimited $269.91/yr shown as $22.49/mo, $29.99/mo, Save ~25%, 300 free minutes from the subscription). Upgrade to Unlimited → real Stripe Checkout for Omi Unlimited v2 at $269.91/yr in the shared payment webview (cancelled, nothing paid) → back on the paywall → Use Free Plan → Home.OMI_PAYWALL_VARIANT=web: Plan & Usage → Upgrade → the webview paywall (omi-paywall.vercel.app) with prices and name from the bridge URL and the native close overlay; its Upgrade button → the same native Stripe session (cancelled) → Use Free Plan → Plan & Usage.$feature_flag_called($feature_flag=paywall-variant,$feature_flag_response=outline),Paywall Opened(source usage_page),Paywall Variant Shown(variant outline, source usage_page) andUpgrade Modal Dismissed, every one carrying$feature/paywall-variant. (That property readcontrolin the debug run because the SDK reports the server's assignment while the dart-define forced the arm; without the override both agree.)flutter analyzeclean on every touched file;flutter test: 40 unit/widget tests pass (paywall_experiment_test 13 incl. identity scoping and mid-read account switch, paywall_router_test 3 incl. control exposure and hidden/paid readers, analytics_is_feature_enabled_test incl. per-identity exposure dedupe, onboarding_webview_gate_test 5, outline_paywall_page_test 4, onboarding_setup_rating_prompt_gate_test).make preflightpasses (ui-evidence included).paywall-variant, payloads set), flag 957522 (onboarding-webview, 0%), experiment 482365 (draft, not started), dashboard 2207880 (every metric broken down by$feature/paywall-variant).Not verified: a completed purchase (no live charge was made); the chat-quota and freemium-meter openers only through the shared router (same code path as the usage page); Android.
Failure class
none
Exposure dedupe, verified on device (Oct 14, prod backend, uid nikbasedhardware): the first
$feature_flag_calledper identity and arm reaches PostHog and spawns$experiment_exposure(fresh arms sent throughrecordFeatureFlagExposuretoday all landed within seconds). A repeat of an already-reported (identity, flag, response) pair is dropped downstream of the app (SDK/PostHog side — a raw HTTP repeat lands, the same event through the SDK does not), so the in-app once-per-identity set and PostHog agree: exposure counts once per person per arm, which is exactly what the experiment needs.