How to add Amplitude to an iOS app
What Amplitude does for an iOS app
Amplitude answers behavioral questions: which steps users complete before subscribing, where they drop off in onboarding, and how many return after a week. You instrument the app by naming events and sending properties with them, then build funnels and retention charts in the Amplitude dashboard. The value is less about the SDK and more about choosing a small set of events that map to real decisions, like activation and conversion, so you avoid drowning in noise. It pairs well with a paywall or subscription, where conversion events drive the analysis.
Adding Amplitude with AppFlight
In AppFlight you open the integrations panel, choose Amplitude, and paste your project API key from the Amplitude settings. AppFlight stores it as a client key, which is safe to ship, because the SDK key only writes events in and cannot read or export your data. AppFlight never treats it as a backend secret. You can then ask the AI to track an event when a user finishes onboarding or starts a trial, and it generates the SwiftUI call. Even with a client key, avoid putting sensitive personal data in event properties.
A SwiftUI example
Create one Amplitude instance at launch, then track events from your views:
import SwiftUI
import AmplitudeSwift
@main
struct MyApp: App {
static let amplitude = Amplitude(
configuration: Configuration(apiKey: "YOUR_AMPLITUDE_API_KEY")
)
var body: some Scene {
WindowGroup { ContentView() }
}
}
struct ContentView: View {
var body: some View {
Button("Start trial") {
MyApp.amplitude.track(
eventType: "Trial Started",
eventProperties: ["plan": "pro"]
)
}
}
}
Keep event names stable and consistent, since renaming them later splits your historical data into separate series.
Alternatives
Mixpanel covers similar event analytics with fast ad hoc reporting, and PostHog adds session replay and feature flags while being open-source and self-hostable. Firebase Analytics is free and tightly tied to the Google stack if you already use Firebase. Amplitude is the strongest pick when retention, cohort, and behavioral analysis are the core of how you make product decisions.
FAQ
Is the Amplitude API key a secret?
No. The iOS SDK uses a write-only ingestion key that only sends events in, so it is safe to ship in the app, the same model as PostHog and Mixpanel. The keys that can read or export data are separate and stay server-side. AppFlight stores the SDK key as a client key.
Does Amplitude track screens automatically?
The Swift SDK can autocapture sessions, app lifecycle, and some interactions depending on configuration, but the events that matter for product analysis are usually ones you name and track yourself, like Trial Started or Note Saved.
Amplitude, Mixpanel, or PostHog?
All three do event analytics and funnels well. Amplitude is strong on behavioral cohorts and retention analysis, Mixpanel on fast exploratory reports, and PostHog on being open-source and self-hostable. The SDK setup is similar across them.