Skip to Content
AnalyticsOverview

Analytics

NativeExpress uses PostHog  to track onboarding, authentication, AI usage and purchases.

The app includes eleven typed events. Add your project’s API key and host to enable them.

User identification

After sign-in, the app identifies the user with their Supabase user ID and email. The sign-out hook resets that analytics identity.

Product event properties contain settings such as the selected model or whether a message includes an image. They do not include prompts, message text or image data.

Optional configuration

Both EXPO_PUBLIC_POSTHOG_API_KEY and EXPO_PUBLIC_POSTHOG_HOST must be set. If either is missing, analytics calls do nothing and the app continues to run. Follow the setup check to confirm events arrive.

Session replay needs additional setup.

Using another analytics provider

App code imports analytics and trackEvent from @/services/analytics. The AnalyticsPort interface defines identify, track, screen and reset, so a replacement adapter can keep the same calls in your screens and hooks.

To replace PostHog, update the adapter selected in analytics.ts and the provider in src/provider/AnalyticsProvider.tsx. See Analytics usage.

Files

      • events.ts - Typed event names and properties
      • analytics.port.ts - Integration interface
      • analytics.ts - Selects the adapter
      • posthog.adapter.ts - PostHog implementation
      • client.ts - Reads the API key and host
      • index.ts - Public exports
      • AnalyticsProvider.tsx - PostHog provider
      • SessionProvider.tsx - User identification
Last updated on