Firebase推送通知通过http协议发送点击事件分析

时间:2018-02-13 17:46:38

标签: firebase push-notification firebase-cloud-messaging firebase-analytics

有没有办法获得点击的通知计数,这些通知是通过网络应用程序上的firebase推送通知(fcm)HTTP协议发送的?

1 个答案:

答案 0 :(得分:0)

通知打开

您可以通过将以下内容添加到firebase-messaging.js文件来侦听数据有效内容的通知点击:

self.addEventListener('notificationclick', function(event) {
  event.notification.close();

  // Do something as the result of the notification click
});

通知关闭

您可以通过以下方式收听通知关闭事件:

self.addEventListener('notificationclose', function(event) {
  // Do something as the result of the notification close
});
  

参考:notificationclick