# How push notifications work

> What a Releva push notification is, which channels it reaches, how a browser or app opts in, what the delivery options and the daily limit do, and which events the statistics count.

A push notification in Releva is a saved message that campaigns and workflows deliver to a customer’s browser or app. Saving it sends nothing. This page explains what one is made of, how devices opt in, what the delivery options mean and where the numbers on the cards come from. To build one, follow [Create a web push notification](https://releva.ai/documentation/guides/push-notifications/create-a-web-push-notification/).

## Four channels, one notification

One notification can target several **Channels**:

| Channel       | Reaches                                                                              | Needs                                                                                                                                                        |
| ------------- | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Web**       | Browsers on desktop and mobile where the visitor allowed notifications for your site | The Releva web SDK with a service worker on your site                                                                                                        |
| **Android**   | Your Android app, through Firebase Cloud Messaging                                   | A Firebase service account under **Settings › Messaging › Push Notifications**                                                                               |
| **IOS**       | Your iOS app, through Firebase (APNs tokens are imported into Firebase)              | The same Firebase service account and the **iOS APNs environment** setting (**Sandbox** for development builds, **Production** for TestFlight and App Store) |
| **App Inbox** | The in-app inbox of your Android or iOS app                                          | Firebase credentials for at least one platform                                                                                                               |

Each push channel has its own **Subject**, **Body**, images and **Button Text**, with a preview next to the form. Android, IOS and App Inbox stay greyed out until a developer adds the Firebase credentials; the form says so. With **Unified** apps one Firebase file covers both platforms; with **Separate** apps each platform has its own.

## Two types

* **Message** is a fixed text. Merge tags such as `{{firstName}}` and the fields of the triggering event personalise it.
* **Recommender** picks one product from a **Product Feed** for each customer and fills the notification from it: icon `{{product.imageUrl}}`, link `{{product.url}}`, button **Shop Now**. See [How product feeds work](https://releva.ai/documentation/learn/product-feeds/how-product-feeds-work/).

The type is locked after the first save. To change it, create a new notification or use **Make a copy** and change the copy before saving.

## How a device opts in

Push is permission-based. Releva never draws the opt-in prompt; the browser or the operating system does.

**Browsers.** Your site runs the Releva web SDK with the `serviceWorkerUrl` option and hosts Releva’s service worker file. When the browser’s permission is still undecided, the SDK asks for it; if the visitor allows, the SDK subscribes the browser and registers the subscription with Releva. Releva stores it per device and links the device to the visitor’s profile. A browser that denied notifications is never asked again by Releva.

**Apps.** Your app asks for the notification permission, gets a push token from Firebase (Android) or APNs (iOS) and registers it with Releva through the mobile SDK. Register it again whenever the token changes and after the customer logs in or out, so the token moves to the right profile. If the profile id is unknown to Releva, a placeholder profile is created so segments can find the device.

Every registration writes a **Push Notification Subscribe** event on the profile. You can segment on it and use it as a trigger. There is no “unsubscribe” call: a browser or app subscription is removed when the push service rejects it at send time (a bounce). A customer who turns notifications off in the browser or the OS stops receiving them at that point.

The developer side is in the [Push notifications API overview](https://releva.ai/documentation/reference/push-notifications/overview/).

## Notification options

The **Behavior** tab holds the delivery options of a push channel:

| Option                        | What it does                                                                                                                                                                                                          |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Tag**                       | A short string that groups notifications. A new notification with the same tag replaces the one still shown on the device, so a customer never sees two copies of the same campaign. Required; the default is `tag1`. |
| **Message Expire Time**       | Hours the push service keeps the message for a device that is offline (web push TTL). After that the device never sees it. Default 168 (one week), minimum 1.                                                         |
| **Require Interaction**       | The notification stays on screen until the customer clicks or dismisses it. On by default.                                                                                                                            |
| **Renotify**                  | A notification that replaces one with the same tag vibrates and plays a sound again. Mostly affects mobile devices. On by default.                                                                                    |
| **Silent**                    | No sound, vibration or screen wake-up. On apps, a silent notification is sent with normal instead of high priority. Off by default.                                                                                   |
| **Link** (Web Targeting)      | The page a click opens. Releva wraps it in a tracking redirect so clicks are counted. Merge tags are allowed.                                                                                                         |
| **Target** (Mobile Targeting) | For Android and IOS: open the **Main Screen**, the **Open Inbox**, a **Specific Screen** of the app (with optional key-value parameters) or a **URL**.                                                                |
| **Expiry (days)** (App Inbox) | How long the message stays in the inbox. Empty means it never expires.                                                                                                                                                |

## The daily limit

Each shop has a **Max Push Notifications Per Day** per customer under **Settings › Messaging**, tab **Push Notifications**. The check applies to one-off and continuous sends; triggered workflows do not check the limit (the form’s note says the setting applies in continuous campaigns or workflows). On the **Behavior** tab, **If max push notifications per day is reached** decides what happens to a customer who already reached it:

* **Reschedule**: Releva tries again on a later day, up to **Max Reschedules** times (1 to 10, default 3), then gives up for that customer. Not available together with **App Inbox**.
* **Send anyway**: the limit is ignored for this notification.
* **Skip sending**: the customer does not get this notification.

## Testing

**Test** on a content tab offers two options. **Preview in This Browser** shows the notification through your own browser’s notification system with sample data; it needs notification permission for the Releva admin site. **Send to a Real User** delivers a real push to every device of one profile (by e-mail, phone or profile id) and renders merge tags with the profile you choose to impersonate. Use it to see personalisation and the real look on a device.

## Sending and statistics

A notification is delivered when a workflow with a push node runs, or when a campaign uses it. **Send** on the notification creates or opens such a workflow; see [Send a push notification with a workflow](https://releva.ai/documentation/guides/push-notifications/send-a-push-notification-with-a-workflow/).

Each delivery writes events on the profile, which the cards and the **Statistics** page count for the selected period:

| Event                                 | Counted as                                  |
| ------------------------------------- | ------------------------------------------- |
| **Push Notification Sent**            | **Sent**                                    |
| **Push Notification Delivered**       | **Delivered** (share of sent)               |
| **PushNotification Click**            | **Clicks** (share of delivered)             |
| **PushNotification Bounce**           | **Bounces**; the subscription is removed    |
| Orders attributed to the notification | **Conversions**, **Purchases**, **Revenue** |

With **App Inbox** the card also shows **Inbox Sent**, **Inbox Reads** and **Inbox Clicks**. The people icon next to a number opens a new segment of the profiles behind it, so you can retarget, for example, everyone who clicked. All these events are also available as segment rules.

## Next steps

* [Create a web push notification](https://releva.ai/documentation/guides/push-notifications/create-a-web-push-notification/): Write a notification with a subject, body, image and link.
* [Send a push notification with a workflow](https://releva.ai/documentation/guides/push-notifications/send-a-push-notification-with-a-workflow/): Test a saved notification and send it from a workflow.
* [Push notifications API overview](https://releva.ai/documentation/reference/push-notifications/overview/): Register browsers and apps for push from your own code.
* [How consent works in Releva](https://releva.ai/documentation/learn/consent/how-consent-works-in-releva/): See how opt-ins and subscriptions decide who can receive messages.