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:
    1. Opted out via the browser settings, AND
    2. Not returned to the website.
 Note

Analytics must be enabled to determine registration status. See: Analytics and Reporting.

A user can change their opt in/out status in two places:

  1. The browser’s settings.
  2. 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.

 Note

Browser Trends

Many popular web browsers have recently made updates that require a user gesture before you can trigger the notification prompt, i.e., you cannot immediately ask for permission on page load.

This is true as of Safari 12.1 and Firefox 72, and we expect this trend to continue with other browsers. This is another good reason to implement a soft prompt as part of your acquisition strategy.