astronaut
ProductPricingDocs
Sign in
Overview
IntroductionGetting started
Install
iOS SDKSource attributionCreator attribution
Using astronaut
The dashboardIdentifying usersEnvironmentsPush notifications

iOS SDK (Swift)

The SDK is a Swift package (iOS 16+). Add it in Xcode via File → Add Package Dependencies… using the Astronaut package URL, then import Astronaut.

1. Configure once, at launch

import Astronaut

@main
struct YourApp: App {
    init() {
        Astronaut.shared.configure(
            AstronautConfiguration(trackingId: "naut_xxxxxxxx")
        )
    }
    // ...
}

2. Track app opens

Call this when your app becomes active. The first call per install is flagged automatically, which powers install attribution.

Astronaut.shared.trackAppOpen()

3. Track purchases (revenue)

Astronaut.shared.trackPurchase(
    revenue: 9.99,
    currency: "USD"
)

Revenue rolls up across the Overview, traffic source/referrer, creators, and the per-user journey, converted to a single display currency.

4. Custom events

Astronaut.shared.send(
    eventType: "completed_onboarding",
    metadata: ["plan": "pro"]
)

5. Identify users (optional)

By default the dashboard shows an anonymous handle per device. Once you know who the user is (e.g. after sign-in), call identify to attach a real name/email — it then appears on the user journey. Only send identity you have a lawful basis to process; see the privacy policy.

Astronaut.shared.identify(
    email: "jane@acme.com",
    name: "Jane Doe",
    traits: ["plan": "pro"]
)

The SDK tags every event with the build environment and your app's version (CFBundleShortVersionString) automatically, so you can segment activity by release — see Environments. To send notifications, see Push notifications.

← PreviousGetting startedNext →Source attribution
astronaut
Product
FeaturesPricingDocsLive demo
Legal
PrivacyTerms
© 2026 astronaut.shhello@astronaut.sh