Client SDKs
Configuration
How to initialize and configure the AudienceLab iOS SDK
Initialization
Initialize the SDK as early as possible in your app lifecycle, typically in AppDelegate or your SwiftUI app entry point:
import AudienceLabSDK
let options = AudienceLabOptions()
options.isDevelopmentMode = true
options.isDebugEnabled = true
AudienceLabSDK.initialize(
apiKey: "YOUR_AUDIENCELAB_API_KEY",
options: options
)Prop
Type
isDebugEnabled controls local SDK debug behavior. isDevelopmentMode controls whether traffic is sent as development or release traffic.
SDK Toggles
AudienceLabSDK.setSDKEnabled(true)
AudienceLabSDK.toggleMetricsCollection(true)
AudienceLabSDK.setDebugEnabled(false)| Method | Description |
|---|---|
setSDKEnabled(_:) | Master toggle. When disabled, no events are sent. |
toggleMetricsCollection(_:) | Enable or disable event and metric collection separately from SDK state. |
setDebugEnabled(_:) | Enable or disable SDK debug logging. |
isDevelopmentMode() | Returns whether the SDK is currently sending development traffic. |
Identity
The SDK automatically collects the IDFV and can optionally receive an IDFA from the host app after ATT consent.
AudienceLabSDK.setAdvertisingId("IDFA-UUID-STRING")
AudienceLabSDK.clearAdvertisingId()The SDK does not request ATT permission on its own. If your app collects IDFA after ATT consent, pass it with setAdvertisingId(_:).