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

1

Install packages

Add the React Native tracker and AsyncStorage.

terminal

1npm install @grometrics/react-native @react-native-async-storage/async-storage
2

Create 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({4  websiteId: 'YOUR_SITE_ID',5  context: {6    countryCode: 'US'7  }8})
3

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<NavigationContainer5  ref={setup.navigation.ref}6  onReady={setup.navigation.onReady}7  onStateChange={setup.navigation.onStateChange}8>

Options / Configuration

OptionTypeRequiredDescription
websiteIdstringYour Grometrics site ID from Settings > Tracking
appVersionstringnoPopulates app version filters and rollout reporting
appBuildstringnoBuild number shown with app version context
attributionobjectnoDeep links, install referrer, deferred links, and SKAN
pushobjectnoCaptures push_opened events for push revenue attribution
screensobjectnoCaptures screen_view events for Screens and Realtime

npm

1npm install @grometrics/react-native @react-native-async-storage/async-storage

Event model

EventUsed for
app_openActive users, realtime lifecycle feed, session starts
app_background / app_closeActive-session end, exit screens, realtime summaries
screen_viewScreens page, top screens, screen paths, screen context
push_openedPush tab, push campaign attribution, realtime push rows
revenueDashboard 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?