Respectlytics Respect lytics
Menu

Privacy-first analytics for Swift

Two calls add analytics to an iOS or macOS app: configure once, then track events. No IDFA, no IDFV, no device fingerprints. Works with SwiftUI and UIKit.

14-day free trial, no credit card.

MyApp.swift
import RespectlyticsSwift

// 1. Configure once at app launch
Respectlytics.configure(apiKey: "your-api-key")

// 2. Track events anywhere
Respectlytics.track("purchase_completed")

Install

Add the package with Swift Package Manager, in Xcode or in Package.swift.

In Xcode, choose File, then Add Package Dependencies, and enter this URL:

Package URL
https://github.com/respectlytics/respectlytics-swift.git

Or add it to your Package.swift dependencies:

Package.swift
dependencies: [
    .package(
        url: "https://github.com/respectlytics/respectlytics-swift.git",
        from: "3.0.0"
    )
]
Runs on iOS 15+macOS 12+Swift 5.9+Xcode 15+

Configure once, track anywhere

Call configure() when the app starts, in SwiftUI or UIKit, then track() wherever something happens.

MyApp.swift (SwiftUI)
import SwiftUI
import RespectlyticsSwift

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

    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}
AppDelegate.swift (UIKit)
import UIKit
import RespectlyticsSwift

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
    func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions:
            [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
        Respectlytics.configure(apiKey: "your-api-key")
        return true
    }
}
ContentView.swift
import SwiftUI
import RespectlyticsSwift

struct ContentView: View {
    var body: some View {
        VStack(spacing: 20) {
            Button("Sign Up") {
                Respectlytics.track("signup_started")
            }
            .buttonStyle(.borderedProminent)

            Button("Make Purchase") {
                Respectlytics.track("purchase_completed")
            }
            .buttonStyle(.borderedProminent)
        }
        .padding()
    }
}

Hosting the server yourself? Pass its address to configure(). The open source edition runs the same server.

MyApp.swift
Respectlytics.configure(
    apiKey: "your-api-key",
    apiEndpoint: URL(string: "https://analytics.example.com/api/v1/events/")!
)

The whole API

Three methods. An event carries its name and nothing else.

configure(apiKey:)
Starts the SDK. Call it once when the app launches.
track(_:)
Records an event. There are no properties, by design.
flush()
Sends queued events now. Rarely needed: the SDK sends every 30 seconds, when 10 events are queued, and when the app goes to the background.

What leaves the app

Five fields per event, the same in every SDK. The API refuses anything else.

Stored for each event

event_name
the name you pass to track()
timestamp
when it happened
session_id
random, kept in memory, replaced every two hours and on each launch
platform
the operating system
country
looked up on the server from the IP address, which is then discarded

Never collected

  • the IDFA, the Advertising ID or any other device identifier
  • a fingerprint of the device
  • user IDs, names or emails
  • properties on events (why)
  • anything written to the device

Filling in the App Store privacy label? The privacy disclosure guide walks through each question for the data Respectlytics handles.

Coming from Firebase Analytics

The calls map one to one. The parameters and the user IDs go away.

Replace each Analytics.logEvent() with Respectlytics.track() and drop its parameters. Remove setUserId() and setUserProperty() calls: Respectlytics has no user IDs and no user properties.

Questions developers ask

What the SDK does, and what it leaves out on purpose.

Does the SDK read the IDFA?

No. It never reads the IDFA or the IDFV and does not fingerprint the device, so it gives your app no reason to show the App Tracking Transparency prompt. The only ID is a random session ID kept in memory, replaced every two hours and on each launch.

Does it work with SwiftUI and UIKit?

Yes. In a SwiftUI app, call configure() in your App's init(). In a UIKit app, call it in application(_:didFinishLaunchingWithOptions:). Then call track() from anywhere.

How do I fill in the App Store privacy label?

The privacy disclosure guide walks through each question for the data Respectlytics handles: product interaction, used for analytics, not linked to the user and not used for tracking. What your app declares as a whole depends on everything else it collects.

Which Apple platforms are supported?

iOS 15 and macOS 12 or later, built with Swift 5.9 and Xcode 15 or later.

Why can't I attach properties to an event?

Because properties are where personal data slips into analytics: an email in a parameter, a name in a label. The API accepts four fields from the app and rejects any other, so it cannot happen by accident. Put the detail you need in the event name instead, such as premium_plan_selected.

Other SDKs

The same five fields and the same three calls in each.

What sets the SDK apart

The choices behind it, and what each one means for your app.

What to track

Event plans for common funnels, with the calls in each SDK.

Try it on your own app

14-day free trial, no credit card. Unlimited apps on every plan.