PWA install banner + install analytics
Merged
FR
6d ago+570+570+012345678901234567890123456789-1-1-0123456789
What & why
Second slice of the mobile PWA work (follows #654). Until now nothing invited phone users to install abode, and Android's share-sheet saving only works once it's installed.
- Install prompt capture.
beforeinstallpromptcan fire before hydration, soinstrumentation-client.tscaptures it into a small store (src/lib/pwa/install-prompt.ts), which suppresses Chrome's mini-infobar so our UI can offer the prompt instead. InstallAppBanneron the dashboard, shown only on touch devices that aren't already running the installed app:- Android: the native prompt behind an "Install" button.
- iOS: the Share → Add to Home Screen steps.
- Dismissing it, or declining the native prompt, snoozes it for 30 days (
localStorage, best effort).
- Platform detection goes through
useSyncExternalStorewith a null server snapshot, so nothing readsnavigatorduring render and hydration can't break. - Analytics:
- Every event gets a
display_modesuper-property (standalone/browser). - New events:
app_installed,install_banner_shown,install_banner_install_clicked,install_prompt_result(outcome),install_banner_dismissed.
- Every event gets a
Checklist
- User-facing change → added/updated a PostHog event (and a funnel/insight for a new flow), or N/A — events added; funnel to create in PostHog:
install_banner_shown→install_banner_install_clicked→install_prompt_result(accepted) /app_installed - User-facing or service change → docs updated, or N/A — README features,
saving-from-your-phonehelp page - New error paths report via
captureServerException/ the error boundary, or N/A — N/A - New behavior is covered by tests, or N/A —
install-prompt.test.ts,use-install-option.test.ts,install-app-banner.test.tsx(RTL, per branch), plus a story - If this fixes a recurring defect, considered a guardrail via the
learnskill, or N/A — N/A
Notes
- Visually checked the banner in both variants (dark/light, 390px). Not tested on real Android or iOS hardware.
- Onboarding milestone: the existing
save_from_phonemilestone already points at the help page, which now covers installing.
Generated by Claude Code