Skip to Content

Analytics setup

NativeExpress sends app events to PostHog  once you add your project’s API key and host.

Prerequisites

Complete the app setup before connecting analytics.

Create a PostHog account

Sign up for PostHog , or sign in to your existing account.

Create a new project

Create a project in the PostHog dashboard , then open its React Native setup instructions. Copy the project API key and host URL.

Creating a new React Native project in PostHog

Add the API key and host

Set both values in .env.local:

.env.local
EXPO_PUBLIC_POSTHOG_HOST="<your-posthog-host>" EXPO_PUBLIC_POSTHOG_API_KEY="<your-project-api-key>"

For cloud builds, add both variables to the EAS environment  used by your build profile.

Verify

Restart the development server and reload the app. Sign in with email and password, then find the sign_in_completed event in your PostHog project. Its method property should be email.

If no event appears, check that both environment variables are set and that the key and host belong to the same PostHog project. Analytics stays disabled when either value is missing.

Session replay

Session replay requires the native replay plugin and additional configuration. Follow PostHog’s React Native session replay setup  to add it to your app.

Next

See Analytics usage to add your own events.

Last updated on