Braze Web Mode (Actions) Destination

Braze, formerly Appboy, is an engagement platform that empowers growth by helping marketing teams to build customer loyalty through mobile, omni-channel customer experiences.

Good to know: This page is about the Actions-framework Braze Segment destination. There’s also a page about the non-Actions Braze destination. Both of these destinations receives data from Segment. There’s also the Braze source, which sends data to Segment.

Benefits of Braze Web Mode (Actions) vs Braze Classic

Braze Web Mode (Actions) provides the following benefits over Braze Classic:

  • E-commerce mappings. Users who can’t follow the e-commerce spec due to incompatible event names (for example, Trip Booked vs Order Completed) can log purchases in Braze Web Mode (Actions).

Getting Started

  1. From the Segment web app, click Catalog.
  2. Search for “Braze” in the Catalog, select Braze Web Mode (Actions), and choose which of your sources to connect the destination to.
  3. Configure the Connection Settings. API Key and SDK Endpoint are required settings.

Destination Settings

Setting Description
Allow Crawler Activity Required.

Allow Braze to log activity from crawlers. See more details

Allow User Supplied Javascript Required.

To indicate that you trust the Braze dashboard users to write non-malicious Javascript click actions, set this property to true. If enableHtmlInAppMessages is true, this option will also be set to true. See more details

API Key Required.

Found in the Braze Dashboard under Settings → Manage Settings → Apps → Web

App Version Required.

Version to which user events sent to Braze will be associated with. See more details

Automatically Send In-App Messages Required.

When this is enabled, all In-App Messages that a user is eligible for are automatically delivered to the user. If you’d like to register your own display subscribers or send soft push notifications to your users, make sure to disable this option.

Content Security nonce Required.

Allows Braze to add the nonce to any

Device Property Allow List Required.

By default, the Braze SDK automatically detects and collects all device properties in DeviceProperties. To override this behavior, provide an array of DeviceProperties. See more details

Disable Push Token Maintenance Required.

By default, users who have already granted web push permission will sync their push token with the Braze backend automatically on new session to ensure deliverability. To disable this behavior, set this option to false

Do Not Load Font Awesome Required.

Braze automatically loads FontAwesome 4.7.0 from the FontAwesome CDN. To disable this behavior set this option to true.

Enable Logging Required.

Set to true to enable logging by default

Enable SDK Authentication Required.

Set to true to enable the SDK Authentication feature.

SDK Endpoint Required.

Your Braze SDK endpoint. See more details

In-App Message Z Index Required.

By default, the Braze SDK will show In-App Messages with a z-index of 1040 for the screen overlay, 1050 for the actual in-app message, and 1060 for the message’s close button. Provide a value for this option to override these default z-indexes.

Localization Required.

By default, any SDK-generated user-visible messages will be displayed in the user’s browser language. Provide a value for this option to override that behavior and force a specific language. The value for this option should be a ISO 639-1 Language Code.

Manage Service Worker Externally Required.

If you have your own service worker that you register and control the lifecycle of, set this option to true and the Braze SDK will not register or unregister a service worker. See more details

Minimum Interval Between Trigger Actions in Seconds Required.

Provide a value to override the default interval between trigger actions with a value of your own. See more details

No Cookies Required.

By default, the Braze SDK will store small amounts of data (user ids, session ids), in cookies. Pass true for this option to disable cookie storage and rely entirely on HTML 5 localStorage to identify users and sessions. See more details

Open Cards In New Tab Required.

By default, links from Card objects load in the current tab or window. Set this option to true to make links from cards open in a new tab or window.

Open In-App Messages In New Tab Required.

By default, links from in-app message clicks load in the current tab or a new tab as specified in the dashboard on a message-by-message basis. Set this option to true to force all links from in-app message clicks open in a new tab or window.

Require Explicit In-App Message Dismissal Required.

By default, when an in-app message is showing, pressing the escape button or a click on the greyed-out background of the page will dismiss the message. Set this option to true to prevent this behavior and require an explicit button click to dismiss messages.

Safari Website Push ID Required.

If you support Safari push, you must specify this option with the website push ID that you provided to Apple when creating your Safari push certificate (starts with “web”, e.g. “web.com.example.domain”).

SDK Version Required.

The version of the SDK to use. Defaults to 3.3.

Service Worker Location Required.

