Online Notification Service Events

The web-push messages, I see that the working service can be triggered by several events, such as push, notificationclick. To track your CTR, an event is notificationclickvery important. In the same way, there is an event such as "rejectnotification", which is fired when the user rejects the notification. In this way, the service worker can track users who reject notifications.

+4
source share
3 answers

I assume that by rejecting you mean close? If so, then there is no such event. There used to be an onclose event, but now it is deprecated.

https://developer.mozilla.org/en-US/docs/Web/API/Notification/onclose

+4
source

There is an event notificationclose, but only for continuous notifications.

https://notifications.spec.whatwg.org/#closing-a-notification

+2
source

There is an event notificationcloseas described here:

https://developers.google.com/web/updates/2016/03/notifications?hl=en

0
source

Source: https://habr.com/ru/post/1621852/


All Articles