npm package: @kalporg/linktracker
Description: React Native SDK for LinkTracker attribution
Author: Kalp Intelligence
Latest version: 1.0.7
Deprecated: Package renamed to @kalporg/sniffurl

# @kalporg/linktracker

React Native SDK for **LinkTracker attribution**
Track installs, signups, purchases, and other in-app events with one line.

---

## ✨ Features

* 🔗 **Attribution tracking** – installs, clicks, signups, purchases
* 📱 **Deep link support** – auto-extracts `lt_vid` from app links
* 📊 **Custom events** – send metadata with any event
* 🛠 **Lightweight SDK** – \~2 kB bundle size
* 🔒 **Secure** – works with project ID + API key

---

## 📦 Install

```bash
npm install @kalporg/linktracker
# or
yarn add @kalporg/linktracker
```

> ⚠️ This package depends on [@react-native-async-storage/async-storage](https://github.com/react-native-async-storage/async-storage).
> Run `npx pod-install` inside your iOS project after install.

---

## ⚙️ Setup

### 1. Import the SDK

```js
import { LinkTracker } from "@kalporg/linktracker";
```

### 2. Initialize with your keys

Get your **Project ID** and **API Key** from the [LinkTracker dashboard](https://linktracker.kalp.ltd).

```js
LinkTracker.init({
  projectId: "YOUR_PROJECT_ID",
  apiKey: "YOUR_API_KEY"
});
```

### 3. Handle deep links (optional)

The SDK automatically handles `lt_vid` params from URLs.
If you want to capture them manually:

```js
import { Linking } from "react-native";

Linking.addEventListener("url", (event) => {
  LinkTracker.handleUrl(event.url);
});
```

---

## 🚀 Usage

### Track installs & app opens

```js
LinkTracker.trackEvent("install");
LinkTracker.trackEvent("app_open");
```

### Track signups

```js
LinkTracker.trackEvent("signup", {
  userId: "12345",
  plan: "pro"
});
```

### Track purchases

```js
LinkTracker.trackEvent("purchase", {
  orderId: "ORD-998877",
  amount: 1499,
  currency: "INR"
});
```

### Track custom events

```js
LinkTracker.trackEvent("level_up", {
  level: 7,
  character: "wizard"
});
```

---

## 🧑‍💻 Example App

```js
import { useEffect } from "react";
import { LinkTracker } from "@kalporg/linktracker";

export default function App() {
  useEffect(() => {
    // Initialize the SDK
    LinkTracker.init({
      projectId: "kalp_12345",
      apiKey: "sk_live_abcde"
    });

    // Track first install
    LinkTracker.trackEvent("install");

    // Track app open
    LinkTracker.trackEvent("app_open");

    // Track signup event
    LinkTracker.trackEvent("signup", { userId: "U123", plan: "basic" });

    // Track purchase event
    LinkTracker.trackEvent("purchase", {
      orderId: "ORD-998877",
      amount: 1499,
      currency: "INR"
    });

    // Track custom event
    LinkTracker.trackEvent("level_up", { level: 7, character: "wizard" });
  }, []);

  return null;
}
```

---

## 🔐 Keys & Security

* Your **Project ID** and **API Key** are available in the [LinkTracker dashboard](https://linktracker.kalp.ltd).
* Keep keys safe — avoid hardcoding them in public repos.
* Use environment variables or a secure config system in production.

---

## 📞 Contact & Support

* 🌐 Website: [https://kalp.ltd](https://kalp.ltd)
* 🌐 LinkTracker Dashboard: [https://linktracker.kalp.ltd](https://linktracker.kalp.ltd)
* 📧 Email: [support@kalp.ltd](mailto:support@kalp.ltd)
* 💼 LinkedIn: [Aman Sharma](https://www.linkedin.com/in/amnshrma)

---

## 📄 License

MIT © [Kalp Intelligence](https://kalp.ltd)