> ## Documentation Index
> Fetch the complete documentation index at: https://docs.median.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Braze

> Add Braze push notifications and event tracking.

The Braze plugin integrates mobile push notifications and in-app event tracking to boost user engagement and strengthen data analytics. It also supports audience segmentation and targeted messaging using the [Braze iOS SDK](https://www.braze.com/docs/developer_guide/sdk_integration/?sdktab=swift) and [Braze Android SDK](https://www.braze.com/docs/developer_guide/sdk_integration?sdktab=android).

> [!TIP]
>
> **Test  with our demo page**
>
> We host a ready-made demo page at
>
> that calls the  features through the Median JavaScript Bridge.
> Load it inside your Median app during development, either by setting it
> as your app's website URL in App Studio or by navigating to it from your
> own site, and use it to confirm  works on a real device before
> you add it to your own pages.
>
> The demo page only works inside a Median app with  enabled.
> Opened in a regular mobile or desktop browser, the native features
> won't respond. Remember to switch your app back to your own URL before
> release.

## Why use this plugin

* **Push notifications**: Enable push messaging workflows in your app.
* **Event tracking**: Send custom events to Braze for analytics and campaign logic.
* **User targeting**: Support segmentation and targeted messaging.
* **Deep linking support**: Open notification links directly in your app when deep linking is configured.

## Prerequisites

* Access to the Braze plugin settings in Median App Studio (**Native Plugins** tab).
* Your Braze API keys and SDK endpoints for iOS and Android, from **Settings → APIs and Identifiers** in your Braze dashboard.
* Your Firebase Cloud Messaging Sender ID and `google-services.json` for Android (see [Google Services](https://docs.median.co/docs/google-services.md)).
* If testing with the Median demo page, use `https://median.dev/braze/`.

## Implementation guide

### Braze setup

Enable push notifications through Braze In-App Messaging as documented in the [Braze push primer](https://www.braze.com/docs/user_guide/channels/push/best_practices/push_primer_messages/).

### App configuration

Enable the Braze plugin in the **Native Plugins** tab and fill in its settings.

| Setting | Description |
| - | - |
| **iOS API Key** | Braze API key for your iOS app. |
| **iOS SDK Endpoint** | Braze SDK endpoint for your iOS app. |
| **Android API Key** | Braze API key for your Android app. |
| **Android SDK Endpoint** | Braze SDK endpoint for your Android app. |
| **Firebase Sender ID (Android only)** | Firebase Cloud Messaging Sender ID. |
| **Notification Channel Name (Android only)** | Name of the notification channel users see in Android settings. |
| **Notification Channel Description (Android only)** | Description of that notification channel. |
| **Automatic Registration** | When set to **Enable**, push permission is requested automatically. Disabled by default. |

> [!WARNING]
>
> **`google-services.json` required**
>
> Braze requires you to upload a `google-services.json` file to App Studio. See [Google Services](https://docs.median.co/docs/google-services.md) for the steps.

![Braze settings in the Native Plugins tab of App Studio, with the plugin enabled and Automatic Registration set to Disable](https://mintcdn.com/median-co/w3T47G9RoCtaRlQA/images/docs/docs/braze/app-studio-braze-settings.webp?fit=max\&auto=format\&n=w3T47G9RoCtaRlQA\&q=85\&s=031a3aa8522341efe6b410353c7cdef7)

App Studio – Braze plugin settings

### Deep linking

Set up [deep linking](https://docs.median.co/docs/deep-linking) within your app, and notification links will automatically open directly into your app.

### JavaScript Bridge functions

#### Change user

Signs in an existing user or registers a new user in Braze context.

Median JavaScript Bridge

```javascript JavaScript theme={null}
median.braze.changeUser({ userId: "user_123" });
```

**Parameters:**

| Parameter | Type | Required | Description |
| - | - | - | - |
| `userId` | `string` | Yes | User identifier to associate with the Braze profile. |

#### Prompt for push notification permission

Prompts users to enable push notifications.

Median JavaScript Bridge

```javascript JavaScript theme={null}
median.braze.promptNotification({'callback': function})
// Return value:
{
  "granted": true | false
}
```

**Parameters:**

| Parameter | Type | Required | Description |
| - | - | - | - |
| `callback` | `function` | No | Callback that receives `{ granted: true \| false }`. |

#### Check push notification permission

Checks if push notification permission has been granted.

Median JavaScript Bridge

```javascript JavaScript theme={null}
median.braze.notificationEnabled({'callback': function})
// Return value:
{
  "granted": true | false
}
```

**Parameters:**

| Parameter | Type | Required | Description |
| - | - | - | - |
| `callback` | `function` | No | Callback that receives `{ granted: true \| false }`. |

#### Track custom events

Sends a custom event to Braze.

**Note:** Custom events must be added in the [Braze Dashboard](https://www.braze.com/docs/user_guide/data/activation/events/custom_events/).

Median JavaScript Bridge

```javascript JavaScript theme={null}
median.braze.logCustomEvent("YOUR-EVENT-NAME", {
  "key1": value1,
  "key2": value2,
  ...
});
```

**Parameters:**

| Parameter | Type | Required | Description |
| - | - | - | - |
| `eventName` | `string` | Yes | Custom event name (must exist in Braze dashboard). |
| `properties` | `object` | No | Event key-value payload. |

## Testing checklist

Use this checklist to validate Braze integration:

* [ ] Braze plugin configuration is set (including `active`, platform API keys, and endpoint keys).
* [ ] `median.braze.promptNotification()` returns a permission result.
* [ ] `median.braze.notificationEnabled()` returns current permission state.
* [ ] `median.braze.changeUser({ userId })` is called for the active test user.
* [ ] `median.braze.logCustomEvent()` is called with a known event name.
* [ ] Test notifications are sent to a test user from Braze (Test tab).
* [ ] Notification opens app when configured as **Open App**.

## Troubleshooting

### Test users are not appearing in Braze test send flow

Ensure your app calls `median.braze.changeUser({ userId: "..." })` so the user is identified before sending test notifications.

### Push deep links open incorrectly

Confirm deep linking is set up in your app. Notification links rely on the app’s deep linking configuration.

### Permission prompt behavior differs on Android versions

On Android 13 and above, explicit permission is required. On Android 12 and below, permissions are granted automatically.


## Related topics

- [Changelog](https://docs.median.co/docs/changelog.md)
- [App updates and migration guide](https://docs.median.co/docs/app-updates.md)
- [Push SDK migration guide](https://docs.median.co/docs/push-notification-migration.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.