Skip to main content

SpendOwl

The main entry point for the SpendOwl SDK. All methods are static—you don’t need to create an instance.

Configuration Methods

configure(apiKey:)

Configures the SDK with your API key.
String
required
Your SpendOwl API key from the dashboard.
Example:
Call this once during app launch. Subsequent calls are ignored.

configure(_:)

Configures the SDK with custom options.
SpendOwlConfiguration
required
Configuration options including API key, timeout, and retry settings.
Example:

Attribution Methods

attribution() async throws

Fetches attribution data asynchronously.
Returns: AttributionResult containing campaign, ad group, and keyword data. Throws: SpendOwlError if attribution fails. Example:

attribution(completion:)

Fetches attribution data using a completion handler.
Closure
default:"nil"
Called with the attribution result. May be called on any queue.
Example:

User Identity Methods

setUserId(_:)

Sets your own user identifier, reported alongside purchase events.
String
required
Your internal user identifier (e.g., database ID, UUID).
Example:
This does not change how attribution and purchases are linked — that always runs on a stable, device-scoped anonymous SpendOwl ID, so linkage is correct whether you call this early, late, or never. The value is carried as externalUserId, reporting metadata that makes purchases searchable by your own identifier.

clearUserId()

Clears the current user ID.
Example:

Properties

enableLogging

Enables or disables debug logging.
Default: false Example:
Disable logging in production. Logs may contain sensitive information.

logLevel

The current log level for granular control.
Values: Example:

isConfigured

Returns true if the SDK is configured and ready.
Example:

sdkVersion

The current SDK version string.
Example:

Platform Availability

Thread Safety

The SpendOwl class is thread-safe (Sendable). All methods can be called from any thread.

SpendOwlConfiguration

Configuration options

AttributionResult

Attribution data structure

SpendOwlError

Error types