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.
apiKey
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.
configuration
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.
completion
Closure
default:"nil"
Called with the attribution result. May be called on any queue.
Example:

User Identity Methods

setUserId(_:)

Sets the user ID for attribution and purchase tracking.
userId
String
required
Your internal user identifier (e.g., database ID, UUID).
Example:
The user ID is included with all subsequent attribution and purchase events.

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