添加埋点

This commit is contained in:
2026-01-06 19:25:34 +08:00
parent 1096f24c57
commit c3909d63da
30 changed files with 784 additions and 39 deletions

View File

@@ -6,7 +6,7 @@
#import <Foundation/Foundation.h>
#ifndef KB_MAI_POINT_BASE_URL
#define KB_MAI_POINT_BASE_URL @"http://192.168.2.188:35310/api"
#define KB_MAI_POINT_BASE_URL @"http://192.168.2.21:35310/api"
#endif
#ifndef KB_MAI_POINT_PATH_NEW_ACCOUNT
@@ -20,6 +20,8 @@
NS_ASSUME_NONNULL_BEGIN
extern NSString * const KBMaiPointErrorDomain;
extern NSString * const KBMaiPointEventTypePageExposure;
extern NSString * const KBMaiPointEventTypeClick;
typedef void (^KBMaiPointReportCompletion)(BOOL success, NSError * _Nullable error);
@@ -39,6 +41,28 @@ typedef NS_ENUM(NSInteger, KBMaiPointGenericReportType) {
+ (instancetype)sharedReporter;
/// 统一埋点POST /genericData
/// - eventType: 建议取值 `page_exposure` / `click`
/// - eventName: 统一事件名(如 enter_xxx / click_xxx
/// - value: 事件参数字典(内部会自动注入 token无 token 时为 @""
- (void)reportEventType:(NSString *)eventType
eventName:(NSString *)eventName
value:(nullable NSDictionary *)value
completion:(KBMaiPointReportCompletion _Nullable)completion;
/// 页面曝光快捷方法:内部会补齐 page_id
- (void)reportPageExposureWithEventName:(NSString *)eventName
pageId:(NSString *)pageId
extra:(nullable NSDictionary *)extra
completion:(KBMaiPointReportCompletion _Nullable)completion;
/// 点击快捷方法:内部会补齐 page_id / element_id
- (void)reportClickWithEventName:(NSString *)eventName
pageId:(NSString *)pageId
elementId:(NSString *)elementId
extra:(nullable NSDictionary *)extra
completion:(KBMaiPointReportCompletion _Nullable)completion;
/// POST /newAccount with type + account.
- (void)reportNewAccountWithType:(NSString *)type
account:(nullable NSString *)account