By default, when registering users for web push notifications Braze will look for the required service worker file in the root directory of your web server at /service-worker.js. If you want to host your service worker at a different path on that server, provide a value for this option that is the absolute path to the file, e.g. /mycustompath/my-worker.js. VERY IMPORTANT: setting a value here limits the scope of push notifications on your site. For instance, in the above example, because the service ,worker file is located within the /mycustompath/ directory, appboy.registerAppboyPushMessages MAY ONLY BE CALLED from web pages that start with http://yoursite.com/mycustompath/.

Session Timeout in Seconds Required.

By default, sessions time out after 30 minutes of inactivity. Provide a value for this configuration option to override that default with a value of your own.

Available Presets

Braze Web Device Mode (Actions) has the following presets:

Preset Name Trigger Default Action
Order Completed calls Event type = "track" and event = "Order Completed"
Track Purchase
Identify Calls Event type = "identify"
Event type = "group"
Update User Profile
Track Calls Event type = "track" and event != "Order Completed"
Track Event

Available Actions

Build your own subscriptions! Combine supported triggers with the following Braze Web Device Mode-supported actions:

Debounce Middleware

When enabled, it ensures that only events where at least one changed trait value are sent to Braze, and events with duplicate traits are not sent.

Debounce Middleware is a Web action.

This action does not have any fields.

Track Event

Reports that the current user performed a custom named event.

Track Event is a Web action.

Click to show / hide fields

Field Description
Event Name Type: STRING

The identifier for the event to track.

Event Properties Type: OBJECT

Hash of properties for this event.

Update User Profile

Updates a users profile attributes in Braze

Update User Profile is a Web action.

Click to show / hide fields

Field Description
External User ID Type: STRING

The unique user identifier

Country Type: STRING

The country code of the user

Current Location Type: OBJECT

The user’s current longitude/latitude.

Custom Attributes Type: OBJECT

Sets a custom user attribute. This can be any key/value pair and is used to collect extra information about the user.

Date of Birth Type: DATETIME

The user’s date of birth

Email Type: STRING

The user’s email

Email Subscribe Type: STRING

The user’s email subscription preference: “opted_in” (explicitly registered to receive email messages), “unsubscribed” (explicitly opted out of email messages), and “subscribed” (neither opted in nor out).

First Name Type: STRING

The user’s first name

Last Name Type: STRING

The user’s last name

Gender Type: STRING

The user’s gender: “M”, “F”, “O” (other), “N” (not applicable), “P” (prefer not to say) or nil (unknown).

Home City Type: STRING

The user’s home city.

Image URL Type: STRING

URL of image to be associated with user profile.

Language Type: STRING

The user’s preferred language.

Phone Number Type: STRING

The user’s phone number

Push Subscribe Type: STRING

The user’s push subscription preference: “opted_in” (explicitly registered to receive push messages), “unsubscribed” (explicitly opted out of push messages), and “subscribed” (neither opted in nor out).

Track Purchase

Reports that the current user made an in-app purchase.

Track Purchase is a Web action.

Click to show / hide fields

Field Description
Purchase Properties Type: OBJECT

Hash of properties for this purchase. Keys are limited to 255 characters in length, cannot begin with a $, and can only contain alphanumeric characters and punctuation. Values can be numeric, boolean, Date objects, strings 255 characters or shorter, or nested objects whose values can be numeric, boolean, Date objects, arrays, strings, or null. Total size of purchase properties cannot exceed 50KB.

Products Type: OBJECT

List of products purchased by the user

Destination Settings

Setting Description
Allow Crawler Activity Required.

Allow Braze to log activity from crawlers. See more details

Allow User Supplied Javascript Required.

To indicate that you trust the Braze dashboard users to write non-malicious Javascript click actions, set this property to true. If enableHtmlInAppMessages is true, this option will also be set to true. See more details

API Key Required.

Found in the Braze Dashboard under Settings → Manage Settings → Apps → Web

App Version Required.

Version to which user events sent to Braze will be associated with. See more details

Automatically Send In-App Messages Required.

When this is enabled, all In-App Messages that a user is eligible for are automatically delivered to the user. If you’d like to register your own display subscribers or send soft push notifications to your users, make sure to disable this option.

Content Security nonce Required.

Allows Braze to add the nonce to any

Device Property Allow List Required.

By default, the Braze SDK automatically detects and collects all device properties in DeviceProperties. To override this behavior, provide an array of DeviceProperties. See more details

Disable Push Token Maintenance Required.

By default, users who have already granted web push permission will sync their push token with the Braze backend automatically on new session to ensure deliverability. To disable this behavior, set this option to false

