Braze (SDK)

Purpose of Feature


As the world’s No.1 MMA (Mobile Marketing Automation) solution, Braze can offer precise targeted campaigns by creating user segments based on tracking and acquisition information from Airbridge (e.g. User driven from a certain paid channel and/or campaign through Airbridge).



Integration Requirements


  • Integration is available for both iOS and Android.
  • Both Airbridge and Braze SDKs must be installed on your app for integration.

Android SDK   iOS SDK   React Native SDK   Unity SDK



Integration


Integration with Braze will happen on the client-side via SDK-to-SDK. This means that once both SDKs are installed and the below settings are complete, Airbridge will automatically start sending data to Braze. Not only does this eliminate the need for manual data uploads, data will also be sent in near real-time once attribution data is fetched from the Airbridge servers. Additional custom attributions can also be configured, and it can be used for more detailed user segmentations to fine tune your campaigns in Braze.

AirbridgeConfig config = new AirbridgeConfig.Builder(BuildConfig.AIRBRIDGE_APP_NAME, BuildConfig.AIRBRIDGE_APP_TOKEN)
        .setOnAttributionResultReceiveListener(new OnAttributionResultReceiveListener() {
            @Override
            public void onAttributionResultReceived(Map<String, String> result) {
                String channel = result.get("attributedChannel");
                String campaign = result.get("attributedCampaign");
                String adGroup = result.get("attributedAdGroup");
                String adCreative = result.get("attributedAdCreative");
                AttributionData data = new AttributionData(
                    channel != null ? channel : "",
                    campaign != null ? campaign : "",
                    adGroup != null ? adGroup : "",
                    adCreative != null ? adCreative : "",
                );
              
                Appboy.getInstance(applicationContext).getCurrentUser().setAttributionData(data);

                // NOTE: Data points will be consumed
                Appboy.getInstance(applicationContext).getCurrentUser().setCustomUserAttribute("airbridge_ad_content", result.get("attributedContent"));
                Appboy.getInstance(applicationContext).getCurrentUser().setCustomUserAttribute("airbridge_term", result.get("attributedTerm"));
                Appboy.getInstance(applicationContext).getCurrentUser().setCustomUserAttribute("airbridge_sub_id", result.get("attributedSubPublisher"));
                Appboy.getInstance(applicationContext).getCurrentUser().setCustomUserAttribute("airbridge_sub_id_1", result.get("attributedSubSubPublisher1"));
                Appboy.getInstance(applicationContext).getCurrentUser().setCustomUserAttribute("airbridge_sub_id_2", result.get("attributedSubSubPublisher2"));
                Appboy.getInstance(applicationContext).getCurrentUser().setCustomUserAttribute("airbridge_sub_id_3", result.get("attributedSubSubPublisher3"));
            }
        })
        .build();
Airbridge.init(this, config);
val config = AirbridgeConfig.Builder(BuildConfig.AIRBRIDGE_APP_NAME, BuildConfig.AIRBRIDGE_APP_TOKEN)
        .setOnAttributionResultReceiveListener(object : OnAttributionResultReceiveListener {
            override fun onAttributionResultReceived(result: Map<String, String>) {
                val data = AttributionData(
                    result["attributedChannel"] ?: "",
                    result["attributedCampaign"] ?: "",
                    result["attributedAdGroup"] ?: "",
                    result["attributedAdCreative"] ?: ""
                )

                Appboy.getInstance(applicationContext).currentUser?.setAttributionData(data)
                  
                // NOTE: Data points will be consumed
                Appboy.getInstance(applicationContext).currentUser?.setCustomUserAttribute("airbridge_ad_content", result["attributedContent"])
                Appboy.getInstance(applicationContext).currentUser?.setCustomUserAttribute("airbridge_term", result["attributedTerm"])
                Appboy.getInstance(applicationContext).currentUser?.setCustomUserAttribute("airbridge_sub_id", result["attributedSubPublisher"])
                Appboy.getInstance(applicationContext).currentUser?.setCustomUserAttribute("airbridge_sub_id_1", result["attributedSubSubPublisher1"])
                Appboy.getInstance(applicationContext).currentUser?.setCustomUserAttribute("airbridge_sub_id_2", result["attributedSubSubPublisher2"])
                Appboy.getInstance(applicationContext).currentUser?.setCustomUserAttribute("airbridge_sub_id_3", result["attributedSubSubPublisher3"])
            }
        })
        .build()
