Why push notifications
Gaming platform GoGy games, for instance, wanted to find new ways to engage its million monthly users. So the company launched automated push notifications , alerting users about trending and relevant games on its site.
As a result, GoGy was able to drive tens of thousands of more users to its website each day — with low bounce rates and long session durations to boot. The benefits of push notifications go beyond just driving organic engagement. They can also be a powerful monetization tool for increasing revenue and providing value to advertising partners. Moreover, using personalized offers in push messages is an effective way to enhance user experience, cultivate audiences and build loyal customers.
Customers are cool with it, too. By adding push messaging to your marketing strategy, you can build direct customer relationships and generate more revenue. Our push messaging platform empowers publishers to deliver automated and personalized alerts — and even pair this with campaigns across other high-engagement channels like email.
It is incredibly powerful and simple to use. Where possible, it uses the same mechanisms a native app would use, giving a completely native look and feel. We can split the Notifications API into two core areas these are non-technical and are not part of the spec.
We create or invoke the notification from the page or from the server, in the case of push notifications. The Interaction API controls what happens when the user engages with the notification. User interaction is handled in the service worker. Before we can create a notification we need to get permission from the user. Below is the code to prompt the user to allow notifications. This goes in the app's main JavaScript file.
We call the requestPermission method on the global Notification object. This displays a pop-up message from the browser requesting permission to allow notifications. The user's response is stored along with your app, so calling this again returns the user's last choice. Once the user grants permission, the app can display notifications. We can show a notification from the app's main script with the showNotification method the "Invocation API".
Here is an example:. Notice the showNotification method is called on the service worker registration object. This creates the notification on the active service worker, so that events triggered by interactions with the notification are heard by the service worker. The showNotification method has an optional second argument for configuring the notification. The following example code demonstrates some of the available options.
See the showNotification reference on MDN for a complete explanation of each option. Here is a useful tool that allows you to experiment with all of the different notification options.
Simple notifications display information to the user and handle basic interactions when clicked. This is a massive step forward for the web, but it's still a bit basic. We can add contextually relevant actions to the notification so the user can quickly interact with our site or service without opening a page. For example:. To create a notification with a set of custom actions, we add an actions array inside the notification options object. This array contains a set of objects that define the action buttons to show to the user.
Actions can have an identifier string, a title containing text to be shown to the user, and an icon containing the location of an image to be displayed next to the action. Displaying a notification was the first step. Now we need to handle user interactions in the service worker using the "Interaction API". Once the user has seen your notification they can either dismiss it or act on it. If the user dismisses the notification through a direct action on the notification such as a swipe in Android , it raises a notificationclose event inside the service worker.
This event is important because it tells you how the user is interacting with your notifications. You might, for example, log the event to your analytics database.
Or, you might use the event to synchronize your database and avoid re-notifying the user of the same event. Here is an example of a notificationclose event listener in the service worker:. We can access the notification object from the event object.
From there we can get the data and decide how to respond. In the example, we are getting the primaryKey property defined earlier and logging it to the console.
The most important thing is to handle when the user clicks on the notification. The click triggers a notificationclick event inside your service worker. We can determine what action button the user clicked by inspecting the action property on the event object. When a user clicks on a notification they usually expect to be taken directly to where they can get more information about the notification.
You can open a new window by calling clients. Notice we check for the close action first and handle the explore action in an else block. This is a best practice as not every platform supports action buttons, and not every platform displays all your actions.
Handling actions in this way provides a default experience that works everywhere. The notification spec is constantly evolving with the authors and browser vendors constantly adding new features and increasing the possibilities of what you can do with the Notifications API.
Note that:. We need to build our sites and apps defensively, yet progressively so that our experiences work well everywhere. Let's look at what we can do to create a consistent experience. The web is not yet at the point where we can build apps that depend on web notifications. When possible, design for a lack of notification support and layer on notifications. The simplest thing to do is detect if the ability to send notifications is available and, if it is, enable that part of the user's experience:.
Here are some things you can do when the user's browser doesn't support the Notifications API:. Always check for permission to use the Notifications API.
It is important to keep checking that permission has been granted because the status may change:. The action buttons and images differ significantly across platforms. For example, some OSs may display a limited number of actions and others may not make actions directly visible to the user. You can check the maximum number of action buttons that can be displayed by calling Notification.
Do this when you create notifications so you can adapt them if needed. You can also check this in the notificationclick handler in the service worker to determine the right response.
A good practice is to assume that the system cannot support any actions other than the notification click. This means that you must design your notification to handle the default click and have it execute the default response. You can then layer on some customization for each action. Decide if the context of each action requires buttons to be grouped together.
If you have a binary choice, such as accept and decline, but can only display one button, you may decide to not display buttons. Finally, treat every attribute of the notification other than title and body as optional and at the discretion of the browser and the operating system to use.
For example, don't rely on images being present in the notification. If you are using the image to display contextual information such as a photo of a person , be sure to display that information in the title or the body so the user can determine the importance of the notification if the image is not visible.
Button labels should be clear and concise. Although action buttons can have images, not every system can display them. Also, don't rely on vibrations to notify the user. Many systems can't vibrate, or won't vibrate if the user has their device volume muted. We have learned how to create a notification and display it to the user directly from a web page. This is great if you want to create notifications when the page is open, but what if the page isn't open? Hit enter to search or ESC to close.
What are push notifications and why are they important? No Comments. Push notifications By now, we are all pretty used to getting push notifications from apps on our mobile phones.
What are their benefits? Users are free to opt-in or out from receiving PNs. This gives the user control over them, making it less likely from them to uninstall your mobile app just because they dislike PNs or find them distracting. This option makes it a win-win as only those users interested in your PNs will receive them. This means you can adapt your marketing strategy to each market or region, increasing your chances of success. Push notifications can help you improve user experience , making them more than just a marketing strategy.
Although the two may be inextricably linked, there is a difference between sending a message that just promotes a new feature and one that presents the user with a benefit. They help increase conversion rates and monetization. PNs are a call-to-action and aim to trigger an immediate action from the user.
When done well, they can help you encourage users to engage with your app, thereby increasing your conversion rates and driving monetization from your app. For example, if you operate a cooking blog, you can send the latest vegetarian recipes to veggie-loving subscribers.
Sending personalized and relevant content is a surefire way to increase retention and drive traffic to your content. There are many horror stories of organizations accidentally sending notifications that cause subscribers to freak out.
In one instance, for example, Samsung unintentionally sent this notification to Samsung Galaxy users worldwide, which caused a bit of confusion. In another horrific incident, residents of Hawaii received an emergency alert about an incoming ballistic missile that caused millions to believe that the world was ending. An example of the native iOS push notification opt-in prompt to allow notifications. An example of an opt-in permission prompt for web push.
Advertising Another Product Never send a push notification that includes advertisements for another product or service. What You Should Use Push Notifications For: Increasing Retention: The power of push notifications comes from their ability to dynamically change the way you engage with and retain users.
0コメント