Do Not Load Font Awesome Required.

Braze automatically loads FontAwesome 4.7.0 from the FontAwesome CDN. To disable this behavior set this option to true.

Enable Logging Required.

Set to true to enable logging by default

Enable SDK Authentication Required.

Set to true to enable the SDK Authentication feature.

SDK Endpoint Required.

Your Braze SDK endpoint. See more details

In-App Message Z Index Required.

By default, the Braze SDK will show In-App Messages with a z-index of 1040 for the screen overlay, 1050 for the actual in-app message, and 1060 for the message’s close button. Provide a value for this option to override these default z-indexes.

Localization Required.

By default, any SDK-generated user-visible messages will be displayed in the user’s browser language. Provide a value for this option to override that behavior and force a specific language. The value for this option should be a ISO 639-1 Language Code.

Manage Service Worker Externally Required.

If you have your own service worker that you register and control the lifecycle of, set this option to true and the Braze SDK will not register or unregister a service worker. See more details

Minimum Interval Between Trigger Actions in Seconds Required.

Provide a value to override the default interval between trigger actions with a value of your own. See more details

No Cookies Required.

By default, the Braze SDK will store small amounts of data (user ids, session ids), in cookies. Pass true for this option to disable cookie storage and rely entirely on HTML 5 localStorage to identify users and sessions. See more details

Open Cards In New Tab Required.

By default, links from Card objects load in the current tab or window. Set this option to true to make links from cards open in a new tab or window.

Open In-App Messages In New Tab Required.

By default, links from in-app message clicks load in the current tab or a new tab as specified in the dashboard on a message-by-message basis. Set this option to true to force all links from in-app message clicks open in a new tab or window.

Require Explicit In-App Message Dismissal Required.

By default, when an in-app message is showing, pressing the escape button or a click on the greyed-out background of the page will dismiss the message. Set this option to true to prevent this behavior and require an explicit button click to dismiss messages.

Safari Website Push ID Required.

If you support Safari push, you must specify this option with the website push ID that you provided to Apple when creating your Safari push certificate (starts with “web”, e.g. “web.com.example.domain”).

SDK Version Required.

The version of the SDK to use. Defaults to 3.3.

Service Worker Location Required.

By default, when registering users for web push notifications Braze will look for the required service worker file in the root directory of your web server at /service-worker.js. If you want to host your service worker at a different path on that server, provide a value for this option that is the absolute path to the file, e.g. /mycustompath/my-worker.js. VERY IMPORTANT: setting a value here limits the scope of push notifications on your site. For instance, in the above example, because the service ,worker file is located within the /mycustompath/ directory, appboy.registerAppboyPushMessages MAY ONLY BE CALLED from web pages that start with http://yoursite.com/mycustompath/.

Session Timeout in Seconds Required.

By default, sessions time out after 30 minutes of inactivity. Provide a value for this configuration option to override that default with a value of your own.

Available Presets

Braze Web Device Mode (Actions) has the following presets:

Preset Name Trigger Default Action
Order Completed calls Event type = "track" and event = "Order Completed"
Track Purchase
Identify Calls Event type = "identify"
Event type = "group"
Update User Profile
Track Calls Event type = "track" and event != "Order Completed"
Track Event

Available Actions

Build your own subscriptions! Combine supported triggers with the following Braze Web Device Mode-supported actions:

Debounce Middleware

When enabled, it ensures that only events where at least one changed trait value are sent to Braze, and events with duplicate traits are not sent.

Debounce Middleware is a Web action.

This action does not have any fields.

Track Event

Reports that the current user performed a custom named event.

Track Event is a Web action.

Click to show / hide fields

Field Description
Event Name Type: STRING

The identifier for the event to track.

Event Properties Type: OBJECT

Hash of properties for this event.

Update User Profile

Updates a users profile attributes in Braze

Update User Profile is a Web action.

Click to show / hide fields

Field Description
External User ID Type: STRING

The unique user identifier

Country Type: STRING

The country code of the user

Current Location Type: OBJECT

The user’s current longitude/latitude.

Custom Attributes Type: OBJECT

Sets a custom user attribute. This can be any key/value pair and is used to collect extra information about the user.

Date of Birth Type: DATETIME

The user’s date of birth

Email Type: STRING

The user’s email

Email Subscribe Type: STRING

The user’s email subscription preference: “opted_in” (explicitly registered to receive email messages), “unsubscribed” (explicitly opted out of email messages), and “subscribed” (neither opted in nor out).

