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.

This document is about a feature which is in beta. This means that the Destination Actions are in active development, and some functionality may change before it becomes generally available

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.

Connection Settings

Click to expand fields

Setting Description
Allow Crawler Activity Default off

Enable to allow Braze to log activity from crawlers.

Allow User Supplied Javascript Default off

Enable to indicate that you trust the Braze dashboard users to write non-malicious Javascript click actions, set this property to true.

API Key (required)

Enter the API Key to identify your application to Braze.

App Version

Enter the version of the application to which user events will be associated for the purpose of segmentation.

Content Security Nonce

Enter a value that Braze will add to any script and style elements that the SDK creates.

Disable Push Token Maintenance Default On

Enable to allow users who have already granted web push permission will to their push token with the Braze backend automatically on new session to ensure deliverability.

Do Not Load Font Awesome Default off

Enable to prevent Braze from loading FontAwesome 4.7.0 from the FontAwesome CDN.

Enable Logging Default off

Enable to turn on logging by default.

Enable SDK Authentication Default off

Enable to turn on Braze’s SDK Authentication.

SDK Endpoint (required)

Select the SDK Endpoint for your Braze applicaiton.

In-App Message Z Index

Enter a z-index value for the Braze In-App Message. 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.

Localization Default _specified by the user's browser_

Enter a ISO 639-1 Language Code to override the user’s default browser language.

Manage Service Worker Externally Default off

Enable to prevent Braze from registering and unregistering a service worker of which you control the lifecycle.

Minimum Interval Between Trigger Actions in Seconds Default 30

Enter a value to override the default interval between trigger actions.

No Cookies Default off

Enable the option to disable cookie storage and rely on HTML5 localStorage to identify users and sessions.

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.

Pre-built subscriptions

Subscription Name Trigger Braze Web Action
Track Calls All track calls from the connected source, where the Event Name is not “Order Completed” Track Event
Order Completed Calls All track calls from the connected source, where the Event Name is “Order Completed” Track Purchase
Identify Calls All calls where the Event Type is Identify or Group Update User Profile

Available Braze Web Mode Actions

Build your own subscription. Combine the supported triggers with the following Braze-supported actions:

Track Event

Track Event sends Braze a Track Event call when the destination receives a Track event that is not named Order Completed.

Click to expand fields

Field Description
Event Name Default event

The name of the event that Braze receives.

Time Default receivedAt

The timestamp of when the event occured.

External User ID Default userId

The unique identifier of the user who performed the event.

User Alias Object

The user alias object. For more information, see the Braze documentation.

Braze User Identifier Default properties.braze_id

The unique identifier of the user that is passed to Braze.

Event Properties Default properties

The object that contains properties pertaining to the event.

Update Existing Only

Set to true to use the Braze API in “Update Only” mode.

Track Purchase

Track Purchase sends Braze a Track Purchase call when the destination recieves any event named Order Completed.

Click to expand fields

Field Description
Time Default receivedAt

The timestamp of when the event occured.

Products Default properties.products

A list of the products included in the order.

External User ID Default userId

The unique identifier of the user who performed the event.

User Alias Object

The user alias object. For more information, see the Braze documentation.

Braze User Identifier Default properties.braze_id

The unique identifier of the user that is passed to Braze.

Event Properties Default properties

The object that contains properties pertaining to the event.

Update Existing Only

Set to true to use the Braze API in “Update Only” mode.

Update User Profile

Update User Profile sends to Braze a request to update an existing user’s profile attributes when the destination receives an Identify call.

Click to expand fields

Identify Debounce

When enabled for Javascript sources, this action ensure that only Identify calls where at least one updated trait value are sent to Braze. Events with duplicate traits are not sent. To use Identify Debounce with mobile sources, include Segment’s open-source Middleware tool.

This action does not have any fields.

Migration from Braze Classic

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: 31 Aug 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