默认
发表评论 0
想开发IM:买成品怕坑?租第3方怕贵?找开源自已撸?尽量别走弯路了... 找站长给点建议
如何统计 Push 消息的打开率?
阅读(2135) | 评论(0 收藏 淘帖
"2.3.1 及以上版本支持系统消息推送的点击统计,您可以通过 SDK 提供的 API 统计打开的消息和点击的时间。

在您的 AppDelegate 代码中调用 SDK push 统计 API。

请根据当前的 SDK 确定调用具体的接口

RCIMClient 和 RCCoreClient 两个类的接口是互斥的,不能同时调用两个类的接口,否则会出现重复统计

1、在 app 启动和 SDK init 之后,调用 recordLaunchOptionsEvent 接口

- (BOOL)application: (UIApplication *)application
    didFinishLaunchingWithOptions: (NSDictionary *)launchOptions {
...
    //初始化融云SDK
    [[RCIM sharedRCIM] initWithAppKey:RONGCLOUD_IM_APPKEY];
...
  /**
   * 统计Push打开率1。
   */
  //2.x 或 4.x 版本调用下面接口
  [[RCIMClient sharedRCIMClient] recordLaunchOptionsEvent:launchOptions];

  //5.x 版本调用下面接口
  [[RCCoreClient sharedCoreClient] recordLaunchOptionsEvent:launchOptions];
...
}
2、收到本地通知后调用 recordLocalNotificationEvent 接口

- (void)application: (UIApplication *)application
    didReceiveLocalNotification: (UILocalNotification *)notification {
...
  /**
   * 统计Push打开率2
   */
   //2.x 或 4.x 调用下面接口
  [[RCIMClient sharedRCIMClient] recordLocalNotificationEvent:notification];

  //5.x 调用下面接口
  [[RCCoreClient sharedCoreClient] recordLocalNotificationEvent:notification];
...
}
3、收到远程推送后调用 recordRemoteNotificationEvent 接口

- (void)application: (UIApplication *)application
    didReceiveRemoteNotification: (NSDictionary *)userInfo {
...
  /**
   * 统计Push打开率3
   */
  //2.x 或 4.x 版本调用下面接口
  [[RCIMClient sharedRCIMClient] recordRemoteNotificationEvent:userInfo];

  //5.x 版本调用下面接口
  [[RCCoreClient sharedCoreClient] recordRemoteNotificationEvent:userInfo];
...
}"


即时通讯网 - 即时通讯开发者社区! 来源: - 即时通讯开发者社区!

上一篇:实现会话界面多选消息时,限制最大多选消息数下一篇:无法弹出被呼叫页面
推荐方案
打赏楼主 ×
使用微信打赏! 使用支付宝打赏!

返回顶部