Airbridge.init(this, config)
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    func application(_ application: UIApplication, 
                     didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        AirBridge.setting()?.attributionCallback = { attribution in
            let data = ABKAttributionData(network: attribution["attributedChannel"],
                                          campaign: attribution["attributedCampaign"],
                                          adGroup: attribution["attributedAdGroup"],
                                          creative: attribution["attributedAdCreative"])
            
            // NOTE: Data points will be consumed
            Appboy.sharedInstance()?.user.attributionData = data
            
            [
                "attributedContent": "airbridge_content",
                "attributedTerm": "airbridge_term",
                "attributedSubPublisher": "airbridge_sub_id",
                "attributedSubSubPublisher1": "airbridge_sub_id_1",
                "attributedSubSubPublisher2": "airbridge_sub_id_2",
                "attributedSubSubPublisher3": "airbridge_sub_id_3",
            ].forEach { (key, brazeKey) in
                guard let value = attribution[key] else {
                    return
                }
                
                Appboy.sharedInstance()?.user.setCustomAttributeWithKey(brazeKey, andStringValue: value)
            }
            
            Appboy.sharedInstance()?.flushDataAndProcessRequestQueue()
        }
      
      	AirBridge.getInstance("YOUR_APP_TOKEN", appName: "YOUR_APP_NAME", withLaunchOptions: launchOptions)
      
        return true
    }
}
@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    AirBridge.setting.attributionCallback = ^(NSDictionary<NSString*, NSString*>* _Nonnull attribution) {
        ABKAttributionData* data = [[ABKAttributionData alloc] initWithNetwork:attribution[@"attributedChannel"]
                                                                      campaign:attribution[@"attributedCampaign"]
                                                                       adGroup:attribution[@"attributedAdGroup"]
                                                                      creative:attribution[@"attributedAdCreative"]];
        [Appboy.sharedInstance.user setAttributionData:data];

        // NOTE: Data points will be consumed
        NSDictionary* keyMap = @{
            @"attributedContent": @"airbridge_content",
            @"attributedTerm": @"airbridge_term",
            @"attributedSubPublisher": @"airbridge_sub_id",
            @"attributedSubSubPublisher1": @"airbridge_sub_id_1",
            @"attributedSubSubPublisher2": @"airbridge_sub_id_2",
            @"attributedSubSubPublisher3": @"airbridge_sub_id_3",
        };
        
        for (NSString* key in keyMap.allKeys) {
            NSString* brazeKey = keyMap[key];
            NSString* value = attribution[key];
            
            [Appboy.sharedInstance.user setCustomAttributeWithKey:brazeKey andStringValue:value];
        }
        
        [Appboy.sharedInstance flushDataAndProcessRequestQueue];
    };
  
    [AirBridge getInstance:"YOUR_APP_TOKEN" appName:"YOUR_APP_NAME" withLaunchOptions:launchOptions];

    return YES;
}

@end
Airbridge.state.setAttributionListener(attribution => {
    ReactAppboy.setAttributionData(
        attribution['attributedChannel'] || null,
        attribution['attributedCampaign'] || null,
        attribution['attributedAdGroup'] || null,
        attribution['attributedAdCreative'] || null,
    )

    // NOTE: Data points will be consumed
    ReactAppboy.setCustomUserAttribute('airbridge_ad_content', attribution['attributedContent'] || null)
    ReactAppboy.setCustomUserAttribute('airbridge_term', attribution['attributedTerm'] || null)
    ReactAppboy.setCustomUserAttribute('airbridge_sub_id', attribution['attributedSubPublisher'] || null)
    ReactAppboy.setCustomUserAttribute('airbridge_sub_id_1', attribution['attributedSubSubPublisher1'] || null)
    ReactAppboy.setCustomUserAttribute('airbridge_sub_id_2', attribution['attributedSubSubPublisher2'] || null)
    ReactAppboy.setCustomUserAttribute('airbridge_sub_id_3', attribution['attributedSubSubPublisher3'] || null)
});
public class AirbridgeManager : MonoBehaviour
{ 
    private void Awake() 
    {
        //Please register an object for messages as below to receive attribution data.
      	AirbridgeUnity.SetOnAttributionReceived("AirbridgeManager");
    }
  
