---
title: "React Native SDK"
description: "Install Tracwell for React Native and track screens, events, and identity."
documentation: "https://tracwell.app/docs/react-native"
markdown: "https://tracwell.app/docs/react-native.md"
---

# React Native SDK

> Install Tracwell for React Native and track screens, events, and identity.

## Install the package

### npm

```bash
npm install tracwell-react-native @react-native-async-storage/async-storage
```

### pnpm

```bash
pnpm add tracwell-react-native @react-native-async-storage/async-storage
```

### bun

```bash
bun add tracwell-react-native @react-native-async-storage/async-storage
```

## Initialize

```ts
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 the 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.
