setIntegrationAttributes
Sets integration attributes for third-party analytics and attribution providers.
This method was introduced in version 4.8.1. It allows you to set attributes for third-party integrations like Amplitude, Mixpanel, and other analytics platforms. In iOS SDK 4.17.0 and later, IDFV, IDFA, and ATT status are refreshed automatically when the app becomes active or integration attributes are set.
Purpose
Sets integration attributes that are sent to Superwall's servers and can be used for analytics and attribution tracking with third-party providers.
Signature
public func setIntegrationAttributes(_ props: [IntegrationAttribute: String?])Parameters
Prop
Type
Returns / State
This method returns Void. The attributes are stored and sent to Superwall's servers.
Automatic device identifiers
Starting in iOS SDK 4.17.0, the SDK keeps these device values current for server-side integrations:
| User attribute | Value |
|---|---|
idfv | The identifier for vendor, when available. |
idfa | The advertising identifier, when available and not the all-zero value. It is cleared when tracking consent is revoked. |
attStatus | The App Tracking Transparency status as a numeric string. |
These values are refreshed when the app becomes active and when you call setIntegrationAttributes. The SDK owns these user-attribute keys and overwrites values your app sets. It does not request tracking permission. Ask for permission in your app, then let the SDK refresh the values.
Integration attributes are also scoped to either the device or the person. Device-scoped identifiers, such as appsflyerId and adjustId, survive reset() and identifying a different user. Person-scoped identifiers, such as amplitudeUserId and customerioId, are cleared during those identity changes.
Usage
Set integration attributes:
Superwall.shared.setIntegrationAttributes([
.amplitudeUserId: "user123",
.mixpanelDistinctId: "distinct456",
.firebaseInstallationId: "abc123",
.onesignalId: "onesignal-user-id",
.custom("myCustomKey"): "customValue"
])Remove an attribute by setting it to nil:
Superwall.shared.setIntegrationAttributes([
.amplitudeUserId: nil // Removes the amplitudeUserId attribute
])Access current integration attributes:
let attributes = Superwall.shared.integrationAttributes
print("Current attributes: \(attributes)")IntegrationAttribute Types
Common integration attributes include:
.amplitudeUserId- Amplitude user ID.mixpanelDistinctId- Mixpanel distinct ID.firebaseInstallationId- Firebase installation ID (4.10.8+).appstackId- Appstack identifier (4.12.11+).singularDeviceId- Singular device identifier (SDID) (4.15.4+).onesignalId- OneSignal User ID (onesignal_id) for the user. Do not use the legacy OneSignal Player ID..custom(String)- Custom attribute key
Related
integrationAttributes- Get current integration attributesSuperwall.shared.integrationAttributes- Published property for integration attributes
How is this guide?