In web push notifications documentation, I see that service worker can get triggered by few events like push, notificationclick. For tracking CTR, notificationclick event is very important. Similarly, is there any event like 'rejectnotification' that gets triggered when user rejects notification. So, service worker can track users rejecting notifications.
4
votes
3 Answers
4
votes
I assume that by rejected you mean close? If so there is no such event. There used to be an onclose event but is now deprecated.
https://developer.mozilla.org/en-US/docs/Web/API/Notification/onclose
2
votes
There is a notificationclose event, but only for persistent notifications.
https://notifications.spec.whatwg.org/#closing-a-notification
0
votes
There is a notificationclose event as described here:
https://developers.google.com/web/updates/2016/03/notifications?hl=en