Push Notifications
Airship’s SDK provides a simple interface for managing web push notifications.
User Registration
A user is registered when they opt in to receiving notifications via the system
dialog, which varies slightly from browser to browser.
The dialog is presented when the page invokes the sdk.register()
function. As
a best practice, we discourage calling this function on page load, before the
user has had a chance to assess the potential usefulness of notifications from
your site. See Registration UI for a
simple, sample UI element that registers a user.
In any case, this moment when a user decides whether to allow or block notifications is when we will either register a channel for them with an opt-in status, or not.
The SDK returns this registration event to Airship, along with the user’s registration status and certain metadata, namely device property tags. When you send a push notification to a web user, their registration status is returned to Airship via the push service.
Registration Status
A user’s registration status is one of:
- Opted-in: Allowed notifications and has not subsequently disallowed them, either via browser settings or by calling the optOut() method.
- Opted-out: Initially allowed notifications but subsequently disabled them.
- Uninstalled: A user is considered to be Uninstalled if they have both:
- Opted out via the browser settings, AND
- Not returned to the website.
Analytics must be enabled to determine registration status. See: Analytics and Reporting.
A user can change their opt in/out status in two places:
- The browser’s settings.
- The website’s registration UI.
Registration UI
If a user is immediately presented with a notification permission dialog without knowing what sort of notifications to expect from your site, chances are higher that they will decline, making it difficult to re-engage with them in the future.
It is a best practice to explain the value of your notifications before displaying the system notification opt-in prompt.
We provide plugins in the SDK to help you customize this initial prompt, however Web ScenesA single or multi-screen in-app experience cached on users’ devices and displayed when users meet certain conditions in your app or website, such as viewing a particular screen or when a Custom Event occurs. They can be presented in fullscreen, modal, or embedded format using the default swipe/click mode or as a Story. Scenes can also contain survey questions. are the preferred method for opt-in prompting.
Most web browsers require a notification opt-in to occur in response to a user
action, meaning calling the SDK’s register()
method outside of an interaction
handler will result in the request being rejected without a dialog being
presented to the user.
Categories