Skip to main content
Version: 2.0

Attribution integration

Adapty allows easy integration with the popular attribution services: AppsFlyer, Adjust, Branch, Apple Search Ads, and Facebook Ads. Adapty will send subscription events to these services so you can accurately measure the performance of ad campaigns. You can also filter charts data using attribution data.

Send subscription events with correct user properties and ID's to attributions services you use.

Follow our detailed guidance on configuring the following 3d-part attribution integrations:

note

Don't see your attribution provider?

Let us know! Write to the Adapty support and we'll consider adding it.

Important

warning

Avoiding events duplication

Make sure to turn off sending subscription events from devices and your server to avoid duplication.

If you set up direct integration with Facebook, turn off events forwarding from AppsFlyer, Adjust, or Branch.

info

Be sure you've set up attribution integration in Adapty Dashboard, otherwise, we won't be able to send subscription events.

note

Attribution data is set for every profile one time, we won't override the data once it's been saved.

Setting attribution data

To set attribution data for the profile, use .updateAttribution() method:

Adapty.updateAttribution("<attribution>", source: "<source>", networkUserId: "<networkUserId>") { error in
if error == nil {
// succesfull attribution update
}
}

Request parameteres:

  • Attribution (required): a dictionary containing attribution (conversion) data.

  • Source (required): a source of attribution. The allowed values are:

    • .appsflyer
    • .adjust
    • .branch
    • .custom
  • Network user Id (optional): a string profile's identifier from the attribution service.

AppsFlyer

warning

iOS SDK

To set attribution from AppsFlyer, pass the attribution you receive from the delegate method of AppsFlyer iOS SDK. Don't forget to set networkUserId. You should also configure AppsFlyer integration in Adapty Dashboard.

warning

In this case, it is mandatory to pass the networkUserId parameter.

// Find your implementation of AppsFlyerLibDelegate 
// and update onConversionDataSuccess method:
func onConversionDataSuccess(_ installData: [AnyHashable : Any]) {
// It's important to include the network user ID
Adapty.updateAttribution(installData, source: .appsflyer, networkUserId: AppsFlyerLib.shared().getAppsFlyerUID())
}

Adjust

warning

iOS SDK

To set attribution from Adjust, pass the attribution you receive from the delegate method of Adjust iOS SDK. You should also configure Adjust integration in Adapty Dashboard.

// Find your implementation of AdjustDelegate 
// and update adjustAttributionChanged method:
func adjustAttributionChanged(_ attribution: ADJAttribution?) {
if let attribution = attribution?.dictionary() {
Adapty.updateAttribution(attribution, source: .adjust)
}
}

Branch

warning

iOS SDK

To connect Branch user and Adapty user, make sure you set your customerUserId as Branch Identity Id. If you prefer to not use customerUserId in Branch, set networkUserId param in .updateAttribution() method to specify the Branch user Id.

// Pass the attribution you receive from the initializing method of Branch iOS SDK to Adapty.
Branch.getInstance().initSession(launchOptions: launchOptions) { (data, error) in
if let data = data {
Adapty.updateAttribution(data, source: .branch)
}
}
note

You should also configure Branch integration in Adapty Dashboard.

Apple Search Ads

Adapty can automatically collect Apple Search Ad attribution data. All you need is to add AdaptyAppleSearchAdsAttributionCollectionEnabled to the app’s Info.plist file and set it to YES (boolean value).

Facebook Ads

Because of iOS IDFA changes in iOS 14.5, if you use Facebook integration, make sure you send facebookAnonymousId to Adapty via .updateProfile() method. It allows Facebook to handle events if IDFA is not available. You should also configure Facebook Ads in Adapty Dashboard.

let builder = ProfileParameterBuilder()
.with(facebookAnonymousId: FBSDKCoreKit.AppEvents.anonymousID)

Adapty.updateProfile(parameters: builder.build()) { error in
if error == nil {
// successful update
}
}

Custom

If you use another attribution system, you can pass the attribution data to Adapty. You can then segment users based on this data.
To set attributes, use only the keys from the example below (all keys are optional). The system supports max 30 available attributes, where the keys are limited to 30 characters. Every value in the map should be no longer than 50 characters. status can only be organic, non-organic or unknown. Any additional keys will be omitted.

Swift
let attribution = [
"status": "non_organic|organic|unknown",
"channel": "Google Ads",
"campaign": "Christmas Sale",
"ad_group": "ad group",
"ad_set": "ad set",
"creative": "creative id"
]
Adapty.updateAttribution(attribution, source: .custom)