Commit d7043f3a by ludi

完成除了网页链接打开进入直播间之外的其他进入直播间上报

parent 47fe547d
Showing with 173 additions and 11 deletions
......@@ -244,4 +244,22 @@ typedef enum : NSUInteger {
+ (void)fus_doEverydayStatLogWithSuccess:(void (^)(void))success
failure:(void (^)(NSString *msg, int code))failure;
/// App行为日志-加入直播间
/// @param reqType 加入直播间来源 1首页 2空间 3网页 4注册后自动加入 5外部调起
/// @param reqEventType 加入直播间来源子项,reqType=5的子项有3种:1系统推送进入 2直播间分享链接进入 3外部网页进入
/// @param extraInfo 有则传,额外信息,非json。存储需要可以直接展示查看的数据,比如 外部网页加入直播间 的网页URL
/// @param extraJson 有则传,json字符串。例如存储网页加入直播间的参数包、外部调起加入直播间参数包
/// @param roomId 房间id
+(void)fus_behaviorJoinRoomLogWithReqType:(NSInteger)reqType
reqEventType:(NSInteger)reqEventType
extraInfo:(NSString *)extraInfo
extraJson:(NSString *)extraJson
roomId:(NSString *)roomId;
/// App行为日志-外部调起
/// @param reqType 外部调起类型 1官网 2邀请链接 3直播间分享链接打开 4应用商店打开(appstore/googleplay) 5手机推送打开
/// @param reqEventType 外部调起来源子项,reqType=4的子项有2种:1appstore 2googleplay
/// @param reqJson json字符串,外部调起的参数包
+(void)fus_behaviorExternalCallLogWithReqType:(NSInteger)reqType reqEventType:(NSInteger)reqEventType reqJson:(NSString *)reqJson;
@end
......@@ -520,4 +520,33 @@
}];
}
/// App行为日志-外部调起
+ (void)fus_behaviorExternalCallLogWithReqType:(NSInteger)reqType reqEventType:(NSInteger)reqEventType reqJson:(NSString *)reqJson{
NSMutableDictionary *parm = [[NSMutableDictionary alloc] initWithDictionary:@{@"reqType": @(reqType),
@"reqJson": reqJson ?: @""}];
if (reqEventType > 0) {
parm[@"reqEventType"] = @(reqEventType);
}
[FUSHttpHelper postRequestBinaryWithUrl:FUSCommonURLs.fus_URL_behaviorExternalCallLog params:parm success:^(NSDictionary * _Nullable dataDict, int code) {
} failure:^(NSDictionary * _Nullable dataDict, int code) {
}];
}
/// App行为日志-加入直播间
+ (void)fus_behaviorJoinRoomLogWithReqType:(NSInteger)reqType reqEventType:(NSInteger)reqEventType extraInfo:(NSString *)extraInfo extraJson:(NSString *)extraJson roomId:(NSString *)roomId{
NSMutableDictionary *parm = [[NSMutableDictionary alloc] initWithDictionary:@{@"reqType": @(reqType),
@"extraInfo": extraInfo ?: @"",
@"extraJson": extraJson ?: @"",
@"roomId": roomId}];
if (reqEventType > 0) {
parm[@"reqEventType"] = @(reqEventType);
}
[FUSHttpHelper postRequestBinaryWithUrl:FUSCommonURLs.fus_URL_behaviorJoinRoomLog params:parm success:^(NSDictionary * _Nullable dataDict, int code) {
} failure:^(NSDictionary * _Nullable dataDict, int code) {
}];
}
@end
......@@ -40,6 +40,24 @@ typedef enum : NSUInteger {
// 环信登录失败日志上报
+ (void)fus_easeMobLoginFailWithInfo:(NSString *)logInfo;
/// App行为日志-加入直播间
/// @param reqType 加入直播间来源 1首页 2空间 3网页 4注册后自动加入 5外部调起
/// @param reqEventType 加入直播间来源子项,reqType=5的子项有3种:1系统推送进入 2直播间分享链接进入 3外部网页进入
/// @param extraInfo 有则传,额外信息,非json。存储需要可以直接展示查看的数据,比如 外部网页加入直播间 的网页URL
/// @param extraJson 有则传,json字符串。例如存储网页加入直播间的参数包、外部调起加入直播间参数包
/// @param roomId 房间id
+(void)fus_behaviorJoinRoomLogWithReqType:(NSInteger)reqType
reqEventType:(NSInteger)reqEventType
extraInfo:(NSString *)extraInfo
extraJson:(NSString *)extraJson
roomId:(NSString *)roomId;
/// App行为日志-外部调起
/// @param reqType 外部调起类型 1官网 2邀请链接 3直播间分享链接打开 4应用商店打开(appstore/googleplay) 5手机推送打开
/// @param reqEventType 外部调起来源子项,reqType=4的子项有2种:1appstore 2googleplay
/// @param reqJson json字符串,外部调起的参数包
+(void)fus_behaviorExternalCallLogWithReqType:(NSInteger)reqType reqEventType:(NSInteger)reqEventType reqJson:(NSString *)reqJson;
// 开始socket 连接
+ (void)fus_startSocketConnect;
......
......@@ -119,6 +119,15 @@
}
}
/// App行为日志-外部调起
+ (void)fus_behaviorExternalCallLogWithReqType:(NSInteger)reqType reqEventType:(NSInteger)reqEventType reqJson:(NSString *)reqJson{
[FUSCommonHttpRequest fus_behaviorExternalCallLogWithReqType:reqType reqEventType:reqEventType reqJson:reqJson];
}
/// App行为日志-加入直播间
+ (void)fus_behaviorJoinRoomLogWithReqType:(NSInteger)reqType reqEventType:(NSInteger)reqEventType extraInfo:(NSString *)extraInfo extraJson:(NSString *)extraJson roomId:(NSString *)roomId{
[FUSCommonHttpRequest fus_behaviorJoinRoomLogWithReqType:reqType reqEventType:reqEventType extraInfo:extraInfo extraJson:extraJson roomId:roomId];
}
#pragma --mark 登录计时
// 点击登录
+ (void)fus_startLoginWithLoginType:(SignType)signType {
......
......@@ -30,6 +30,7 @@
#import <FirebaseAnalytics/FirebaseAnalytics.h>
#import "FUSLivePublicDefine.h"
#import "FUSDataStatisticsManager.h"
static NSString *FUSWebRightBtnExtraInfoKey = @"FUSWebRightBtnExtraInfoKey"; //官方认证的key
......@@ -1138,6 +1139,15 @@ NSString * const kEVENT_RECHARGE_FIRST_RECHARGE_WINDOW_RECEIVE_OFFICIAL_RECAHARG
[FIRAnalytics logEventWithName:@"enterroom" parameters:@{@"source":@"other",
@"useruid":[FUSCacheDataShare shareStore].userDetailInfo.uid,
@"broadcasteruid":roomModel.roomId}];
// 2. 转换为 JSON Data
NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dataDict
options:NSJSONWritingPrettyPrinted
error:&error];
if (error == nil) {
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
[FUSDataStatisticsManager fus_behaviorJoinRoomLogWithReqType:3 reqEventType:-1 extraInfo:@"" extraJson:jsonString roomId:roomModel.roomId];
}
}
}
break;
......
......@@ -133,6 +133,12 @@ NS_ASSUME_NONNULL_BEGIN
// 设备日常统计日志 11001
+ (NSString *)fus_URL_STAT_LOG;
/// App行为日志-外部调起
+ (NSString *)fus_URL_behaviorExternalCallLog;
/// App行为日志-加入直播间
+ (NSString *)fus_URL_behaviorJoinRoomLog;
// 打开 App 发送 IDFA
+ (NSString *)fus_URL_IDFA;
......
......@@ -205,6 +205,15 @@
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/stat/log"];
}
/// App行为日志-外部调起
+ (NSString *)fus_URL_behaviorExternalCallLog{
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/stat/behavior/externalCall/log"];
}
/// App行为日志-加入直播间
+ (NSString *)fus_URL_behaviorJoinRoomLog{
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/stat/behavior/joinRoom/log"];
}
// 打开 App 发送 IDFA
+ (NSString *)fus_URL_IDFA {
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/open/open_automatic.html"];
......
......@@ -169,7 +169,7 @@ static NSString *const kGtAppSecret = @"OSSSWqbWY0ACJiUv4AHdW7";
// iOS 10: 点击通知进入App时触发,在该方法内统计有效用户点击数
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler {
[self handleNotificationEventWithContent:response.notification.request.content.userInfo];
[self handleNotificationEventWithContent:response.notification.request.content.userInfo notificontent:response.notification.request.content];
[self fus_handleChatLocalAPNsNotification:response];
// [ GTSdk ]:将收到的APNs信息传给个推统计
[GeTuiSdk handleRemoteNotification:response.notification.request.content.userInfo];
......@@ -195,13 +195,16 @@ static NSString *const kGtAppSecret = @"OSSSWqbWY0ACJiUv4AHdW7";
#endif
- (void)handleNotificationEventWithContent:(NSDictionary *)content {
- (void)handleNotificationEventWithContent:(NSDictionary *)content notificontent:(UNNotificationContent *)notificontent{
// 个推
NSDictionary *transmissionContent = [content[@"transmissionContent"] converToDictionary];
__block BOOL isChatNotification = NO;
NSString *fromUid = content[@"f"];
if ([NSString isNullWithString:fromUid] == NO) {
isChatNotification = YES;
NSDictionary *ext = content[@"e"];
// 安卓有可能传的是String过来
if ([NSDictionary isNull:ext]) {
......@@ -228,13 +231,42 @@ static NSString *const kGtAppSecret = @"OSSSWqbWY0ACJiUv4AHdW7";
if ([NSDictionary isNull:transmissionContent] == NO) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (FUSCacheDataShare.shareStore.userDetailInfo.uid) {
[self startJumpIntoPage:transmissionContent];
// 准备上报的材料
NSMutableDictionary *reqDataJSON = [[NSMutableDictionary alloc] initWithDictionary:[transmissionContent copy]];
reqDataJSON[@"data"][@"title"] = notificontent.title;
if ([reqDataJSON[@"data"][@"text"] stringValue].length <= 0) {
reqDataJSON[@"data"][@"text"] = notificontent.body;
}
if (isChatNotification == NO) {
// 个推打开的,增加一个media
NSArray *grinfo = content[@"_grinfo_"];
if (grinfo != nil && [grinfo isKindOfClass:[NSArray class]] && [grinfo count] > 0) {
NSDictionary *grinfoFirst = [grinfo firstObject];
NSString *grinfoUrl = [grinfoFirst[@"url"] stringValue];
reqDataJSON[@"data"][@"media"] = grinfoUrl;
}
}
// 2. 转换为 JSON Data
NSError *jsonError;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:reqDataJSON
options:NSJSONWritingPrettyPrinted
error:&jsonError];
NSString *jsonString = @"";
if (jsonError == nil) {
jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
}
[self startJumpIntoPage:transmissionContent logExtraJson:jsonString];
}
});
}
}
- (void)startJumpIntoPage:(NSDictionary *)content {
- (void)startJumpIntoPage:(NSDictionary *)content logExtraJson:(NSString *)logExtraJson{
// 如果还没登录的话,不需要做跳转操作
if (FUSCacheDataShare.shareStore.userDetailInfo.uid == nil) {
return;
......@@ -276,6 +308,7 @@ static NSString *const kGtAppSecret = @"OSSSWqbWY0ACJiUv4AHdW7";
case 1: // 进入直播间
[FUSRouter.liveRouter fus_enterLiveRoom:userId];
[FUSDataStatisticsManager fus_behaviorJoinRoomLogWithReqType:5 reqEventType:1 extraInfo:@"" extraJson:logExtraJson roomId:userId];
break;
case 2: // 进入任务中心
case 4: // 进入动态内容详情页
......
......@@ -952,6 +952,8 @@
// [FUSRoomChatHelper enterRoomWithRoomId:roomid animated:YES completion:^{
//
// }];
[[FUSRouter liveRouter] fus_enterLiveRoom:roomid];
[FUSDataStatisticsManager fus_behaviorJoinRoomLogWithReqType:8 reqEventType:-1 extraInfo:@"" extraJson:@"" roomId:roomid];
}
// 点击取消拉黑
......
......@@ -191,6 +191,7 @@
}
[FUSLiveHelper fus_playLiveWithRoomInfoModel:model success:nil failure:nil];
[FUSDataStatisticsManager fus_behaviorJoinRoomLogWithReqType:1 reqEventType:-1 extraInfo:@"" extraJson:@"" roomId:anchor.roomId];
}
}
......
......@@ -182,14 +182,17 @@
NSRange nickRange = [message rangeOfString:self.currentModel.toNickName];
NSMutableAttributedString *messageAtt = [[NSMutableAttributedString alloc] initWithString:message attributes:@{NSForegroundColorAttributeName:[UIColor fus_textColorRich]}];
[messageAtt addAttribute:NSForegroundColorAttributeName value:[UIColor fus_appMainColor] range:nickRange];
MJWeakSelf
[FUSAlertView showAlertWithAttributeTitle:nil attributeMessage:messageAtt cancelButtonTitle:[NSString fus_localString:@"取消"] otherButtonTitles:@[[NSString fus_localString:@"确认"]] sureHandler:^(NSInteger buttonIndex) {
if (buttonIndex == 1) {
// switchRoomWithRoomInfoModel 切换房间后会吊销当前的弹窗,所以外部参数会消失,当前域先拿一个临时参数
FUSBulletModel *currentModel = weakSelf.currentModel;
FUSRoomInfoModel *roomModel = [[FUSRoomInfoModel alloc]init];
roomModel.roomId = self.currentModel.toUid;
roomModel.face = self.currentModel.toFace;
[[FUSLiveHelper shareInstance] fus_switchRoomWithRoomInfoModel:roomModel success:nil failure:nil];
[FUSLiveHttpHelper fus_requestJumpToRoomStatFlowDataWithToRoomId:self.currentModel.toUid key:self.currentModel.keyId keySort:self.currentModel.keySort source:1 success:nil failure:nil];
[FUSLiveHttpHelper fus_requestJumpToRoomStatFlowDataWithToRoomId:currentModel.toUid key:currentModel.keyId keySort:currentModel.keySort source:1 success:nil failure:nil];
[FUSDataStatisticsManager fus_behaviorJoinRoomLogWithReqType:7 reqEventType:[currentModel.msgType.description isEqualToString:@"1"] ? 2 : 1 extraInfo:@"" extraJson:@"" roomId:roomModel.roomId];
}
} cancelHandler:nil];
......
......@@ -131,14 +131,17 @@
NSRange nickRange = [message rangeOfString:self.currentModel.toNickName];
NSMutableAttributedString *messageAtt = [[NSMutableAttributedString alloc] initWithString:message attributes:@{NSForegroundColorAttributeName:[UIColor fus_textColorRich]}];
[messageAtt addAttribute:NSForegroundColorAttributeName value:[UIColor fus_appMainColor] range:nickRange];
MJWeakSelf
[FUSAlertView showAlertWithAttributeTitle:nil attributeMessage:messageAtt cancelButtonTitle:[NSString fus_localString:@"取消"] otherButtonTitles:@[[NSString fus_localString:@"确认"]] sureHandler:^(NSInteger buttonIndex) {
if (buttonIndex == 1) {
// switchRoomWithRoomInfoModel 切换房间后会吊销当前的弹窗,所以外部参数会消失,当前域先拿一个临时参数
FUSBulletModel *currentModel = weakSelf.currentModel;
FUSRoomInfoModel *roomModel = [[FUSRoomInfoModel alloc]init];
roomModel.roomId = self.currentModel.toUid;
roomModel.face = self.currentModel.toFace;
[[FUSLiveHelper shareInstance] fus_switchRoomWithRoomInfoModel:roomModel success:nil failure:nil];
[FUSLiveHttpHelper fus_requestJumpToRoomStatFlowDataWithToRoomId:self.currentModel.toUid key:self.currentModel.keyId keySort:self.currentModel.keySort source:1 success:nil failure:nil];
[FUSLiveHttpHelper fus_requestJumpToRoomStatFlowDataWithToRoomId:currentModel.toUid key:currentModel.keyId keySort:currentModel.keySort source:1 success:nil failure:nil];
[FUSDataStatisticsManager fus_behaviorJoinRoomLogWithReqType:7 reqEventType:[currentModel.msgType.description isEqualToString:@"1"] ? 2 : 1 extraInfo:@"" extraJson:@"" roomId:roomModel.roomId];
}
} cancelHandler:nil];
......
......@@ -131,14 +131,17 @@
NSRange nickRange = [message rangeOfString:self.currentModel.toNickName];
NSMutableAttributedString *messageAtt = [[NSMutableAttributedString alloc] initWithString:message attributes:@{NSForegroundColorAttributeName:[UIColor fus_textColorRich]}];
[messageAtt addAttribute:NSForegroundColorAttributeName value:[UIColor fus_appMainColor] range:nickRange];
MJWeakSelf
[FUSAlertView showAlertWithAttributeTitle:nil attributeMessage:messageAtt cancelButtonTitle:[NSString fus_localString:@"取消"] otherButtonTitles:@[[NSString fus_localString:@"确认"]] sureHandler:^(NSInteger buttonIndex) {
if (buttonIndex == 1) {
// switchRoomWithRoomInfoModel 切换房间后会吊销当前的弹窗,所以外部参数会消失,当前域先拿一个临时参数
FUSBulletModel *currentModel = weakSelf.currentModel;
FUSRoomInfoModel *roomModel = [[FUSRoomInfoModel alloc]init];
roomModel.roomId = self.currentModel.toUid;
roomModel.face = self.currentModel.toFace;
[[FUSLiveHelper shareInstance] fus_switchRoomWithRoomInfoModel:roomModel success:nil failure:nil];
[FUSLiveHttpHelper fus_requestJumpToRoomStatFlowDataWithToRoomId:self.currentModel.toUid key:self.currentModel.keyId keySort:self.currentModel.keySort source:1 success:nil failure:nil];
[FUSLiveHttpHelper fus_requestJumpToRoomStatFlowDataWithToRoomId:currentModel.toUid key:currentModel.keyId keySort:currentModel.keySort source:1 success:nil failure:nil];
[FUSDataStatisticsManager fus_behaviorJoinRoomLogWithReqType:7 reqEventType:[currentModel.msgType.description isEqualToString:@"1"] ? 2 : 1 extraInfo:@"" extraJson:@"" roomId:roomModel.roomId];
}
} cancelHandler:nil];
......
......@@ -908,6 +908,7 @@ UIGestureRecognizerDelegate
roomModel.face = model.toFace;
[[FUSLiveHelper shareInstance] fus_switchRoomWithRoomInfoModel:roomModel success:nil failure:nil];
[FUSLiveHttpHelper fus_requestJumpToRoomStatFlowDataWithToRoomId:model.toUid key:model.keyId keySort:model.keySort source:2 success:nil failure:nil];
[FUSDataStatisticsManager fus_behaviorJoinRoomLogWithReqType:7 reqEventType:[model.msgType.description isEqualToString:@"1"] ? 2 : 1 extraInfo:@"" extraJson:@"" roomId:roomModel.roomId];
}
} cancelHandler:nil];
......@@ -1192,6 +1193,7 @@ UIGestureRecognizerDelegate
roomModel.face = model.toFace;
[[FUSLiveHelper shareInstance] fus_switchRoomWithRoomInfoModel:roomModel success:nil failure:nil];
[FUSLiveHttpHelper fus_requestJumpToRoomStatFlowDataWithToRoomId:model.toUid key:model.keyId keySort:model.keySort source:2 success:nil failure:nil];
[FUSDataStatisticsManager fus_behaviorJoinRoomLogWithReqType:7 reqEventType:[model.msgType.description isEqualToString:@"1"] ? 2 : 1 extraInfo:@"" extraJson:@"" roomId:roomModel.roomId];
}
} cancelHandler:nil];
......
......@@ -202,7 +202,20 @@ public class FUSInviteRewardController: FUSBaseViewController {
}).disposed(by: disposeBag)
self.fus_addRightNavigationButton(with: [moreBtn])
let scanBtn = UIButton(type: .custom)
scanBtn.setImage(FUSInviteRewardMoreMenuType.bindEmissary.fus_getIconImage(), for: .normal)
scanBtn.rx.tap.subscribe(onNext: {
FUSRouter.userRouter().fus_showBindAgentPage(withNeedShowSkipBtn: false) {
FUSRouter.userRouter().fus_showBindAgentSuccessPopView {
}
}
})
.disposed(by: disposeBag)
if FUSCacheDataShare.shareStore().settingInitDataModel.showQrCodeEntrance == 1 {
self.fus_addRightNavigationButton(with: [scanBtn])
}
}
func makeUI() {
......
......@@ -587,6 +587,7 @@
[FIRAnalytics logEventWithName:@"enterroom" parameters:@{@"source":@"homepage",
@"useruid":[FUSCacheDataShare shareStore].userDetailInfo.uid,
@"broadcasteruid":roomInfoModel.roomId}];
[FUSDataStatisticsManager fus_behaviorJoinRoomLogWithReqType:2 reqEventType:-1 extraInfo:@"" extraJson:@"" roomId:roomInfoModel.roomId];
}
}
......
......@@ -485,6 +485,8 @@ static NSString *const reuseIdentifyCell = @"cell";
@"useruid":[FUSCacheDataShare shareStore].userDetailInfo.uid,
@"broadcasteruid":roomModel.roomId}];
[FUSDataStatisticsManager fus_behaviorJoinRoomLogWithReqType:6 reqEventType:-1 extraInfo:@"" extraJson:@"" roomId:roomModel.roomId];
} failure:^(NSString *msg, int code) {
[FUSDialogView fus_showDialog:msg];
}];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment