This sends product analytics to PostHog: src/lib/analytics.ts builds a posthog-react-native 4.x client once analytics consent is given and implements analytics.track/identify/screen, with an AnalyticsProvider (order 40) that follows consent and asks for ATT when enabled. PostHogProvider is not mounted - it needs a client at mount, and swapping one in after consent would remount the app - so usePostHog() and posthog-react-native's own hooks don't work; use analytics.*, useFeatureFlag, or getPostHog() / usePostHogClient() for the raw client (both undefined until consent). The root layout already calls analytics.screen(pathname) on every route change, so screen autocapture is off and touch autocapture is off too. If you set up with --with-examples there's an example at /examples/analytics with a list of the last events sent. @/lib/analytics keeps the same API whichever option you pick - pick PostHog when you want events, feature flags and a generous free tier from one service you can also self-host.
When to pick PostHog
Pick PostHog if you want events and feature flags from one service with a generous free tier, and the option to self-host later; it's the default here.
At a glance
- Runs in Expo Go
- Yes
- Files added
- 6
- npm packages
- 5
- Keys to paste
EXPO_PUBLIC_POSTHOG_KEY,EXPO_PUBLIC_POSTHOG_HOST- Included in
- Pro
- Tests included
- 2
Set it up
bun run setup --analytics posthogSetup copies the module in, installs SDK-matched versions and removes the options you did not pick. Then bun run doctor lists every key still missing, with a link to where you get it. The step-by-step guide is in the PostHog docs.
PostHog vs other analytics options
| Option | Expo Go | npm packages | Keys to paste | Included in |
|---|---|---|---|---|
| PostHog | Yes | 5 | 2 | Pro |
| Amplitude | Yes | 2 | 1 | Pro |
Questions
Can I use PostHog in Expo Go?
Yes. This module runs in Expo Go, so you can try it before you make a development build.
What do I need to set up PostHog in an Expo app?
Run bun run setup --analytics posthog, then paste 2 keys into .env: EXPO_PUBLIC_POSTHOG_KEY, EXPO_PUBLIC_POSTHOG_HOST. bun run doctor lists any that are missing, with a link to where you get each one.
Which other modules does PostHog need?
It needs a Storage option (expo-sqlite/kv-store, MMKV or AsyncStorage). Pick those in the same setup run.
Does the ReadyNative free tier include PostHog?
No. Analytics is a Pro category: the free tier and Starter ship it switched off. Pro is one payment with lifetime updates.
Can I build the app without PostHog?
Yes. Pick none for analytics (bun run setup --analytics none) - analytics.track/identify/screen are no-ops, feature flags read undefined.
PostHog or Amplitude for Expo?
Pick PostHog if you want events and feature flags from one service with a generous free tier, and the option to self-host later; it's the default here. Pick Amplitude if your team already lives in its funnels and cohorts, or you have an existing project to send to.
What does PostHog mean for the App Store and Google Play privacy forms?
It collects: App interactions (events, screens); Device or other ids (distinct id, device id); User IDs (when you call analytics.identify); Approximate location (GeoIP from the request IP). Shared with: PostHog (processor). Setup adds its data types to the iOS privacy manifest; the docs page lists the answers for Play's Data safety form.
Which PostHog version does it install?
For Expo SDK 57: expo-application ~57.0.3, expo-device ~57.0.2, expo-localization ~57.0.2, expo-tracking-transparency ~57.0.2, posthog-react-native ^4.75.0. Setup installs Expo packages with expo install, so they match the SDK.
Get it
PostHog ships in Pro: one payment, lifetime updates. See pricing or browse every module.