【问题标题】:How to get the open rate of the notification sent from the Firebase notifications console?如何获取从 Firebase 通知控制台发送的通知的打开率?
【发布时间】:2017-03-10 01:13:37
【问题描述】:

我为 android https://github.com/firebase/quickstart-android/tree/master/messaging 和 ios https://github.com/firebase/quickstart-ios/tree/master/messaging 配置并安装了示例 Firebase 快速启动应用程序。

我能够从 Firebase 控制台发送通知,但是当我打开通知时,我在 Firebase 控制台后端看不到打开率。

根据文档,当用户点击通知时,会自动触发 open 事件。

是否还有其他步骤可以查看从控制台发送的通知的打开率?

还有没有办法从 API 发送通知并仍然获得这些通知的打开率?

【问题讨论】:

  • 在控制台上更新最多需要 48-72 小时。因此您可以在 48 小时后查看分析的打开率。但是您也可以通过应用 adb shell setprop 日志查看实时.tag.FA VERBOSE,adb shell setprop log.tag.FA-SVC VERBOSE,adb logcat -v time -s FA FA-SVC 命令。
  • 听起来像是 Arpit 的答案!:-)

标签: firebase firebase-cloud-messaging firebase-analytics firebase-notifications


【解决方案1】:

您需要在 gradle 中包含与 firebase 分析相关的依赖项。打开率是分析库的一部分。

检查您是否包含了这两个: 编译'com.google.firebase:firebase-core:9.4.0' 编译 'com.google.firebase:firebase-messaging:9.4.0'

【讨论】:

  • 同样的情况也发生在我身上。我已经编译了你指定的两个库。问题是,当我第一次测试时,我能够看到目标率和打开率。但是几周后,当我发送第二次推送通知时,没有显示目标和打开率的数据。
【解决方案2】:

如果你在iOS 10上实现了UNUserNotificationCenterDelegate,需要调用

Messaging.messaging().appDidReceiveMessage(userInfo) // 向 Firebase 云消息发送确认消息

在这两个委托方法中

public func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
    let userInfo = notification.request.content.userInfo
    Messaging.messaging().appDidReceiveMessage(userInfo)
}

public func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
    let userInfo = response.notification.request.content.userInfo
    Messaging.messaging().appDidReceiveMessage(userInfo)
    completionHandler()
}

否则,你需要实现这个 UIApplicationDelegate 方法:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
   [[FIRMessaging messaging] appDidReceiveMessage:userInfo];
   completionHandler(UIBackgroundFetchResultNoData);
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-23
    • 1970-01-01
    相关资源
    最近更新 更多