diff --git a/_docs/_partners/message_orchestration/attribution/appsflyer/appsflyer.md b/_docs/_partners/message_orchestration/attribution/appsflyer/appsflyer.md index 4e5de4f89d9..b3558ae696d 100644 --- a/_docs/_partners/message_orchestration/attribution/appsflyer/appsflyer.md +++ b/_docs/_partners/message_orchestration/attribution/appsflyer/appsflyer.md @@ -33,21 +33,22 @@ You can also pass your AppsFlyer audiences (cohorts) directly to Braze with the ### Step 1: Map device ID -#### Android - +{% tabs local %} +{% tab Android %} If you have an Android app, you will need to pass a unique Braze device ID to AppsFlyer. Make sure the following lines of code are inserted at the correct place—after the Braze SDK is launched and before the initialization code for the AppsFlyer SDK. See the AppsFlyer [Android SDK integration guide](https://dev.appsflyer.com/hc/docs/integrate-android-sdk#initializing-the-android-sdk) for more information. -```java -HashMap customData = new HashMap(); -String deviceId =(Braze.getInstance(MyActivity.this).getDeviceId()); -customData.put("brazeCustomerId", deviceId); -AppsFlyerLib.setAdditionalData(customData); +```kotlin +val customData = HashMap() +Braze.getInstance(context).getDeviceIdAsync { deviceId -> + customData["brazeCustomerId"] = deviceId + setAdditionalData(customData) +} ``` +{% endtab %} -#### iOS - +{% tab ios %} {% alert important %} Prior to February 2023, our AppsFlyer attribution integration used the IDFV as the primary identifier to match iOS attribution data. It is not necessary for Braze customers using Objective-C to fetch the Braze `device_id` and sent to AppsFlyer upon install as there will be no disruption of service. {% endalert%} @@ -56,51 +57,34 @@ For those using the Swift SDK v5.7.0+, if you wish to continue using IDFV as the If set to `true`, you must implement the iOS device ID mapping for Swift in order to pass the Braze `device_id` to AppsFlyer upon app install in order for Braze to appropriately match iOS attributions. -{% tabs local %} -{% tab Objective-C %} - -```objc -BRZConfiguration *configurations = [[BRZConfiguration alloc] initWithApiKey:@"BRAZE_API_KEY" endpoint:@"BRAZE_END_POINT"]; -[configurations setUseUUIDAsDeviceId:NO]; -Braze *braze = [[Braze alloc] initWithConfiguration:configurations]; -[braze deviceIdWithCompletion:^(NSString * _Nonnull brazeDeviceId) { - NSLog(@">>[BRZ]: %@", brazeDeviceId); - [[AppsFlyerLib shared] setAdditionalData:@{ - @"brazeDeviceId": brazeDeviceId - }]; -}]; -``` - -{% endtab %} -{% tab Swift %} +{% subtabs local %} +{% subtab Swift %} -##### Swift completion handler -```swift -let configuration = Braze.Configuration( - apiKey: "", - endpoint: "") -configuration.useUUIDAsDeviceId = false -let braze = Braze(configuration: configuration) -braze.deviceId { - brazeDeviceId in - AppsFlyerLib.shared().customData = ["brazeDeviceId": brazeDeviceId] -} -``` -##### Swift await ```swift let configuration = Braze.Configuration( apiKey: "", endpoint: "") configuration.useUUIDAsDeviceId = false let braze = Braze(configuration: configuration) -let brazeDeviceId = await braze.deviceId() -AppsFlyerLib.shared().customData = ["brazeDeviceId": brazeDeviceId] +AppsFlyerLib.shared().customData = ["brazeDeviceId": braze.deviceId] ``` +{% endsubtab %} +{% subtab Objective-C %} +```objc +BRZConfiguration *configurations = [[BRZConfiguration alloc] initWithApiKey:@"BRAZE_API_KEY" endpoint:@"BRAZE_END_POINT"]; +[configurations setUseUUIDAsDeviceId:NO]; +Braze *braze = [[Braze alloc] initWithConfiguration:configurations]; +[[AppsFlyerLib shared] setAdditionalData:@{ + @"brazeDeviceId": braze.deviceId +}]; +``` +{% endsubtab %} +{% endsubtabs %} {% endtab %} -{% endtabs %} -#### Unity +{% tab unity %} +To map the device ID in Unity, use the following: ``` Appboy.AppboyBinding.getDeviceId() @@ -108,6 +92,8 @@ Dictionary customData = new Dictionary(); customData.Add("brazeCustomerId", Appboy.AppboyBinding.getDeviceId()); AppsFlyer.setAdditionalData(customData); ``` +{% endtab %} +{% endtabs %} ### Step 2: Get the Braze data import key