Integration
iOS SDK integration
Swift Package Manager, App init, bundle and Team ID allowlist, and first-session verification.
Measure native UIKit and SwiftUI screens with the same Tracuto project, replay, and friction analysis.
1. Choose iOS on Complete Setup
In the dashboard, open Complete setup and select iOS app as your measurement surface. This locks verification to mobile ingest for this project.
2. Add the Swift package and initialize
Add tracuto-ios-sdk via Swift Package Manager, call Tracuto.initialize in your @main App, install TracutoRecording, and set recording consent.
3. Allowlist bundle ID and Team ID
In Project settings, add CFBundleIdentifier and your 10-character Apple Team ID. Ingest rejects builds that do not match.
4. Run the app once
Complete setup verifies automatically when the first iOS event arrives. Confirm sessions appear under Analytics → Sessions.
Swift Package Manager
dependencies: [
.package(url: "https://github.com/koha-tech-ltd/tracuto-ios-sdk-spm.git", from: "1.0.0"),
],
targets: [
.target(
name: "YourApp",
dependencies: [
.product(name: "TracutoProtocol", package: "tracuto-ios-sdk"),
.product(name: "TracutoCore", package: "tracuto-ios-sdk"),
.product(name: "TracutoAnalytics", package: "tracuto-ios-sdk"),
.product(name: "TracutoRecording", package: "tracuto-ios-sdk"),
.product(name: "TracutoSwiftUI", package: "tracuto-ios-sdk"),
],
),
]App init
@main
struct YourApp: App {
init() {
Tracuto.initialize(
TracutoConfig(
projectId: "YOUR_PROJECT_ID",
publishableKey: "pk_live_…",
endpoint: "https://YOUR_INGEST_HOST",
recordingEnabled: true,
consentRequired: true
)
)
TracutoRecording.install()
Tracuto.setRecordingConsent(granted: userHasAnalyticsConsent())
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}Replace placeholders with values from Complete setup (iOS path).
SwiftUI screens
struct HomeView: View {
var body: some View {
VStack {
Text("Welcome")
}
.tracutoScreen("/home", title: "Home")
.tracutoTag("home_root")
}
}Track and convert
Tracuto.track("add_to_cart", properties: ["sku": "SKU-4421"])
Tracuto.conversion("purchase_completed", value: 84.5, properties: ["currency": "USD", "orderId": "ord_123"])
TracutoAnalytics.screenView(route: "/product/4421", title: "Product")See Conversions and Identity for revenue and login patterns.
Bundle allowlist
Add your app bundle ID and Apple Team ID below. Mobile ingest rejects traffic that does not match the allowlist.
| Platform | Fields | Where |
|---|---|---|
| iOS | bundleId + teamId (10 chars) | Project settings → iOS native SDK, or Complete setup stage 2 |
Verify
- Use a publishable ingest key (pk_live_*) in the app — never embed secret keys.
- Confirm Complete setup shows verification after the first mobile session.
- Open Analytics → Sessions and filter by platform badge (Android or iOS).
- Native replay requires a native_snapshot event — ensure recording consent is granted.
SDK methods
| Method | Signature | When | Notes |
|---|---|---|---|
| Tracuto.initialize | initialize(TracutoConfig) | @main App init | Required once; pass projectId, pk_live publishable key, and ingest endpoint from the dashboard |
| TracutoRecording.install | install() | After initialize | Captures UIKit/SwiftUI TNVT snapshots and native taps for replay |
| Tracuto.setRecordingConsent | setRecordingConsent(granted:) | Before recording | Required when consentRequired is true in config |
| Tracuto.track | track(_:properties:) | Custom product events | Prefer TracutoAnalytics.screenView for route-based screen tracking |
| Tracuto.conversion | conversion(_:value:properties:) | Funnel outcomes | Revenue in value; currency and order metadata in properties |
| Tracuto.identify | identify(userId:traits:) | After login | Stitches sessions to your account id and custom attributes |
AI assistant prompt
Integrate the Tracuto iOS SDK in this codebase.
Documentation:
- iOS guide: https://tracuto.com/integrate/ios
- Conversions: https://tracuto.com/integrate/conversions
- Identity: https://tracuto.com/integrate/identity
Before writing code:
1. Ask me for projectId, ingest endpoint, and pk_live_* publishable key from Tracuto Complete setup (iOS path).
2. Ask for bundle ID and Apple Team ID for the allowlist.
3. Ask whether recording requires explicit consent before capture starts.
Implementation rules:
- Add tracuto-ios-sdk via SPM using the dashboard package URL and products.
- Initialize in @main App init; call TracutoRecording.install() after initialize.
- Gate recording with Tracuto.setRecordingConsent(granted:) when consentRequired is true.
- Use Tracuto.track / conversion for business events; SwiftUI screens via tracutoScreen().
- Wire identify after login. Never embed sk_live_* keys.
When done, list files changed and how to verify in Complete setup.