Attribution Integration

Learn how to pass attribution data to the dashboard using Adapty iOS SDK. Adapty supports AppsFlyer, Adjust, Branch, Facebook Ads, and Apple Search Ads

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.

🚧

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.

🚧

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

📘

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

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 parameters:

  • 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

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.

extension AppDelegate: AppsFlyerLibDelegate {
    func onConversionDataSuccess(_ installData: [AnyHashable : Any]) {
        // It's important to include the network user ID
        Adapty.updateAttribution(installData, source: .appsflyer, networkUserId: AppsFlyerLib.shared().getAppsFlyerUID())
    }
}

Adjust

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.

extension AppDelegate: AdjustDelegate {
    func adjustAttributionChanged(_ attribution: ADJAttribution?) {
        if let attribution = attribution?.dictionary() {
            Adapty.updateAttribution(attribution, source: .adjust)
        }
    }
}

Branch

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.

// login
Branch.getInstance().setIdentity("YOUR_USER_ID")

// logout
Branch.getInstance().logout()

Next, 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)
    }
}

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 params = ProfileParameterBuilder().withFacebookAnonymousId(FBSDKCoreKit.AppEvents.anonymousID)
Adapty.updateProfile(params: params) { (error) in    
    if error == nil {        
        // successful update                                  
    }
}

Did this page help you?