> For the complete AppRefer docs index, see https://apprefer.com/llms.txt (every page as markdown) or https://apprefer.com/llms-full.txt (all docs in one file).

# Quickstart

From an empty dashboard to your first attributed install, on iOS, Android, Flutter or React Native.

You need an AppRefer account and an app you can build. Each step below shows all four SDKs; pick your platform's tab. The full references are [iOS](https://apprefer.com/docs/sdk/ios.md), [Android](https://apprefer.com/docs/sdk/android.md), [Flutter](https://apprefer.com/docs/sdk/flutter.md) and [React Native](https://apprefer.com/docs/sdk/react-native.md).

> **Working with an AI coding agent?**
>
> Agents can create the app, tracking links and integrations for you through AppRefer's MCP server and REST API. See [AI agents and MCP](https://apprefer.com/docs/mcp.md), then come back for the in-app steps (install and configure).

## 1\. Create an app and copy its key

In the dashboard, add your app (its App Store and Google Play links help AppRefer route clicks and show store details). Its SDK keys are on the app's **Settings** page, where you can also copy or rotate them. Each app has two:

-   `pk_live_…` for release builds: real attribution, events forwarded to your ad networks.
-   `pk_test_…` for development: sandbox data, shown in the Debugger's sandbox view and never forwarded.

SDK keys are public by design (they ship inside your app). Keep organisation API keys (`ak_…`) on your server.

## 2\. Install the SDK

**iOS**

```swift
// Xcode: File > Add Package Dependencies…
// https://github.com/AppAgentic/apprefer-ios-sdk  (from 0.11.0, product "AppRefer")

// or Package.swift
.package(url: "https://github.com/AppAgentic/apprefer-ios-sdk", from: "0.11.0")
```

**Android**

```kotlin
// settings.gradle.kts
dependencyResolutionManagement {
    repositories { google(); mavenCentral(); maven("https://jitpack.io") }
}

// app/build.gradle.kts
dependencies {
    implementation("com.github.AppAgentic.apprefer-android-sdk:apprefer-android-sdk:0.11.0")
    // with AppRefer Billing instead:
    // implementation("com.github.AppAgentic.apprefer-android-sdk:apprefer-billing:0.11.0")
}
```

**Flutter**

```yaml
# pubspec.yaml
dependencies:
  apprefer:
    git:
      url: https://github.com/AppAgentic/apprefer-flutter-sdk.git
      ref: 0.11.0

# then: flutter pub get
```

**React Native**

```bash
npm install github:AppAgentic/apprefer-react-native-sdk#0.11.0 @react-native-async-storage/async-storage
cd ios && pod install
```

iOS (including Flutter and React Native) needs iOS 15 or later. Expo apps need a development build.

## 3\. Configure at launch

Call `configure` once, as early as possible. The first launch resolves attribution; later launches return the cached result. It never throws.

**iOS**

```swift
import AppRefer

@main
struct MyApp: App {
    init() {
        Task { await AppRefer.configure(apiKey: "pk_test_...") }
    }
    var body: some Scene { WindowGroup { ContentView() } }
}
```

**Android**

```kotlin
import com.apprefer.sdk.AppRefer

class App : Application() {
    override fun onCreate() {
        super.onCreate()
        CoroutineScope(Dispatchers.IO).launch {
            AppRefer.configure(this@App, apiKey = "pk_test_...")
        }
    }
}
```

**Flutter**

```dart
import 'package:apprefer/apprefer.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await AppReferSDK.configure(const AppReferConfig(apiKey: 'pk_test_...'));
  runApp(const MyApp());
}
```

**React Native**

```typescript
import { AppRefer } from '@apprefer/react-native-sdk';

// in your root component
useEffect(() => {
  AppRefer.configure({ apiKey: 'pk_test_...' });
}, []);
```

When someone signs in, call `setUserId` with your app's user id so Support and product events carry the account.

> **iOS privacy manifest**
>
> Declare only `trk.apprefer.com` under `NSPrivacyTrackingDomains` in `PrivacyInfo.xcprivacy`. Never add `apprefer.com`: it carries the first-party requests (analytics, Billing, Support) that must keep working when a user doesn't allow tracking. The SDK reads App Tracking Transparency but never shows the prompt; if your app shows it, call `trackingConsentDidChange()` afterwards. On Android, pass your consent flow's answer to `setTrackingConsent`.

## 4\. Create a tracking link

