Respectlytics Respect lytics
Menu
Swift (iOS) Checkout start Privacy-first

How to track checkout-start events in Swift (iOS) without personal data

Checkout start — the moment a user transitions from cart to payment — is the narrowest mid-funnel signal in mobile commerce. Most analytics SDKs ingest cart total, line-item count, and shipping address at this point, often containing the user's full name and address. Respectlytics helps developers avoid collecting personal data in the first place: in Swift (iOS), checkout start is one named event, fired when the checkout flow begins. Below: where to wire the call, what address / payment data stays in commerce, and how to compute checkout drop-off.

Fire when the user navigates from cart to the first checkout screen — or, in single-screen checkouts, when they tap the primary CTA to begin entering address or payment. Don't pass the cart total, the address, or the saved payment method.

Install the Swift (iOS) SDK

swift Respectlytics
// Package.swift
dependencies: [
    .package(url: "https://github.com/respectlytics/respectlytics-swift.git", from: "3.0.0")
]
// Or via Xcode → File → Add Packages → paste the URL above.

The SDK ships only via Swift Package Manager. CocoaPods and Carthage are not published — fewer integration paths means fewer surfaces to keep audited.

Initialize Respectlytics in Swift (iOS)

swift Respectlytics
import Respectlytics

@main
struct MyApp: App {
    init() {
        Respectlytics.configure(appKey: "<YOUR_APP_KEY>")
    }
    var body: some Scene { WindowGroup { ContentView() } }
}

Call configure once at app launch — typically in your App struct's init. No Info.plist keys are required: the SDK does not call ATTrackingManager and does not request the IDFA, so NSUserTrackingUsageDescription should NOT be added.

Track the event in Swift (iOS)

swift Respectlytics
import Respectlytics
import SwiftUI

struct CartView: View {
    var body: some View {
        VStack {
            // ... cart line items ...
            Button("Checkout") {
                Respectlytics.track("checkout_start")
                navigateToCheckout()
            }
        }
    }
}

Distinct event names if you support multiple checkout flows: checkout_start_guest vs checkout_start_authenticated.

Privacy & implementation notes

Shipping address is unambiguous personally identifiable information under every privacy regulation that exists. The Address field is rejected by Respectlytics's API at the boundary — it never reaches storage, and the rejection happens with a 400 that's visible in your integration tests. Mirror the address into your commerce database, where it has a legitimate purpose (shipping the order) and proper access controls.

Apple Pay and Google Pay completion rates routinely outperform card-entry rates by 20–40 percentage points. Distinct event names per payment method let you see this delta directly in your funnel. Foregrounding the wallet option in checkout is one of the highest-leverage UX changes in mobile commerce.

Apple rejected approximately 3% of apps in 2024 for incorrectly omitting NSUserTrackingUsageDescription when ATT was required by the SDKs they shipped. Respectlytics doesn't trigger ATT. The corollary is also true: do not add the key on Respectlytics's account — its presence implies you track across apps, even if your code never calls requestTrackingAuthorization.

Internally the Swift SDK uses Swift Concurrency: events are queued in an actor-isolated buffer (RAM-only), flushed on a 30-second timer and on UIApplication.willResignActiveNotification. Force-quit before flush drops queued events — by design. There is no UserDefaults or file backing.

How this compares to other analytics SDKs

Checkout start eventFirebase AnalyticsMixpanelRespectlytics
Cart total / currencyRecommendedRecommendedRejected by API
Item count in cartRecommendedRecommendedRejected by API
Shipping address as event propertyPossiblePossibleForbidden (PII)
Saved payment method typeRecommendedRecommendedUse distinct event_name
Cart → checkout-start funnel ratePer-userPer-userSession-grouped

Frequently asked questions

How do we know average cart value at checkout-start without storing total?

Your commerce backend computes that — and it has the authoritative number with refund-aware totals. Respectlytics is for the rate signal; the monetary-value signal lives in commerce. Both are useful; conflating them produces drift.

Can we still differentiate guest checkout from logged-in checkout?

Distinct event names: checkout_start_guest, checkout_start_authenticated. The two flows have different completion rates and different optimization targets, so splitting them is worth it.

What about Apple Pay / Google Pay vs card?

If you instrument the payment-method choice, distinct event names: checkout_payment_apple_pay, checkout_payment_card. Most teams find Apple/Google Pay completion rates 20–40% higher; that delta is a strong case for foregrounding the wallet option.

Should we instrument address-entry abandonment specifically?

Useful in long flows. Fire checkout_shipping_address_entered when the user moves past address. The rate from checkout_start to that event is your address-form drop-off signal; address forms are notorious abandonment surfaces.

Related guides

Track what matters. Collect nothing you don't.

Five-field event schema, RAM-only event queue, no IDFA, no AAID, no persistent user IDs. Helps developers avoid collecting personal data in the first place.