React Native / Expo
Install the SDK, create the tracker, and start tracking app sessions.
Last updated June 3, 2026
Install Grometrics in a React Native or Expo app. This tracks app opens, screen views, lifecycle events, deep links, push opens, and revenue attribution.
Prerequisites
- A Grometrics site ID from Settings > Tracking
- React Native or Expo app access
- AsyncStorage installed for offline event queueing
Tip
Expo apps should keep expo-constants installed so appVersion and appBuild can be detected automatically.
Note
Queued mobile events keep their original event timestamp, so late arrivals still show when they actually happened.
Steps
Install packages
Add the React Native tracker and AsyncStorage.
terminal
1npm install @grometrics/react-native @react-native-async-storage/async-storageCreate the tracker
Pass your Grometrics site ID and optional app context.
Replace YOUR_SITE_ID with your site ID from Settings > Tracking.
App.tsx
1import { createReactNativeTracker } from '@grometrics/react-native'23const setup = await createReactNativeTracker({4websiteId: 'YOUR_SITE_ID',5context: {6countryCode: 'US'7}8})
Start on app boot
Start after app initialization so app_open and the current screen are sent.
App.tsx
1await setup.tracker.start()23// React Navigation4<NavigationContainer5ref={setup.navigation.ref}6onReady={setup.navigation.onReady}7onStateChange={setup.navigation.onStateChange}8>
Options / Configuration
| Option | Type | Required | Description |
|---|---|---|---|
| websiteId | string | ✓ | Your Grometrics site ID from Settings > Tracking |
| appVersion | string | no | Populates app version filters and rollout reporting |
| appBuild | string | no | Build number shown with app version context |
| attribution | object | no | Deep links, install referrer, deferred links, and SKAN |
| push | object | no | Captures push_opened events for push revenue attribution |
| screens | object | no | Captures screen_view events for Screens and Realtime |
npm
1npm install @grometrics/react-native @react-native-async-storage/async-storageEvent model
| Event | Used for |
|---|---|
| app_open | Active users, realtime lifecycle feed, session starts |
| app_background / app_close | Active-session end, exit screens, realtime summaries |
| screen_view | Screens page, top screens, screen paths, screen context |
| push_opened | Push tab, push campaign attribution, realtime push rows |
| revenue | Dashboard revenue, attribution, sources, campaigns, recent sales |
Direct is normal
Mobile Direct is often larger than web because home screen opens, app switcher opens, Spotlight, ATT opt-outs, and missing referrers have no attribution context.
Danger
Do not send synthetic purchases from a production app unless you mark them as test events before verification.
What happens next
Open Realtime after starting the app. You should see app_open first, then screen_view events as you navigate.
Verify your setup
Verify your setup
Troubleshooting
No app_open appears
Confirm tracker.start() runs after app initialization and the site ID matches Settings > Tracking.
Screens are missing
Confirm the navigation callbacks are wired, or call screen_view manually for custom navigation.
Push opens are missing
Confirm push tracking is enabled and the notification payload includes the campaign or title field.
Was this page helpful?