Skip to main content
Shipnative includes comprehensive monitoring with PostHog for analytics and Sentry for error tracking. All utilities are pre-built and ready to use.

Setup

The wizard prompts for your PostHog API key and host URL. Or manually add to apps/app/.env:
Without keys: Mock mode logs events to console. Connect real PostHog early to capture usage data.

Usage

useAnalytics Hook

Utility Functions

For use outside React components:

Direct Client Access


Feature Flags

Create flags in PostHog Dashboard → Feature Flags. See PostHog Feature Flags.

Pre-built Event Helpers


Testing

Mock mode: Events logged to console as [MockPostHog] Event: ... Real PostHog:
  1. Add API key and host to .env
  2. Trigger events in app
  3. View in PostHog Dashboard → Events / Persons

Troubleshooting

Events not showing in PostHog?
  • Verify API key and host are correct
  • Allow a few minutes for events to process
  • Check console for PostHog errors
Still in mock mode?
  • Verify apps/app/.env has correct keys
  • Restart Metro: yarn start --clear
For more, see PostHog React Native SDK.

Error Tracking with Sentry

Sentry automatically captures JavaScript errors, native crashes, and performance issues. It’s configured to work seamlessly with your app.

Setup

Run the setup wizard:
The wizard will prompt for your Sentry DSN. Or manually add to apps/app/.env:
Without DSN: Mock mode logs errors to console. Connect real Sentry early to catch production issues.

Automatic Error Capture

Sentry automatically captures:
  • JavaScript errors - Unhandled exceptions and promise rejections
  • Native crashes - iOS and Android native errors
  • React errors - Component render errors via Error Boundaries
  • Performance issues - Slow screens and network requests
No additional code needed - errors are automatically reported.

Manual Error Reporting

Capture errors manually with context:
Add breadcrumbs for debugging context:

User Context

Associate errors with users:

Performance Monitoring

Track custom operations:

Utility Functions

Pre-built helpers in utils/crashReporting.ts:

Testing Sentry

Trigger a test error:
View errors in Sentry Dashboard → Issues.

Filtering Errors

Configure what gets reported in services/sentry.ts:

Production Best Practices

  1. Environment tagging - Automatically set via EXPO_PUBLIC_ENV
  2. Release tracking - Set release version for tracking issues across versions
  3. Source maps - Uploaded automatically for readable stack traces
  4. User privacy - Avoid sending PII (personally identifiable information)
For more, see Sentry React Native SDK.