First Name Type: STRING

The user’s first name

Last Name Type: STRING

The user’s last name

Gender Type: STRING

The user’s gender: “M”, “F”, “O” (other), “N” (not applicable), “P” (prefer not to say) or nil (unknown).

Home City Type: STRING

The user’s home city.

Image URL Type: STRING

URL of image to be associated with user profile.

Language Type: STRING

The user’s preferred language.

Phone Number Type: STRING

The user’s phone number

Push Subscribe Type: STRING

The user’s push subscription preference: “opted_in” (explicitly registered to receive push messages), “unsubscribed” (explicitly opted out of push messages), and “subscribed” (neither opted in nor out).

Track Purchase

Reports that the current user made an in-app purchase.

Track Purchase is a Web action.

Click to show / hide fields

Field Description
Purchase Properties Type: OBJECT

Hash of properties for this purchase. Keys are limited to 255 characters in length, cannot begin with a $, and can only contain alphanumeric characters and punctuation. Values can be numeric, boolean, Date objects, strings 255 characters or shorter, or nested objects whose values can be numeric, boolean, Date objects, arrays, strings, or null. Total size of purchase properties cannot exceed 50KB.

Products Type: OBJECT

List of products purchased by the user

Other features

Braze Web Mode (Actions) can use the following features of Braze.

In-app Messaging

Find instructions to configure In-app Messaging in the Braze documentation. Once configured, you can trigger in-app message display as a result of several different event types. By default, all In-App Messages that a user is eligible for are automatically delivered to the user upon a session start event. A new session automatically starts when a user loads your site. If you’d like to force a new session for a user, make an Identify call with the corresponding userId for that user.

If you don’t want your site to display new In-App Messages as they’re received, disable automatic display and register your own display subscribers. To do this:

Create your subscriber by calling:

analytics.ready(function() {
  window.appboy.subscribeToNewInAppMessages(function(inAppMessages) {
      // Display the first in-app message. You could defer display here by pushing this message to code      within in your own application.
      // If you don't want to use Appboy's built-in display capabilities, you could alternatively pass      the in-app message to your own display code here.
      window.appboy.display.showInAppMessage(inAppMessages[0]);

    // Return an array with any remaining, unhandled messages to appboy's internal queue.
    // These will be part of the inAppMessages param the next time this subscriber is invoked.
      return inAppMessages.slice(1);
    });
});

The inAppMessages parameter will be an array of appboy.ab.InAppMessage subclass or appboy.ab.ControlMessage objects, each of which has various lifecycle event subscription methods.

Push Notifications

  1. To support push notifications on Chrome, you’ll need to enable FCM/GCM as well as configure your site. Check out steps one and two here, for detailed instructions on both.

  2. Browser Registration. In order for a browser to receive push notifications, you must register it for push by calling:

     analytics.ready(function() {
       window.appboy.registerAppboyPushMessages();
     });
    

    Note: Place this snippet outside of your Segment Snippet within your script tag.

    Note: This requests push permission from the user.

To show your own push-related UI to the user before requesting push permission (known as a soft push prompt), you can test to see if the user’s browser supports push by calling:

analytics.ready(function() {
  if (window.appboy.isPushSupported()) {
    // Add your push logic
  }
 });

Braze recommends checking to see if this returns true since not all browsers can receive push notifications. See Soft Push Prompts for instructions on setting up a soft push prompt using Braze In-App Messages.

To unsubscribe a user, call:

analytics.ready(function() {
  window.appboy.unregisterAppboyPushMessages();
});
  1. Set your GCM/FCM server API key and SenderID on the Braze dashboard. You can find more details for this here.

  2. To support push notifications on Safari, add your Website Push ID into your Segment Settings UI and Segment sends it when the Braze Web SDK initializes. To get your Website Push ID, follow the first two bullet points in these instructions.

Soft Push Prompts

  1. Follow step one to create a “Prime for Push” in-app messaging Campaign on the Braze dashboard.

  2. Add the following snippet to your site:

