Skip to main content
The Swift SDK records installs, sessions, screens and your own events, and links each install to the RevenueCat or Superwall customer. It sends the same data as the React Native SDK, so the dashboard, attribution and revenue work the same way.
  • No IDFA and no App Tracking Transparency prompt. The install id is a random id stored in the app.
  • Events are queued on the device and sent in batches. They survive offline periods and app restarts.
  • Apple Search Ads attribution (AdServices) and SKAdNetwork / AdAttributionKit conversion values are built in.
  • iOS 15+, Swift 5.9+, no third-party dependencies. Every method is safe to call from any thread.
The source is on GitHub: appeeky/analytics-swift.

Setup

1

Turn on Analytics for the app

In Appeeky, open the app under My Apps → Attribution and click Turn on attribution. Copy the publishable key (apk_pub_…). See the Quickstart for the API call.
2

Add the package

In Xcode, choose File › Add Package Dependencies…, enter https://github.com/appeeky/analytics-swift.git and add the AppeekyAnalytics library to your app target.In a Package.swift:
3

Add the postback keys to Info.plist

These keys make iOS send copies of winning SKAdNetwork and AdAttributionKit postbacks to Appeeky:
An app can name only one endpoint. Leave the keys out if another provider already receives the copies, and use your own registrable domain when you self-host. See SKAdNetwork.
4

Configure the SDK and pass it the URLs that open the app

Call configure once, as early as possible. Hand every URL that opens the app to the SDK, so campaign links and smart links are attributed.
The SDK sends to https://ingest.appeeky.com/v1/ingest. For a self-hosted server, pass endpoint: URL(string: "https://analytics.example.com/v1/ingest")!.
5

Link the install to RevenueCat or Superwall

With Superwall, pass the same user id you give Superwall.shared.identify(userId:). identify sends a batch within about a second, so the install is linked before the first purchase.
6

Track screens

Call screen from .onAppear of each top-level SwiftUI view, or from viewDidAppear in UIKit:

Methods

Event names may use letters, digits, _, ., : and -, up to 64 characters. Property values are strings (up to 512 characters), numbers, booleans or nil.

Options


Automatic Events

When the system launches the app in the background (background fetch, a silent push), the first session starts when the user actually opens it.
A smart link opens the app through its URL scheme when it is installed, with the campaign added to the URL, and the App Store otherwise. The SDK waits up to two seconds after configure for the launch URL.
iOS has no deferred deep link through the App Store. Matching an App Store install back to a click would need device fingerprinting, which Apple does not allow.

SKAdNetwork Conversion Values

The SDK keeps the SKAdNetwork (iOS 15.4+) and AdAttributionKit (iOS 17.4+) conversion value up to date. Values only go up:
purchased and trialStarted only change the conversion value. Revenue comes from RevenueCat or Superwall, so nothing is counted twice.

Privacy

The SDK sends the install id, app version, OS version, device model, locale and the events you track. It never reads advertising identifiers. The package ships a privacy manifest (PrivacyInfo.xcprivacy). In App Store Connect, declare Usage Data › Product Interaction and Purchases as not linked to the user’s identity and not used for tracking. If your RevenueCat app user id is a real account id, declare them as linked instead. See Privacy. State and the event queue are kept in Application Support/AppeekyAnalytics/.