Use Cursor, Claude Code, or another AI to help you integrate the Swift SDK.
Repository
Here, you will find the GitHub iOS Appstack SDK documentation. Please use the latest available version of the SDK.Quickstart
Use this path when you only need the minimum production integration:- Add the Swift package from
https://github.com/appstack-tech/ios-appstack-sdk.git. - Copy the Production API key from SDK in Appstack.
- Call
AppstackAttributionSdk.shared.configure(...)during app startup. - Send standard events such as
.LOGIN,.SIGN_UP,.PURCHASE, and.SUBSCRIBE. - Confirm events appear in the Appstack SDK page before enabling downstream integrations.
Requirements
- iOS 13.0+
- Xcode 14.0+
- Swift 5.0+
Initial setup
1
Installation
You can install the SDK via Swift Package Manager (SPM) by adding the following dependency to your Or directly from Xcode:
Package.swift file:- Go to File > Add Packages.
- Enter the repository URL:
https://github.com/appstack-tech/ios-appstack-sdk.git. - Select the desired version and click Add Package.
2
Initialization
Follow these steps to get the API key:SwiftUI
- In Appstack, from the side menu, select SDK and ensure you are selecting the correct application.
- Select the Production environment.
- Copy the API key.
3
Configuration parameters
The AppstackAttributionSdk.shared.configure() method supports the following parameters:
apiKey(String, required): Your Appstack API key.isDebug(Bool, default: false): Leave as ‘false’ for production. See Development setup if you need to test against the development environment.logLevel(LogLevel, default: .info): Logging level for debugging.
4
Sending events
Important notes
- Initialize the SDK during app startup before sending events
- Event names must match those defined in the Appstack platform
- Parameters are passed as a dictionary [String: Any] and can include any key-value pairs (e.g., revenue, currency, quantity)
- Revenue parameters support automatic type conversion (Double, Int, Float, String)
- Revenue ranges are configured in the Appstack platform and automatically synchronized
The
INSTALL event is tracked automatically on SDK initialization. Do not send it manually.revenueorprice(number).currency(string, e.g.EUR,USD).
email.name(first + last name in the same field).phone_number— also accepted asphoneorphoneNumber.date_of_birth(recommended format:YYYY-MM-DD) — also accepted asbirthdate,birthday, ordateOfBirth.gender.
Appstack ID and attribution params
Afterconfigure, you can read the Appstack user ID and the attribution map for partner integrations (for example Superwall, RevenueCat).
getAppstackId()— Appstack user identifier when a partner expects$appstackIdor similar.getAttributionParams()— Attribution payload (campaign, media source, click IDs, device identifiers where available) to forward to partners.
Development setup
If you want to test the SDK against the Appstack development environment before shipping, follow these extra steps:- In Appstack, from the side menu, select SDK, switch to the Development environment, and copy the Development API key. This key is separate from your production key.
- In your
configure(...)call, use the development key and setisDebug: true:
isDebug flag must match the key you’re using: development key with isDebug: true, production key with isDebug: false. The flag tells the SDK which environment URL to route to.
Security and privacy
- Never commit API keys to version control.
- Use separate production and development keys, and keep
isDebugaligned with the selected key. - Do not put personally identifiable information in event names.
- Only send matching parameters such as
email,name,phone_number, anddate_of_birthwhen your app has the right consent and compliance basis. Appstack automatically encrypts these fields before using them for attribution matching. - Prefer standard event types for common flows so event mapping remains consistent across Appstack and ad integrations.
Advanced configuration
SDK behavior
The SDK automatically:- Fetches configuration from Appstack servers.
- Manages conversion value updates based on event tracking.
- Handles revenue range matching for conversion optimization.
- Processes events in time-based windows (0-2 days, 3-7 days, 8-35 days).
- Queues events when the configuration is not ready.
Event processing
- Events are processed asynchronously to avoid blocking the main thread.
- The SDK queues events if the configuration is not yet loaded.
- Revenue parameters are automatically validated and converted to numeric values.
- Events are matched against configured revenue ranges in real-time.
Limitations
Attribution timing
- Apple Ads attribution requires iOS 14.3+.
- Apple Ads attribution requires app installation from the App Store or TestFlight.
- Attribution data can take 24-48 hours to appear.
- Some attribution behavior may not be available in development or simulator environments.
Event tracking
- The SDK must be initialized during app startup before any tracking calls.
INSTALLis tracked automatically on SDK initialization. Do not send it manually.- Revenue events should include
revenueorpriceandcurrency. - Event processing is asynchronous and can queue events while configuration is loading.
Troubleshooting
Configuration fails
- Confirm the API key was copied from the correct app and environment in Appstack.
- Check that the SDK package is installed from the correct repository URL.
Events do not appear
- Confirm
configure(...)runs before the firstsendEvent(...)call. - Confirm the device has network connectivity.
- Check that revenue events include a numeric
revenueorpricevalue and a validcurrency. - Allow a few minutes for events to appear in the dashboard.
iOS install event does not appear
- If you have a StoreKit test configuration enabled and are using a production API key, the SDK will not record the install.
- For StoreKit test configuration runs, use the development API key.
- For production-key validation, disable the StoreKit test configuration.
Apple Ads attribution does not appear
- Confirm the app was installed from the App Store or TestFlight.
- Confirm the device runs iOS 14.3+.
- Call
AppstackASAAttribution.shared.enableAppleAdsAttribution()after initialization and in the appropriate ATT flow. - Allow 24-48 hours for attribution data to appear.
Superwall
To start using the Superwall integration, click here to see the correct SDK documentation.Apple Ads
To start using the Apple Ads integration, click here to see the correct SDK documentation.Verification checklist
- Swift package installed from
https://github.com/appstack-tech/ios-appstack-sdk.git. - App target meets iOS 13.0+, Xcode 14.0+, and Swift 5.0+ requirements.
- Production API key is used with
isDebug: false. - Development API key is used with
isDebug: trueonly in development builds. configure(...)runs once during app startup.INSTALLis not sent manually.- Login, signup, purchase, subscription, and other key app events use standard event types where possible.
- Revenue events include
revenueorpriceandcurrency. - Custom events use
.CUSTOMwith a descriptivename. - Appstack ID and attribution params are available before wiring partner integrations.
- Apple Ads attribution is enabled only on supported iOS versions and in the correct permission flow.
- Events are visible in the Appstack SDK page before launch.
Support
For questions or issues:- Check the GitHub Repository.
- Contact our support team at support@appstack.tech.
- Open an issue in the repository.
Use Cursor, Claude Code, or another AI to validate your existing Appstack Swift SDK integration.