> ## Documentation Index
> Fetch the complete documentation index at: https://orwel-22af1265.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Orwel SDK

> Install the Orwel JavaScript SDK and start tracking behavior, features, and conversions.

The **Orwel SDK** is a lightweight, powerful library for tracking human behavior, identifying visitors, and monitoring application performance. Drop one script into any site or app — it captures events automatically and powers the Personality Engine, feature adoption, and conversions, all flowing to a single workspace.

## Installation

<CodeGroup>
  ```bash npm theme={null}
  npm install orwel
  ```

  ```html CDN theme={null}
  <script src="https://cdn.jsdelivr.net/npm/orwel@1/dist/orwel.umd.js"></script>
  ```
</CodeGroup>

## Initialization

Initialize the SDK once, at the root of your application (e.g. `App.tsx`, `main.js`), before any tracking call.

```typescript theme={null}
import orwel from 'orwel';

orwel.init({
  apiKey: 'orwel_pk_...',    // your public ingest key (from env)
  autoMonitor: true,         // performance, JS errors, web-vitals
  autoEventDetection: true,  // auto page_view / click / scroll
});
```

<Warning>
  The SDK key is an ingest-only public key — safe in the browser bundle, but read it from an environment variable so you can rotate it per environment. See the [AI Skill](/sdk/ai-skill) for the right variable name per framework.
</Warning>

## What you can do

<CardGroup cols={2}>
  <Card title="Event Tracking" icon="signal-stream" href="/sdk/event-tracking">
    Automatic capture, custom events, and the semantic catalog.
  </Card>

  <Card title="Feature Tracking" icon="puzzle-piece" href="/sdk/feature-tracking">
    Map events to features and measure adoption.
  </Card>

  <Card title="Conversions" icon="bullseye" href="/sdk/conversions">
    Capture leads and goals, attributed across sessions.
  </Card>

  <Card title="CDN & Infrastructure" icon="server" href="/sdk/infrastructure">
    How the SDK is distributed and how events reach the server.
  </Card>

  <Card title="SDK Reference" icon="book" href="/sdk/reference">
    Every method and init option.
  </Card>
</CardGroup>

## Core methods

### Identify

Associate a visitor with traits. Call when a user logs in or updates their profile.

```typescript theme={null}
orwel.identify({ email: 'user@example.com', name: 'Jane Doe', plan: 'premium' });
```

### Track

Record a custom event for any user action.

```typescript theme={null}
orwel.track('feature_used', { feature_name: 'dark_mode', source: 'settings_panel' });
```

### Conversion

Record a high-value outcome — enriched into a lead. `conversion()` is async: it
waits for the visitor id to resolve, then returns the server-acknowledged result.

```typescript theme={null}
const { success } = await orwel.conversion('purchase', { amount: 99.0, currency: 'USD' });
```

### Session

Update session properties.

```typescript theme={null}
orwel.session({ cart_value: 150.0, current_step: 'checkout' });
```
