iOS SDK (client)
Install the Ours Privacy Swift SDK to capture privacy-first analytics in iOS, tvOS, macOS, and watchOS apps. No IDFA, no AppTrackingTransparency prompt.
Privacy-first analytics for iOS, tvOS, macOS, and watchOS, written in Swift.
- Swift Package Manager / GitHub: full README, API reference, and release notes
Install
In Xcode: File → Add Package Dependencies… and enter https://github.com/with-ours/ours-privacy-swift. Pick the latest tagged release. Then add OursPrivacyKit to your target's dependencies.
Migrating from CocoaPods? Past versions of
OursPrivacy-swiftremain installable from CocoaPods trunk but receive no further updates. New releases ship via Swift Package Manager.
Quick Start
import OursPrivacyKit
let op = OursPrivacy(token: "YOUR_API_TOKEN", trackAutomaticEvents: true)
Task { await op.initialize() }
op.track(event: "App Opened")For the full API (identify, flush, reset, default properties, deep link attribution, opt in/out, and configuration), see the README on GitHub.
Web-to-app Identity
When your app is opened by a link carrying ours_visitor_id, the SDK sets that visitor ID for you, and every event after it lands on the profile that already holds the person's web history and campaign context. The same call reads the UTM parameters and roughly 25 ad-platform click IDs off that link.
Hand the URL over with trackDeepLink, or pass it at startup as initialURL:
op.trackDeepLink(url)
// Or at startup
await op.initialize(options: OursPrivacyInitOptions(initialURL: launchURL))If your app already holds the visitor ID, from a WebView or a native bridge, set it directly with op.setVisitorId("550e8400-e29b-41d4-a716-446655440000").
Forward the opening URL. The SDK hooks nothing in the operating system, so your app has to hand over the URL it was launched with. Cover a universal link and a custom scheme:
// SceneDelegate: universal link
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
if let url = userActivity.webpageURL?.absoluteString {
op.trackDeepLink(url)
}
}
// AppDelegate: custom scheme
func application(_ app: UIApplication, open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
op.trackDeepLink(url.absoluteString)
return true
}On iOS, parsed UTM parameters and click IDs last for the run of the app, and only the visitor ID persists across a restart. Attribution still holds, because the join happens on the visitor ID rather than on the campaign parameters.
Mobile app attribution covers how app attribution works end to end, and when you need a mobile measurement partner alongside it.
Compatibility
- iOS 13+
- tvOS 13+
- macOS 10.15+
- watchOS 6+
- Swift 5+
No IDFA is collected, so AppTrackingTransparency (ATT) permission is not required on iOS.
Explore the API
Want to see what you can send? Try our playground for a point-and-click payload builder.
Need Help?
Next Steps
- Client SDKs overview: pick the right SDK for each surface.
- Web SDK (JavaScript): for browser tracking.
- Android SDK: for the native Android counterpart.
- React Native SDK: if you're shipping a cross-platform mobile app.
- Mobile app attribution: how app attribution works, and when you need a mobile measurement partner.
How is this guide?