    // Method will call by Airbridge when attribution result received
    private void OnAttributionResultReceived(string jsonString)
    {
        // Airbridge ↔ Braze integration
        Dictionary<string, object> attributionData = AirbridgeJson.Deserialize(jsonString) as Dictionary<string, object>;

        AppboyBinding.SetAttributionData(
            TryGetValueOrEmptyString(attributionData, "attributedChannel"),
            TryGetValueOrEmptyString(attributionData, "attributedCampaign"),
            TryGetValueOrEmptyString(attributionData, "attributedAdGroup"),
            TryGetValueOrEmptyString(attributionData, "attributedAdCreative")
        );
        
        // NOTE: Data points will be consumed
        AppboyBinding.SetCustomUserAttribute("airbridge_ad_content", TryGetValueOrEmptyString(attributionData, "attributedContent"));
        AppboyBinding.SetCustomUserAttribute("airbridge_term", TryGetValueOrEmptyString(attributionData, "attributedTerm"));
        AppboyBinding.SetCustomUserAttribute("airbridge_sub_id", TryGetValueOrEmptyString(attributionData, "attributedSubPublisher"));
        AppboyBinding.SetCustomUserAttribute("airbridge_sub_id_1", TryGetValueOrEmptyString(attributionData, "attributedSubPublisher1"));
        AppboyBinding.SetCustomUserAttribute("airbridge_sub_id_2", TryGetValueOrEmptyString(attributionData, "attributedSubPublisher2"));
        AppboyBinding.SetCustomUserAttribute("airbridge_sub_id_3", TryGetValueOrEmptyString(attributionData, "attributedSubPublisher3"));
    }

    private string TryGetValueOrEmptyString(Dictionary<string, object> dict, string key) 
    {
        if (dict.TryGetValue(key, out var value))
        {
            return value as string ?? "";
        }
        return "";
    }
}



Integrated Data


Airbridge can send ten different types of data to Braze. The data is used by Braze as "User Install Attributions" and "Custom Attributions". It can be viewed on the Braze dashboard and used for filtering.
Aside from the four basic types of data (attributedChannel, attributedCampaign, attributedAdGroup, attributedAdCreative) defined by Braze, Airbridge can send six additional data fields (attributedContent, attributedTerm, attributedSubPublisher, attributedSubPublisher1, attributedSubPublisher2, attributedSubPublisher3) as custom attributions.

📘

Braze data points will be used when you send optional data because it is sent as custom user attributes.

AirbridgeBraze Segment FilterTypeDescriptionExample
attributedChannelInstall Attribution SourceInstall Attribution DataName of Ad channelnaver.performance_da
attributedCampaignInstall Attribution CampaignInstall Attribution DataName of Campaignspringpromotion_campaign
attributedAdGroupInstall Attribution Ad GroupInstall Attribution DataName of adGroupfemale_2030
attributedAdCreativeInstall Attribution AdInstall Attribution DataName of adCreativeadcreative_1
attributedContent (Optional)airbridge_contentCustom User AttributeName of ad copy, slogan, or promotionslim_fit
attributedTerm (Optional)airbridge_termCustom User AttributeAd search keywordjeans
attributedSubPublisher (Optional)airbridge_sub_idCustom User AttributeSub publisher configured by the marketer or mediabanner
attributedSubSubPublisher1 (Optional)airbridge_sub_id_1Custom User AttributeSub sub publisher 1 configured by the marketer or mediasub_id_1
attributedSubSubPublisher2 (Optional)airbridge_sub_id_2Custom User AttributeSub sub publisher 2 configured by the marketer or mediasub_id_2
attributedSubSubPublisher3 (Optional)airbridge_sub_id_3Custom User AttributeSub sub publisher 3 configured by the marketer or mediasub_id_3