React Native SDK
Track screens, events, identity, and delivery from React Native without coupling analytics to a navigation library.
Install and initialize
The SDK works with Expo, React Navigation, Expo Router, and other navigation setups.
pnpm add tracwell-react-native @react-native-async-storage/async-storageTypeScript
import { createAsyncStorage } from "@react-native-async-storage/async-storage";
import { AppState } from "react-native";
import { createTracwell } from "tracwell-react-native";
const analytics = await createTracwell({
appId: "com.example.app",
appState: AppState,
collectionMode: "product",
projectKey: "tw_live_...",
projectOrigin: "https://example.com",
storage: createAsyncStorage("tracwell"),
});
analytics.screen("Home");Use the stable bundle or application ID for appId. The projectOrigin must exactly match the project's registered HTTPS origin.
Track navigation
Call screen("ScreenName") from your navigation callback after the active screen changes. Consecutive duplicate screens are ignored.
The SDK flushes when the app leaves the foreground. Use
await analytics.flush() for an important conversion before navigation.