Braze is a customer engagement platform that helps you better understand your customers’ in-app behavior and use the insights to improve your users’ app experience.
Find the open source transformer code for this destination in the GitHub repository.
Setup
In your RudderStack dashboard, go to Directory > Destinations > Cloud Destinations and search for Braze.
Connect your source and click Continue.
Connection settings
Configure the following settings to set up Braze as a destination in RudderStack:
Name: Assign a name to uniquely identify the destination.
App Key: Enter your Braze app key. For more information on obtaining your Braze app key, see FAQ.
REST API Key: Enter the REST API key associated with your project. For more information on obtaining this key, see FAQ.
When creating a new Braze Rest API Key for your app, select the following permissions in the User Data section:
users.track: For creating/updating users and registering events.
users.identify: For identity resolution of identified and anonymous users.
Data Center: Specify the data center associated with your Braze account. To get your data center details, log in to your Braze account and note your URL. Some examples of identifying the Braze instance from the URL are shown:
In the web device mode integration, that is, when using JavaScript SDK as a source, RudderStack loads the Braze native SDK from the the https://js.appboycdn.com/ domain. Based on your website’s content security policy, you might need to allowlist this domain to load the Braze SDK successfully.
To send events via hybrid mode, use the hybrid mode option (highlighted below) while connecting your mobile source to the Braze destination. Then, add the Braze integration to your project.
Web (JavaScript) source
To send events via hybrid mode, use the hybrid mode option (highlighted below) while connecting your web source to the Braze destination.
Then, configure the Web SDK settings to correctly receive data in Braze.
Why use hybrid mode
Certain Braze functionalities like push notifications and in-app messaging require you to load the Braze SDK.
When you choose hybrid mode to send events to Braze, RudderStack:
Initializes the Braze SDK.
Sends all the user-generated events (identify, track, page, screen, and group) to Braze only through cloud mode and blocks them from being sent via device mode.
Sends the auto-generated events (in-app messages, push notifications that require the Braze SDK) via device mode.
With hybrid mode, you can send the auto-generated and user-generated events to Braze using a single connection.
In hybrid mode, RudderStack sends all the user-generated events to Braze through their REST API and does not process them on the client-side - making your app lean and improving load time.
After completing the initial setup, configure the following settings to correctly receive your data in Braze:
Enable subscription groups in group call: Turn on this setting to send the subscription group status in your group events. For more information, see Group.
Use Custom Attributes Operation: Turn on this setting if you want to use Braze’s nested custom attributes functionality to create segments and personalize your messages using a custom attribute object. For more information, see Send user traits as nested custom attributes.
Track events for anonymous users: Turn on this setting to track anonymous user activity and send this information to Braze.
Deduplication settings
Deduplicate Traits: Turn on this setting to enable traits deduplication for identify and track calls. See Braze Deduplication guide for more information on this feature.
Web SDK settings
Show Braze logs: Turn on this setting to show Braze logs to the customers.
If you do not have a service worker, create a new file named service-worker.js with the above snippet and place it in the root directory of your website.
Enable HTML in-app messages: Turn on this setting to enable HTML in-app messages.
Device mode settings
The following settings are applicable only if you’re sending events to Braze via the device mode:
Client-side Events Filtering: This setting lets you specify which events should be blocked or allowed to flow through to Braze. For more information on this setting, see Client-side Events Filtering.
Show Braze logs: This setting is applicable only while using the JavaScript SDK as a source. Turn it on to show the Braze logs to your users.
Consent management settings: Configure the consent management settings for the specified source by choosing the Consent management provider from the dropdown and entering the relevant consent category IDs. See Consent Management in RudderStack for more information on this feature.
Add Braze integration to your project
Depending on your integration platform, follow these steps to add the Braze integration to your project:
Open the Podfile of your project and add the following:
pod'Rudder-Braze'
Run the pod install command.
Change the SDK initialization to the following snippet:
If you are sending events to Braze via device mode, you can save costs by deduplicating your identify calls. To do so, enable the Deduplicate Traits dashboard setting. RudderStack then sends only the changed or modified attributes (traits) to Braze.
It is highly recommended to review Braze’s data points policy to fully understand how this functionality can help you avoid data overages.
Once you send a group event, RudderStack sends a custom attribute to Braze with the name as ab_rudder_group_<groupId> and the value as true. For example, if the groupId is 123456, then RudderStack creates a custom attribute with the name ab_rudder_group_123456 and sends it to Braze with its value to true.
Subscription group status
To update the subscription group status, enable the Enable subscription groups in group call setting in the RudderStack dashboard and send the subscription group status in the group call:
Either the email or phone is mandatory to send the subscription group in a group call.
Alias
The alias call lets you merge different identities of a known user.
RudderStack supports the alias call for Braze only in cloud mode.
A sample alias call is shown below:
rudderanalytics.alias("user123","previous123");
When you make the above call, RudderStack removes the user having previousId as previous123 from Braze and merges all the associated fields with the user having userId as user123.
Advanced features
This section covers some advanced Braze operations that you can perform using RudderStack.
You can send the user traits to Braze as nested custom attributes and perform add, update, and remove operations on them. To do so, enable the Use Custom Attributes Operation dashboard setting in RudderStack while configuring the Braze destination.
You can send the user traits as nested custom attributes in your identify events in the following format:
You must assign the delegate object using center.delegate = self synchronously before your app finishes launching - preferably in application:didFinishLaunchingWithOptions. Otherwise, your app may miss any incoming push notificaitons. See Apple’s UNUserNotificationCenterDelegate documentation for more information.
Register push tokens with Braze:
// - Register the device token with Braze
-(void)application:(UIApplication*)applicationdidRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken{if([RudderBrazeFactoryinstance].integration){[[RudderBrazeFactoryinstance].integrationdidRegisterForRemoteNotificationsWithDeviceToken:deviceToken];}}
Make sure that RudderBrazeFactory is initialized before making calls to this push API.
Since the Braze push API is designed as an instance method, it relies on the SDK that is correctly initialized beforehand. To do this, you can utilize the dispatch_after API.
Enable push handling:
// - Add support for silent notification
-(void)application:(UIApplication*)applicationdidReceiveRemoteNotification:(NSDictionary*)userInfofetchCompletionHandler:(void(^)(UIBackgroundFetchResult))completionHandler{if([RudderBrazeFactoryinstance].integration){[[RudderBrazeFactoryinstance].integrationdidReceiveRemoteNotification:userInfofetchCompletionHandler:completionHandler];}}// - Add support for push notifications
-(void)userNotificationCenter:(UNUserNotificationCenter*)centerdidReceiveNotificationResponse:(UNNotificationResponse*)responsewithCompletionHandler:(void(^)(void))completionHandler{if([RudderBrazeFactoryinstance].integration){[[RudderBrazeFactoryinstance].integrationdidReceiveNotificationResponse:responsewithCompletionHandler:completionHandler];}}// - Add support for displaying push notification when the app is currently running in the foreground
-(void)userNotificationCenter:(UNUserNotificationCenter*)centerwillPresentNotification:(UNNotification*)notificationwithCompletionHandler:(void(^)(UNNotificationPresentationOptions))completionHandler{if(@available(iOS14,*)){completionHandler(UNNotificationPresentationOptionList|UNNotificationPresentationOptionBanner);}else{completionHandler(UNNotificationPresentationOptionAlert);}}
According to Braze documentation, invoking the push integration code within the application’s main thread is recommended.
Add the following code to your AppDelegate file under the didFinishLaunchingWithOptions method:
This site uses cookies to improve your experience while you navigate through the website. Out of
these
cookies, the cookies that are categorized as necessary are stored on your browser as they are as
essential
for the working of basic functionalities of the website. We also use third-party cookies that
help
us
analyze and understand how you use this website. These cookies will be stored in your browser
only
with
your
consent. You also have the option to opt-out of these cookies. But opting out of some of these
cookies
may
have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This
category only includes cookies that ensures basic functionalities and security
features of the website. These cookies do not store any personal information.
This site uses cookies to improve your experience. If you want to
learn more about cookies and why we use them, visit our cookie
policy. We'll assume you're ok with this, but you can opt-out if you wish Cookie Settings.