Files
yinmeng-ios/xplan-ios/Base/Tool/StatisticsService/StatisticsServiceHelper.m
2021-09-27 20:16:27 +08:00

64 lines
2.2 KiB
Objective-C

//
// StatisticsServiceHelper.m
// xplan-ios
//
// Created by 冯硕 on 2021/9/27.
//
#import "StatisticsServiceHelper.h"
#import "StatisticsService.h"
@implementation StatisticsServiceHelper
NSString *const StatisticsServiceEventAppLaunch = @"app_launch";
#pragma mark - 登录模块的
NSString *const StatisticsServiceEventOneClickLoginSuccess = @"one_click_login_succeed";
NSString *const StatisticsServiceEventLoginPhoneClick = @"login_phone_click";
NSString *const StatisticsServiceEventLoginQQClick = @"login_qq_click";///QQ登录
NSString *const StatisticsServiceEventLoginWXClick = @"login_wx_click";///wx登录
NSString *const StatisticsServiceEventLoginRepariSuccess = @"login_repari_success";///注册个人资料保存成功
/// 埋点事件
/// @param eventKey key
+ (void)trackEventWithKey:(NSString *)eventKey {
[self trackEventWithKey:eventKey eventAttributes:nil];
}
/// 埋点事件带参数
/// @param eventKey key
/// @param eventAttributes 参数
+ (void)trackEventWithKey:(NSString *)eventKey eventAttributes:(NSDictionary * _Nullable)eventAttributes {
[StatisticsService trackEvent:eventKey eventDescribe:[self getTrackEventDescripWithKey:eventKey] eventAttributes:eventAttributes];
}
/// 统计时长 开始
/// @param eventKey key
+ (void)trackEventStartWithKey:(NSString *)eventKey {
[StatisticsService trackEvent:eventKey eventStart:[self getTrackEventDescripWithKey:eventKey]];
}
/// 统计时长 结束
/// @param eventKey key
+ (void)trackEventEndWithKey:(NSString *)eventKey {
[StatisticsService trackEvent:eventKey eventEnd:[self getTrackEventDescripWithKey:eventKey]];
}
///埋点 只需要在这个里面 进行相应的配置 即可 key 和descrip
+ (NSString *)getTrackEventDescripWithKey:(NSString *)key {
NSDictionary * dic = @{
StatisticsServiceEventAppLaunch:@"应用启动",
StatisticsServiceEventOneClickLoginSuccess:@"一键登录成功",
StatisticsServiceEventLoginPhoneClick:@"手机登录",
StatisticsServiceEventLoginQQClick:@"qq登录",
StatisticsServiceEventLoginWXClick:@"微信登录",
StatisticsServiceEventLoginRepariSuccess:@"注册时候的个人资料保存成功"
};
NSString * decription = [dic objectForKey:StatisticsServiceEventAppLaunch];
return decription;
}
@end