Basic Configuration
Configure SpendOwl once during app launch with your API key:- SwiftUI
- UIKit
What Happens on Configure
When you callconfigure(), SpendOwl automatically:
- Fetches attribution — Gets the Apple Search Ads attribution token and sends it to SpendOwl servers
- Starts purchase tracking — Observes StoreKit transactions (both StoreKit 1 and StoreKit 2) for ROAS calculation
- Initializes networking — Sets up the API client with retry logic
Both attribution and purchase tracking are required for accurate ROAS calculation.
Advanced Configuration
For more control, useSpendOwlConfiguration:
Configuration Options
URL
default:"https://spendowl.io/api"
The API base URL. Only change this for testing or if instructed by SpendOwl support.
TimeInterval
default:"10"
Network request timeout in seconds. Increase for slow networks.
Int
default:"3"
Total attempts per request, including the first — not a retry count. The default of
3 means one request plus two retries. Values below 1 are raised to 1. Client errors (4xx) are not retried.Check Configuration Status
Verify the SDK is configured before using other methods:API Key Best Practices
Use Environment Variables
Use Environment Variables
Don’t hardcode API keys in source code. Use environment variables or a configuration file:
Separate Keys for Environments
Separate Keys for Environments
Use different API keys for development and production:
Never Commit Keys
Never Commit Keys
Add your config file to
.gitignore to prevent accidentally committing API keys.Thread Safety
SpendOwl is thread-safe. You can callconfigure() from any thread, though calling from the main thread during app launch is recommended.
Next Steps
Attribution
Learn how to access attribution data
User Identity
Report purchases under your own user ID