Skip to main content

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.

You can also integrate with Adapty's User Acquisition to connect ad spend with subscription revenue, giving you a complete view of your app's economy in one place.

Important

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

warning
  • Avoid event duplication: Be sure to disable subscription event forwarding from both devices and your server to prevent duplicates. If you're using direct integration with Facebook, remember to turn off event forwarding from AppsFlyer, Adjust, or Branch.

  • Properly set up attribution integration: Ensure that attribution is set up in both your mobile app code and the Adapty Dashboard. Without both in place, Adapty won't be able to send subscription events.

  • Set a single attribution source: Adapty can use attribution data in analytics from only one source at a time. If multiple attribution sources are enabled, the system will decide which attribution to use for each device based on the source that provides more fields. For iOS devices, this means non-organic Apple Search Ads attribution will always take priority if it's enabled. You can disable Apple Search Ads attribution collection by toggling off the Receive Apple Search Ads attribution in Adapty in the App Settings -> Apple Search Ads tab.

  • Attribution data is never overwritten in analytics: Attribution data is saved once after the user profile is created and won't be overwritten in analytics once stored.

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.

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 by following the instructions for setting user attributes in your app. 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")