In the dashboard, open your app's **Links** page and create a link for each campaign: pick the network and name it. Use the generated URL as the ad's destination. It records the click (with the network's click id) and sends the user to the right store.

-   Meta, TikTok and most networks: `https://apprefer.com/api/c/<linkId>`
-   Google Ads: `https://apprefer.com/g/<linkId>`, a landing page with store buttons that Google accepts as a final URL
-   ChatGPT Ads: `https://apprefer.com/o/<linkId>`

Store page overrides, custom product pages and UTM handling are in [Tracking links](https://apprefer.com/docs/tracking-links.md).

## 5\. Connect your ad networks

Under **Settings → Integrations**, connect each network you want conversions sent to (Meta, Google Ads, TikTok, ChatGPT Ads). On iOS, Apple Ads installs are matched through AdServices, with no setup. Each guide lists exactly what to paste: [Integrations](https://apprefer.com/docs/integrations.md).

## 6\. Check it in the Debugger

Run a build with the `pk_test_` key and open the **Debugger** with the sandbox view on. The configure call and its attribution appear within seconds; tracked events follow. To test a real match, tap your tracking link on the device first, then install and open the app. Switch to `pk_live_` for release.

## 7\. Optional: subscriptions with AppRefer Billing

AppRefer Billing handles App Store, Google Play and Stripe subscriptions itself: it verifies purchases, keeps entitlements and sends each conversion to your ad networks from the same attribution. Turn it on for the app first (store credentials and products), as described in [Billing](https://apprefer.com/docs/billing.md); paywall setup is in [Offerings](https://apprefer.com/docs/offerings.md).

**iOS**

```swift
AppReferBilling.configure(entitlementsByProduct: ["pro_yearly": ["premium"]])

let offering = try await AppReferBilling.offerings().currentOffering(forPlacement: "onboarding")
if let annual = offering?.annual {
    _ = try await AppReferBilling.purchase(package: annual)
}
let premium = await AppReferBilling.customerInfo().entitlements["premium"]?.isActive == true
```

**Android**

```kotlin
AppReferBilling.configure(context, entitlementsByProduct = mapOf("pro_yearly" to listOf("premium")))

val annual = AppReferBilling.offerings().currentOffering(forPlacement = "onboarding")?.annual
if (annual != null) AppReferBilling.purchase(activity, annual)
val premium = AppReferBilling.customerInfo().entitlements["premium"]?.isActive == true
```

**Flutter**

```dart
await AppReferBilling.configure(entitlementsByProduct: {'pro_yearly': ['premium']});

final annual = (await AppReferBilling.offerings()).currentOffering('onboarding')?.annual;
if (annual != null) await AppReferBilling.purchasePackage(annual);
final premium = (await AppReferBilling.customerInfo()).entitlements['premium']?.isActive == true;
```

**React Native**

```typescript
import { AppReferBilling } from '@apprefer/react-native-sdk/billing'; // needs react-native-iap 17+

await AppReferBilling.configure({ entitlementsByProduct: { pro_yearly: ['premium'] } });

const annual = (await AppReferBilling.offerings()).currentOffering('onboarding')?.annual;
if (annual) await AppReferBilling.purchasePackage(annual);
const premium = !!(await AppReferBilling.customerInfo()).entitlements.active.premium;
```

When a user signs in or out, also call Billing's `logIn` / `logOut`. Already on RevenueCat? Keep it running and send its webhook to AppRefer ([RevenueCat](https://apprefer.com/docs/integrations/revenuecat.md)), or move over without a data export as the Billing page explains.

## 8\. Optional: in-app Support

A help chat your team answers from the AppRefer inbox, with reply notifications, a help centre and an optional AI assistant. Set it up in [Support](https://apprefer.com/docs/support.md), then open it from a Help button:

**iOS**

```swift
AppRefer.support.open()
```

**Android**

```kotlin
AppRefer.support.open()
```

**Flutter**

```dart
await AppReferSDK.support.open(context: context);
```

**React Native**

```tsx
// Mount once next to your navigation: <AppReferSupportHost />
AppRefer.support.open();
```

## Next steps

-   Track the moments that matter with `trackEvent`: [Events](https://apprefer.com/docs/events.md).
-   Understand how installs are matched: [Attribution](https://apprefer.com/docs/attribution.md).
-   Handle consent and account switching (`setCollectionEnabled`, `reset()`): see your platform's SDK page and [Privacy](https://apprefer.com/docs/privacy.md).
-   Automate setup and reporting: [REST API](https://apprefer.com/docs/api.md) and [AI agents and MCP](https://apprefer.com/docs/mcp.md).

**Check an install from your terminal (test key)**

```bash
curl -X POST https://apprefer.com/api/track/configure \
  -H "Content-Type: application/json" \
  -H "X-AppRefer-Key: pk_test_..." \
  -d '{"device_id": "quickstart-test-001"}'
```

---

Source: https://apprefer.com/docs/quickstart · Last updated: 2026-10-19
