> ## Documentation Index
> Fetch the complete documentation index at: https://guides.klaritics.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrate the Klaritics React Native SDK

> Add the Klaritics SDK to your React Native project, initialize with app_id and server_host, and log events and user properties from JavaScript.

The Klaritics React Native SDK follows the same conventions as the Web and Android SDKs. It wraps the native layer so you can initialize and log events from JavaScript while the SDK handles platform-specific details. Packaging and installation follow standard React Native conventions.

## Installation

Install the SDK using your preferred React Native package manager:

```bash theme={null}
npm install @deeptaai/klaritics-react-native-sdk
# or
yarn add @deeptaai/klaritics-react-native-sdk
```

Follow any additional linking steps provided by the package documentation for your React Native version.

## Initialization

Import the SDK and initialize it with your `app_id` and `server_host` before logging any events:

```javascript theme={null}
import Klaritics from "@deeptaai/klaritics-react-native-sdk";

Klaritics.init("YOUR_APP_ID", {
  server_host: "https://YOUR_SERVER_HOST"
});
```

The SDK will not initialize until both values are provided.

## Logging events

```javascript theme={null}
// Standard analytics event
Klaritics.logEvent("ProductClicked", {
  product_id: "sku-123",
  category: "electronics"
});

// Client-specific event
Klaritics.logClientEvent("CustomAction", {
  action_type: "swipe"
});
```

## User and session management

```javascript theme={null}
// Identify the current user
Klaritics.setUserId("user@example.com");

// Attach user properties
Klaritics.setUserProperties({
  plan: "pro",
  signup_date: "2024-01-15"
});

// Start a new session
Klaritics.startNewSession();
```

## Important naming note

The client-facing class is `Klaritics`. Do not use `KlariticsSDK`, `KlariticsCore`, or any other variant in your application code.
