> For the complete documentation index, see [llms.txt](https://docs.keewano.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.keewano.com/sdks/react-native.md).

# React Native SDK

Install and initialize the Keewano SDK in a bare React Native app.

Lightweight behavioural analytics for bare React Native. Built on the same platform-agnostic core as the [Expo](https://docs.keewano.com/sdks/expo.md), [Web](https://docs.keewano.com/sdks/web.md), and [Node.js](https://docs.keewano.com/sdks/nodejs.md) SDKs.

## 1. Install

```bash
npm install @keewano/react-native-sdk react-native-fs
```

`react-native-fs` is the file-system peer used to store batches on disk; run its autolinking / pod-install step once.

Using Expo, managed or dev-client? See the [Expo SDK](https://docs.keewano.com/sdks/expo.md).

## 2. Initialize

Call `init` once, early in your app's lifecycle. It is idempotent, so a second call (such as a Fast Refresh re-render) logs a warning and joins the first one.

```typescript
import { useEffect } from 'react';
import { Keewano } from '@keewano/react-native-sdk';

export default function App() {
  useEffect(() => {
    void Keewano.init({ apiKey: 'your-project-api-key' });
  }, []);

  // ... your app
}
```

`apiKey` is the only required option.

{% hint style="info" %}
As soon as `init` resolves you are already collecting data. App lifecycle, button taps, deep links, and errors are tracked automatically; screen tracking is one opt-in hook away.
{% endhint %}

## 3. Identify your users

Each install gets an anonymous id automatically. If your product has its own user id, associate it once it is known so Keewano can recognise the user across devices.

```typescript
// 36-char hyphenated UUID
Keewano.setUserId('11111111-1111-4111-8111-111111111111');

// or a numeric id
Keewano.setUserId(1234567890n);
```

## 4. Report events

For product-specific moments, call the manual API. Every method is fire-and-forget — it never throws into your call site and never blocks the UI.

```typescript
Keewano.reportButtonClick('Play');
Keewano.reportInAppPurchase({ productName: 'gem_pack', price: { priceUsdCents: 499 } });
Keewano.reportOnboardingMilestone('TutorialComplete');
```

***

## Full documentation

The SDK's own docs cover every option and event family in depth:

**Start here**

|                                                                                                      |                                                                    |
| ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
| [Getting Started](https://github.com/Keewano/TypeScript-SDK/blob/main/docs/getting-started.md)       | Install, initialise, first events                                  |
| [Configuration](https://github.com/Keewano/TypeScript-SDK/blob/main/docs/configuration.md)           | Every `init` option — custom endpoint, consent gate, opt-out flags |
| [Automatic Tracking](https://github.com/Keewano/TypeScript-SDK/blob/main/docs/automatic-tracking.md) | What is captured with no extra code                                |
| [Event Types](https://github.com/Keewano/TypeScript-SDK/blob/main/docs/event-types.md)               | The full map of events                                             |

**Reporting events**

|                                                                                                          |                                        |
| -------------------------------------------------------------------------------------------------------- | -------------------------------------- |
| [Windows and Buttons](https://github.com/Keewano/TypeScript-SDK/blob/main/docs/windows.md)               | Button clicks, windows, and popups     |
| [In-App Purchases](https://github.com/Keewano/TypeScript-SDK/blob/main/docs/in-app-purchases.md)         | Purchases and granted items            |
| [Ad Revenue](https://github.com/Keewano/TypeScript-SDK/blob/main/docs/ad-revenue.md)                     | Ad offers, revenue, and rewarded items |
| [Subscription Revenue](https://github.com/Keewano/TypeScript-SDK/blob/main/docs/subscription-revenue.md) | Recurring revenue and perks            |
| [Item Economy](https://github.com/Keewano/TypeScript-SDK/blob/main/docs/item-economy.md)                 | Exchanges and inventory resets         |
| [Onboarding](https://github.com/Keewano/TypeScript-SDK/blob/main/docs/onboarding.md)                     | Onboarding milestones                  |
| [A/B Testing](https://github.com/Keewano/TypeScript-SDK/blob/main/docs/ab-testing.md)                    | Test group assignment                  |
| [Install Campaign](https://github.com/Keewano/TypeScript-SDK/blob/main/docs/install-campaign.md)         | Attribution and campaign reporting     |
| [Custom Events](https://github.com/Keewano/TypeScript-SDK/blob/main/docs/custom-events.md)               | Your own typed events                  |

**Going further**

|                                                                                                                  |                                                        |
| ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
| [Privacy](https://github.com/Keewano/TypeScript-SDK/blob/main/docs/privacy.md)                                   | Consent gate and opt-out                               |
| [Offline](https://github.com/Keewano/TypeScript-SDK/blob/main/docs/offline.md)                                   | Behaviour without a connection                         |
| [Integration Testing](https://github.com/Keewano/TypeScript-SDK/blob/main/docs/integration-testing.md)           | Verifying your integration                             |
| [Existing App Integration](https://github.com/Keewano/TypeScript-SDK/blob/main/docs/existing-app-integration.md) | Adding the SDK to an app with an established user base |
| [Example Integration](https://github.com/Keewano/TypeScript-SDK/blob/main/docs/example-integration.md)           | A worked end-to-end example                            |
| [Data Format](https://github.com/Keewano/TypeScript-SDK/blob/main/docs/data-format.md)                           | The wire format                                        |
| [All guides](https://github.com/Keewano/TypeScript-SDK/blob/main/docs/README.md)                                 | The SDK's own documentation index                      |

Source: [github.com/Keewano/TypeScript-SDK](https://github.com/Keewano/TypeScript-SDK)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.keewano.com/sdks/react-native.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
