React Native SDK · Preview
Overview
Plan your React Native integration with the RTN SDK, from installation to your first event.
Preview: planned API
The React Native SDK is in development and not published yet. This page describes the API we are building so you can plan your integration. Package names, signatures and defaults may still change before the first release.
The RTN React Native SDK sends app events to the same pipeline as the Web SDK. Customers who use your app and your store share one profile, so the same live segments reach them by email, push, SMS and WhatsApp and sync to your ad audiences.
Requirements
React Native 0.74 or later with the New Architecture, or Expo SDK 51+ with a development build. Android API 24+ and iOS 15+.
1. Install the package
npm install @rtn/react-native
cd ios && pod installWith Expo, add "@rtn/react-native" to the plugins array in app.json and rebuild your development client. Expo Go is not supported because the SDK contains native code.
2. Initialize the SDK
Initialize once, before your root component renders. The package wraps the native Android and iOS SDKs, so their behavior and limits apply. Use the write key of a mobile app from Apps in the RTN dashboard.
import RTN from '@rtn/react-native';
RTN.initialize('WRITE_KEY', {
consent: 'pending',
trackLifecycleEvents: true,
});
export default function App() {
return <RootNavigator />;
}Initialization is non-blocking. Calls made before the SDK is ready are queued and sent once it starts, and no public method throws.
3. Send your first event
RTN.track('newsletter_subscribed', { source: 'footer' });Events are batched on the device and survive restarts and offline periods. Open Events in the dashboard to see them arrive.
What the SDK collects automatically
With trackLifecycleEvents on (the default), the SDK records these events for you:
| Event | When it is sent |
|---|---|
app_installed | First launch after a fresh install, with install attribution |
app_updated | First launch after the app version changes |
app_opened | Every cold start and every return from the background |
app_backgrounded | When the app moves to the background |
screen_viewed | Automatic screen tracking, or each screen call |
deep_link_opened | A direct or deferred deep link was handled |
push_opened | trackPushOpened was called for a notification |
Next steps
- Events and identity: custom events, screens, ecommerce and known customers
- Attribution and deep links: install attribution, deferred deep links and push
- Consent and privacy: consent purposes and platform identifiers
- API reference: every planned method