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

# Quickstart

> Get SpendOwl running in 2 minutes

## 1. Install the SDK

Add SpendOwl to your project using Swift Package Manager:

```
https://github.com/spendowl/spendowl-ios
```

<Steps>
  <Step title="Open Your Project">
    In Xcode, go to **File → Add Package Dependencies...**
  </Step>

  <Step title="Enter the URL">
    Paste `https://github.com/spendowl/spendowl-ios`
  </Step>

  <Step title="Add to Target">
    Select your app target and click **Add Package**
  </Step>
</Steps>

## 2. Configure on App Launch

<Tabs>
  <Tab title="SwiftUI">
    ```swift theme={null}
    import SwiftUI
    import SpendOwl

    @main
    struct MyApp: App {
        init() {
            SpendOwl.configure(apiKey: "your-api-key")
        }

        var body: some Scene {
            WindowGroup {
                ContentView()
            }
        }
    }
    ```
  </Tab>

  <Tab title="UIKit">
    ```swift theme={null}
    import UIKit
    import SpendOwl

    @main
    class AppDelegate: UIResponder, UIApplicationDelegate {
        func application(
            _ application: UIApplication,
            didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
        ) -> Bool {
            SpendOwl.configure(apiKey: "your-api-key")
            return true
        }
    }
    ```
  </Tab>
</Tabs>

<Info>
  Get your API key from the [SpendOwl Dashboard](https://spendowl.io/dashboard).
</Info>

## 3. That's It!

SpendOwl now:

* Fetches attribution data from Apple Search Ads
* Tracks StoreKit 2 purchases automatically
* Sends data to your dashboard for ROAS calculation

## Optional: Get Attribution Data

Access attribution data to display campaign info or for analytics:

```swift theme={null}
Task {
    do {
        let attribution = try await SpendOwl.attribution()
        print("Campaign: \(attribution.campaignName ?? "organic")")
    } catch {
        print("Error: \(error)")
    }
}
```

## Optional: Link User Identity

Associate attribution and purchases with your user accounts:

```swift theme={null}
// After user logs in
SpendOwl.setUserId("user-123")

// On logout
SpendOwl.clearUserId()
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Configuration" icon="gear" href="/sdk/configuration">
    Customize timeouts, retries, and more
  </Card>

  <Card title="Attribution" icon="bullseye" href="/sdk/attribution">
    Learn about attribution data
  </Card>

  <Card title="SwiftUI Example" icon="swift" href="/examples/swiftui">
    See a complete SwiftUI app
  </Card>

  <Card title="Troubleshooting" icon="wrench" href="/resources/troubleshooting">
    Common issues and solutions
  </Card>
</CardGroup>
