Web Push Topic & Collapsing

This page discusses Web Push Notification Collapsing, for Mobile Push, see Remove Notifications and TTL.

The OneSignal Web SDK will automatically collapse notifications for Chrome and Firefox. This means older notifications that have not been clicked and which are stored on the device's Notification Center are replaced by the newer notifications received. Safari does not provide notification collapse functionality.

For example, Notification 1 is sent and received, but the subscriber does not click it. Notification 2 is sent and received. Notification 1 is removed and replaced with Notification 2.

You can set the "Web Push Topic" to display more than 1 web push notification at a time on web.

Web Push Topic

The Web Push Topic is any string value you can set when sending Push Messages from the dashboard or web_push_topic API parameter.

If you do not specify the web_push_topic , each notification will be replaced by a newer notification. If you do specify web_push_topic, you can choose which notifications will be replaced and which notifications will stack.

For example:

  • Notification 1 sent with web_push_topic: "breaking-news"
  • Notification 2 sent with web_push_topic: "breaking-news"

Notification 2 will replace Notification 1.

  • Notification 3 sent with web_push_topic: "sports"
  • Notification 4 sent with web_push_topic: "weather"

Notification 2, 3 and 4 will all either be left on the screen or docked in the Notification Center.

Time To Live (TTL)

This is the amount of time a notification will be held by the Google (FCM) and Apple (APNs) servers if the subscriber's device does not have an internet connection. By default, notifications will be held for 3 days. This means if the device does not connect to the internet within 3 days, the message will not be sent to that device.

If the TTL value is 0, APNs/FMC treats the notification as if it expires immediately and does not store the notification or attempt to redeliver it if the device is not connected to a network.

For example, if you set TTL to 3 hours (10800 seconds) and my device does not have internet connection for 3 hours and 1 second or longer, I will not get the notification.

TTL does not remove the notification from the device once it has been received.

Time to Live can be set within the dashboard when Sending Push Messages or using the API ttl property.


How many notifications can be stored in the Notification Center?

On Chrome, a maximum of 3 notifications are displayed at any time, even if the other notifications are not related to your site or from OneSignal. This means you can only show 3 categories of notifications to your user, not counting for other notifications that might be displayed at that time.

On Firefox on Windows, many more notifications can be shown at a time (6+).

On Firefox on Mac, and Safari on Mac, only one notification can be shown at a time, even if the other notifications are not related to your site or from OneSignal. Notifications also disappear quickly within 5 seconds and this time is not customizable.

On Chrome/Firefox on Android, multiple notifications can be shown at a time.

Can you remove web push notifications without collapsing them?

There is not a way to remove web push notifications without collapsing.