Skip to main content

Basic Configuration

Configure SpendOwl once during app launch with your API key:
Call configure() only once. Subsequent calls are ignored.

What Happens on Configure

When you call configure(), SpendOwl automatically:
  1. Fetches attribution — Gets the Apple Search Ads attribution token and sends it to SpendOwl servers
  2. Starts purchase tracking — Observes StoreKit transactions (both StoreKit 1 and StoreKit 2) for ROAS calculation
  3. 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, use SpendOwlConfiguration:

Configuration Options

String
required
Your SpendOwl API key from the dashboard.
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

Don’t hardcode API keys in source code. Use environment variables or a configuration file:
Use different API keys for development and production:
Add your config file to .gitignore to prevent accidentally committing API keys.

Thread Safety

SpendOwl is thread-safe. You can call configure() 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