Privacy-First Analytics
for Swift
Add analytics to your iOS or macOS app in 2 lines of code. No IDFA, no IDFV, no device fingerprints. Works with SwiftUI and UIKit.
import RespectlyticsSwift
// 1. Configure once at app launch
Respectlytics.configure(apiKey: "your-api-key")
// 2. Track events anywhere
Respectlytics.track("purchase_completed")
Self-hosting? Point to your own server: Respectlytics.configure(apiKey: "key", apiEndpoint: "https://your-server.com") Β· Learn more
Installation
Add the SDK using Swift Package Manager
Option 1: Xcode UI
In Xcode, go to File β Add Package Dependencies and enter:
https://github.com/respectlytics/respectlytics-swift.git
Option 2: Package.swift
Add to your Package.swift dependencies:
dependencies: [
.package(url: "https://github.com/respectlytics/respectlytics-swift.git", from: "3.0.0")
]
Platform Requirements
Quick Start
Works with both SwiftUI and UIKit
SwiftUI App Lifecycle
import SwiftUI
import RespectlyticsSwift
@main
struct MyApp: App {
init() {
Respectlytics.configure(
apiKey: "your-api-key"
)
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
UIKit App Delegate
import UIKit
import RespectlyticsSwift
@main
class AppDelegate: UIResponder,
UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions opts: ...
) -> Bool {
Respectlytics.configure(
apiKey: "your-api-key"
)
return true
}
}
Why Respectlytics for Swift?
Unlike Firebase Analytics, we help you avoid collecting data you don't need
Firebase Analytics
FirebaseAnalytics
- β οΈ Collects IDFA (with ATT prompt)
- β οΈ Collects IDFV persistently
- β οΈ Unlimited custom parameters (PII risk)
- β οΈ Complex Privacy Label requirements
- π CocoaPods/SPM with Google dependencies
Respectlytics
RespectlyticsSwift
- β No IDFA β no ATT prompt needed
- β No IDFV or device fingerprints
- β 5 fields only (API rejects extras)
- β Simple Privacy Label: "Not Linked"
- π‘οΈ Pure Swift, zero dependencies
API Reference
Simple by design. Just 3 methods.
| Method | Description |
|---|---|
configure(apiKey:)
|
Initialize the SDK. Call once at app launch |
track(_:)
|
Track an event. Custom properties not supported (by design) |
flush()
|
Force send queued events. Rarely neededβSDK auto-flushes |
Full SwiftUI Example
A complete SwiftUI app with analytics integration
import SwiftUI
import RespectlyticsSwift
@main
struct MyApp: App {
init() {
// Configure SDK at launch
Respectlytics.configure(apiKey: "your-api-key")
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
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()
}
}
App Store Privacy Label
Simple disclosure β our SDK makes it easy
Data Type
Analytics
Linked to User
No
Used to Track
No
Privacy Architecture
Transparent about exactly what data is collected
β What We Store (5 fields)
-
event_nameThe action being tracked -
timestampWhen it happened -
session_idRAM-only, 2-hour rotation -
platformiOS, macOS, etc.
Country is derived server-side from IP, then IP is immediately discarded.
β What We DON'T Collect
-
β
IDFA
No ATT prompt needed
-
β
IDFV
No persistent vendor ID
-
β
IP addresses
Processed transiently only
-
β
Custom properties
API rejects extra fields
Our motto is Return of Avoidance (ROA) β the best way to protect sensitive data is to never collect it. Consult your legal team to determine your specific requirements.
Frequently Asked Questions
Does the SDK collect IDFA? βΌ
Does it work with SwiftUI? βΌ
@main App struct,
configure in your init(). For UIKit apps, configure in
application(_:didFinishLaunchingWithOptions:).
How do I fill out the App Store privacy label? βΌ
Which Apple platforms are supported? βΌ
How do I migrate from Firebase Analytics? βΌ
Analytics.logEvent() calls with
Respectlytics.track().
Remove any Analytics.setUserID() or Analytics.setUserProperty() calls β Respectlytics uses automatic session-based tracking.
See our migration guide for details.
Why can't I send custom properties? βΌ
Other SDKs: Flutter β’ React Native β’ Kotlin β’ Full Documentation
Ready to Add Analytics?
Get started in under 5 minutes. No credit card required.
β’In-depth guides for Swift (iOS)
Per-property guides for the Swift SDK β no IDFA, no ATT prompt, RAM-only event queue, EU data residency, and more.
- How to add Swift (iOS) analytics with no IDFA collection Add analytics to a Swift (iOS) app without collecting Apple's IDFA. Helps developers avoid collecting personal data in β¦
- How to add Swift (iOS) analytics with no ATT prompt Add analytics to a Swift (iOS) iOS app without showing the App Tracking Transparency prompt. No NSUserTrackingUsageDescβ¦
- How to add Swift (iOS) analytics with no third-party trackers Add analytics to a Swift (iOS) app without any third-party tracker dependencies in your supply chain.
- How to add Swift (iOS) analytics with zero device storage Add analytics to a Swift (iOS) app without writing a single byte to disk. RAM-only event queue.
- How Swift (iOS) analytics works with a RAM-only event queue Swift (iOS) analytics events are held in memory only β flushed every 30 seconds, lost on force-quit by design.
- How to add Swift (iOS) analytics with a 5-field event schema Add analytics to a Swift (iOS) app where every event stores only 5 fields. Extra fields are rejected at the API.
- How Swift (iOS) analytics handles geolocation (country only) Swift (iOS) analytics with country-level geolocation only. IPs are processed transiently for country lookup, then discaβ¦
- How Swift (iOS) analytics rotates session IDs every 2 hours Swift (iOS) analytics rotates session IDs automatically every two hours and on app restart. No persistent user ID.
β’How to track common events in Swift (iOS)
Privacy-first tracking patterns for the events that matter most in iOS apps.
- How to track paywall conversion in Swift (iOS) without personal data A privacy-first pattern for tracking paywall conversion in Swift (iOS) apps with Respectlytics. No IDFA, no AAID, no usβ¦
- How to track onboarding completion in Swift (iOS) without personal data Track onboarding completion in Swift (iOS) using Respectlytics's 5-field event schema. Helps developers avoid collectinβ¦
- How to track sign-up events in Swift (iOS) without personal data Track account creation in Swift (iOS) apps with Respectlytics. No user_id, no email, no signup method as metadata. Helpβ¦
- How to track push notification opt-in in Swift (iOS) without personal data Track when Swift (iOS) users grant push notification permission. Privacy-first pattern with Respectlytics β no device tβ¦
- How to track paywall views in Swift (iOS) without personal data Track paywall impressions in Swift (iOS) apps with Respectlytics. Session-scoped reach, no per-user attribution, no PII.
- How to track trial-start events in Swift (iOS) without personal data Track trial activation in Swift (iOS) apps with Respectlytics. No user_id, no email, no payment-method metadata. Sessioβ¦
- How to track trial-to-paid conversion in Swift (iOS) without personal data Track trial-to-paid conversion in Swift (iOS) apps with Respectlytics. Session-scoped event, no transaction IDs, no useβ¦
- How to track subscription renewals in Swift (iOS) without personal data Track subscription renewals in Swift (iOS) apps with Respectlytics. Session-scoped retention signal, no MRR mixing, no β¦