Client SDKs

API Reference

Complete API reference for the AudienceLab iOS SDK

All methods are accessed through the static AudienceLabSDK API.

Initialization and Configuration

MethodReturnsDescription
initialize(apiKey:options:)Initialize the SDK.
isInitializedBoolWhether the SDK has been initialized.
reset()Clears SDK state, token, queue, and persisted SDK data.
setSDKEnabled(_:)Master SDK toggle.
getIsSDKEnabled()BoolWhether the SDK is enabled.
toggleMetricsCollection(_:)Enable or disable data collection.
getIsMetricsCollection()BoolWhether data collection is enabled.
setDebugEnabled(_:)Enable or disable SDK debug logging.
getIsDebugEnabled()BoolWhether SDK debug logging is enabled.
isDevelopmentMode()BoolWhether the SDK is currently sending development traffic.

Event Methods

MethodDescription
sendPurchaseEvent(itemId:itemName:value:currency:status:transactionId:dedupeKey:)Track a purchase and include total_purchase_value.
sendAdEvent(adId:name:source:watchTime:reward:mediaSource:channel:value:currency:dedupeKey:)Track an ad event and include total_ad_value.
sendCustomEvent(name:params:dedupeKey:)Track a custom event.
sendUserMetrics()Trigger retention metric sending if one is due.

User Properties

MethodDescription
setUserProperty(key:value:isWhitelisted:)Set a property using the legacy boolean scope.
setUserProperty(key:value:set:)Set a property using UserPropertySet.
unsetUserProperty(key:isWhitelisted:)Remove a property using the legacy boolean scope.
unsetUserProperty(key:set:)Remove a property using UserPropertySet.
clearUserProperties(isWhitelisted:)Clear one property set using the legacy boolean scope.
clearUserProperties(_:)Clear one property set using UserPropertySet.
getWhitelistedUserProperties()Returns the current wp properties.
getBlacklistedUserProperties()Returns the current bp properties.

Identity

MethodDescription
setAdvertisingId(_:)Manually set IDFA after ATT consent.
clearAdvertisingId()Clear the manually set advertising ID.
isIdentitySettled()Whether the SDK identity state is considered settled.

Token and Backend Helpers

MethodReturnsDescription
getCreativeToken()String?Stored creative token.
verifyCreativeToken(_:completion:)Validate a token against the backend.
checkDataCollectionStatus(_:)Check whether backend-side data collection is enabled.

Session and Queue

MethodReturnsDescription
getSessionId()String?Current session ID.
getSessionIndex()IntCurrent session index.
getQueueSize()IntNumber of queued events waiting to flush.
setRequestResultCallback(_:)Register request success/failure callback.
clearRequestResultCallback()Clear the request result callback.

Diagnostics

MethodReturnsDescription
setRequestDebugListener(_:)Register request debug listener.
clearRequestDebugListener()Clear request debug listener.
getIdentityDebugSnapshot()IdentityDebugSnapshotCurrent identity diagnostic state.
getTokenDebugSnapshot()TokenDebugSnapshotCurrent token diagnostic state.
getDeviceDebugSnapshot()DeviceDebugSnapshotCurrent device diagnostic state.
getQueueDebugSnapshot()[QueueDebugEntry]Current offline queue diagnostic state.

Version Info

MethodReturnsDescription
getSDKVersion()StringSDK version.
getAppVersion()StringHost app version.
getRuntimeVersion()StringiOS runtime version string.
getTotalPurchaseValue()DoubleLifetime cumulative purchase value.
getTotalAdValue()DoubleLifetime cumulative ad value.