analytics.ready(function() {
  window.appboy.subscribeToNewInAppMessages(function(inAppMessages) {
    var message = inAppMessages[0];
    if (message != null) {
      var shouldDisplay = true;

      if (message instanceof appboy.ab.inAppMessage) {
        // Read the key/value pair for msg-id
        var msgId = message.extras["msg-id"];

        // If this is our push primer message
        if (msgId == "push-primer") {
          // We don't want to display the soft push prompt to users on browsers that don't support push, or if the user
          // has already granted/blocked permission
          if (!appboy.isPushSupported() || appboy.isPushPermissionGranted() || appboy.isPushBlocked())     {
            shouldDisplay = false;
          }
          // Prompt the user when the first button is clicked
          message.buttons[0].subscribeToClickedEvent(function() {
            appboy.registerAppboyPushMessages();
          });
        }
      }

      // Display the message
      if (shouldDisplay) {
        appboy.display.showInAppMessage(message);
      }
     }

    // Remove this message from the array of IAMs and return whatever's left
    return inAppMessages.slice(1);
   });
 });

For more details on this snippet, see Braze’s documentation here.

Place this snippet outside of your Segment Snippet within your script tag.

  1. When you’d like to display the Soft Push to a user, call:
 analytics.ready(function() {
  window.appboy.logCustomEvent("prime-for-push")
 });

Important differences from the classic Braze destination

  • Braze Web Mode (Actions) supports the Braze Web integration. Braze Cloud Mode (Actions) supports server and mobile sources, but to use mobile sources in device-mode, use the Braze Classic destination.

Migration from Braze Classic

Analytics.js 2.0

Actions-based destinations may require features found in Analytics.js 2.0. If the destination has Web actions and is connected to a javascript source, upgrade your Analytics.js source to ensure compatibility.

Keep the following in mind if you plan to move to Braze (Actions) from the classic Braze destination.

Braze-web settings mapping

braze-web Classic Destination Setting How to enable in braze-web (Actions)
Connection Settings
App Identifier
Cloud Device-web

Global Setting


The setting is called App ID

REST API Key
Cloud

This setting is renamed API Key in the Braze Web Mode (Actions) Connection Settings.

Custom API Endpoint
Device-web
Appboy Datacenter
Cloud

This setting is covered by the SDK Endpoint in Braze Web Mode (Actions) Connection Settings.

Log Purchase when Revenue is present
Device-web

Modify the Trigger for the Track Purchase action to recreate this behavior in Braze (Actions). By default, events named “Order Completed” trigger this action, but you can update the Trigger to check for a property named revenue. The event must have a products array with product_id and price.

Custom REST API Endpoint
Cloud

Global Setting


REST API Endpoint

Safari Website Push ID
Device-web

This setting is available in the Braze Web Mode (Actions) Connection Settings.

Braze Web SDK Version
Device-web

Available in the SDK Version Connection Setting. Defaults to version 3.3.

Connection Mode
Cloud Device-web

Choose the version of the Braze (Actions) destination that matches your connection mode.


In-App Messaging
Enable Automatic In-App Message Registration
Device-web

Unsupported, available only on Mobile.

Automatically send In-App Messages
Device-web

Available as a setting in Braze Web Mode (Actions)


Do Not Load Font Awesome
Device-web

Available in the Braze Web Mode (Actions) Connection Settings.

Open In-App Messages in New Tab
Device-web

Available in the Braze Web Mode (Actions) Connection Settings.

Page
Track All Pages
Device-web

Create a Track Event subscription and update the Event Trigger to specify Event Type is Page and Event Property 'name' exists. Update the Event Name field for the Track Event action to “Viewed Page {name}”. Use the Event Variables selector to select the name variable.

Track Only Named Pages
Device-web

Create a Track Event subscription and update the Event Trigger to specify Event Type is Page and. Update the Event Name field for the Track Event action to “Viewed Page {name}”. Use the Event Variables selector to select the name variable.

Other Settings
Allow Crawler Activity
Device-web

Available in the Braze Web Mode (Actions) Connection Settings.

Enable Logging
Device-web

Available in the Braze Web Mode (Actions) Connection Settings.

Minimum Interval Between Trigger Actions in Seconds
Device-web

Available in the Braze Web Mode (Actions) Connection Settings.

Only Track Known Users
Device-web

Available as a setting in Braze Web Mode (Actions)


Open News Feed Cards in New Tab
Device-web

Available in the Braze Web Mode (Actions) Connection Settings.

Service Worker Location
Device-web

Available in the Braze Web Mode (Actions) Connection Settings.

Session Timeout in Seconds
Device-web

Available in the Braze Web Mode (Actions) Connection Settings.

This page was last modified: 02 Dec 2021



Get started with Segment

Segment is the easiest way to integrate your websites & mobile apps data to over 300 analytics and growth tools.
or
Create free account