如何获取从Firebase通知控制台发送的通知的打开率?

3
我为安卓和ios配置并安装了Firebase快速入门应用程序(https://github.com/firebase/quickstart-android/tree/master/messaginghttps://github.com/firebase/quickstart-ios/tree/master/messaging),我可以从Firebase控制台发送通知,但是当我打开通知时,无法在Firebase控制台后端看到打开率。
根据文档,当用户点击通知时,将自动触发打开事件。
除了从控制台发送的通知之外,是否还涉及其他步骤以查看打开率?
另外,有没有办法从API发送通知,同时仍然能够获取这些通知的打开率?

5
更新需要48-72小时才能在控制台上更新。因此,您可以在48小时后查看分析工具中的打开率。但是,您也可以通过应用“adb shell setprop log.tag.FA VERBOSE”,“adb shell setprop log.tag.FA-SVC VERBOSE”,“adb logcat -v time -s FA FA-SVC commands”来实时查看。 - Arpit Patel
听起来像是Arpit给出的答案!:-) - Frank van Puffelen
2个回答

2
如果您在iOS 10上实现了UNUserNotificationCenterDelegate,则需要在以下两个委托方法中调用Messaging.messaging().appDidReceiveMessage(userInfo)

//它会向Firebase Cloud Messging发送确认消息

Messaging.messaging().appDidReceiveMessage(userInfo)

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);
}

0

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

请检查是否已经包含了以下两个依赖项: compile 'com.google.firebase:firebase-core:9.4.0' compile 'com.google.firebase:firebase-messaging:9.4.0'


我也遇到了同样的情况。我已经编译了您指定的两个库。问题是,当我第一次测试时,我能够看到目标率和打开率。但是几周后,当我发送第二条推送通知时,目标率和打开率没有显示任何数据。 - Adrian Buciuman

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接