# Kixo SDK Instructions

Use these instructions when integrating Kixo into this app.

## Product Context

Kixo is a B2B analytics, campaigns, and AI-chat platform. This app belongs to a customer company. The company's team members use Kixo; this app's end users do not log in to Kixo.

## Choose One SDK

- Web: `https://cdn.kixo.io/kixo.min.js` (script embed; npm `@kixo.io/web`)
- iOS: Swift Package `https://github.com/kixoio/kixo-ios-sdk`, then `import Kixo`
- Android: Maven repo `https://raw.githubusercontent.com/kixoio/kixo-android-sdk/main/repo`, dependency `io.kixo:kixo-android-sdk:0.1.17`, then `import io.kixo.sdk.Kixo`

## Configure Once

Configure Kixo once at app startup.

Web:

```html
<script type="module" src="https://cdn.kixo.io/kixo.min.js"></script>
<script type="module">
  Kixo.init({
    projectId: 'YOUR_PROJECT_ID',
    apiKey: 'YOUR_API_KEY',
  });
</script>
```

iOS:

```swift
import Kixo

Kixo.configure(
    projectId: "YOUR_PROJECT_ID",
    apiKey: "YOUR_API_KEY"
)
```

Android:

```kotlin
import io.kixo.sdk.Kixo

Kixo.configure(this, "YOUR_PROJECT_ID", "YOUR_API_KEY")
```

## Instrumentation Rules

- Use dashboard Project ID and SDK API key placeholders unless the user provides real values.
- Never commit real keys.
- Never use dashboard/admin tokens in client apps.
- Do not duplicate Kixo's auto-tracked page, screen, session, click, tap, error, crash, or push lifecycle events.
- Add custom events only for product-specific actions.
- Use one event per user action.
- Put context in properties.
- Use snake_case, object_verb, past tense.
- Use the same names across Web, iOS, and Android.
- Include stable entity IDs such as `post_id`, `order_id`, `video_id`.
- Prefer standard events or typed helpers: `signup`, `activation`, `purchase`, `subscribe_start`, `subscribe_renewed`, `trial_start`, `cancel`, `upgrade`, `downgrade`, `share`, `invite`.

## Identity

- Call `identify` only when a stable product user ID is known.
- Put email, name, and plan in traits such as `$email`, `$name`, `$plan`.
- Use boolean user properties for durable segmentation tags, such as `subscribe` and `vip`.
- Call `reset` on logout.

## Data Collection

- Replay is enabled from Kixo project settings.
- Mouse-move heatmaps are disabled by default.
- The SDK collects the trackers enabled by the customer and the events and properties their application sends.
- Use only APIs listed in the current platform SDK reference; do not invent policy controls.
- Do not expose or document internal Kixo dev-routing flags.

## Verify

Trigger one auto event and one custom event, check `diagnostics()` where available, and confirm events in the Kixo dashboard or chat.
