Skip to content

React Native SDK

Herald for React Native is a set of npm packages: the core, one package per vendor, optional React hooks, a logger and a fake for your tests. Each vendor package works over that vendor's official React Native package. It's written in TypeScript, and works with Expo and with plain React Native.

API reference Notes Changelog Source

Installation

Install the core, and one package for each analytics service you use, next to that service's own React Native package. For Firebase:

npx expo install @react-native-firebase/app @react-native-firebase/analytics
npm install @herald-analytics/core @herald-analytics/firebase
npm install --save-dev @herald-analytics/testing

Install the vendor's own package yourself, as on the first line. npm would bring it in on its own, but without adding it to your package.json, and React Native only links the native code of packages listed there. Without Expo, use npm install for it too. For tracking from screens and lists, add @herald-analytics/react.

All packages share one version.

Packages

Package What it is
@herald-analytics/core Events, properties and the Herald fan-out, in plain TypeScript.
@herald-analytics/firebase Sends to Firebase Analytics (GA4).
@herald-analytics/adjust Sends to Adjust: events by dashboard token, purchases and ad revenue.
@herald-analytics/mixpanel Sends to Mixpanel: events, user profile and super properties.
@herald-analytics/appsflyer Sends to AppsFlyer: conversions, purchases, subscriptions and ad revenue.
@herald-analytics/amplitude Sends to Amplitude: events, user properties, screen views and revenue.
@herald-analytics/meta Sends to Meta: conversions and purchases, for Meta's ads.
@herald-analytics/log Prints every call, for debug builds.
@herald-analytics/testing FakeAnalyticsProvider, a fake vendor that records events so your tests can check them.
@herald-analytics/react Optional: tracking from screens and lists, such as screen views and impressions.

Each vendor package works over that vendor's React Native package, which your app installs itself, so React Native links its native code.

Feature code usually needs only @herald-analytics/core, plus the vendor package for each vendor it writes a factory for. The app, which sets up Herald, depends on every vendor package.

Compatibility

Herald needs React Native 0.78 or newer and React 19. It is built and tested with Expo SDK 57, and against these vendor packages:

Package Version
@react-native-firebase/analytics 26
mixpanel-react-native 4
@amplitude/analytics-react-native 1.12 or newer
react-native-adjust 5.8 or newer
react-native-appsflyer 7
react-native-fbsdk-next 13.4 or newer

Newer versions of an SDK work within the same major version. @herald-analytics/react works with React Navigation 7 and Expo Router 57 or newer.

React Native notes

Where React Native differs from the other platforms is in the React Native notes.