添加埋点

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

@@ -277,7 +277,16 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
self.keyBoardMainView.hidden = show;
if (show) {
[[KBMaiPointReporter sharedReporter] reportPageExposureWithEventName:@"enter_keyboard_function_panel"
pageId:@"keyboard_function_panel"
extra:nil
completion:nil];
[self hideSubscriptionPanel];
} else {
[[KBMaiPointReporter sharedReporter] reportPageExposureWithEventName:@"enter_keyboard_main_panel"
pageId:@"keyboard_main_panel"
extra:nil
completion:nil];
}
//
@@ -291,6 +300,10 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
/// / keyBoardMainView /
- (void)showSettingView:(BOOL)show {
if (show) {
[[KBMaiPointReporter sharedReporter] reportPageExposureWithEventName:@"enter_keyboard_settings"
pageId:@"keyboard_settings"
extra:nil
completion:nil];
// if (!self.settingView) {
self.settingView = [[KBSettingView alloc] init];
self.settingView.hidden = YES;
@@ -342,6 +355,10 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
BOOL ok = [KBHostAppLauncher openHostAppURL:scheme fromResponder:self.view];
return;
}
[[KBMaiPointReporter sharedReporter] reportPageExposureWithEventName:@"enter_keyboard_subscription_panel"
pageId:@"keyboard_subscription_panel"
extra:nil
completion:nil];
[self showFunctionPanel:NO];
KBKeyboardSubscriptionView *panel = self.subscriptionView;
if (!panel.superview) {
@@ -427,6 +444,12 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
}
- (void)keyBoardMainView:(KBKeyBoardMainView *)keyBoardMainView didTapToolActionAtIndex:(NSInteger)index {
NSDictionary *extra = @{@"index": @(index)};
[[KBMaiPointReporter sharedReporter] reportClickWithEventName:@"click_keyboard_toolbar_action"
pageId:@"keyboard_main_panel"
elementId:@"toolbar_action"
extra:extra
completion:nil];
if (index == 0) {
[self showFunctionPanel:YES];
[self kb_clearCurrentWord];
@@ -436,6 +459,11 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
}
- (void)keyBoardMainViewDidTapSettings:(KBKeyBoardMainView *)keyBoardMainView {
[[KBMaiPointReporter sharedReporter] reportClickWithEventName:@"click_keyboard_settings_btn"
pageId:@"keyboard_main_panel"
elementId:@"settings_btn"
extra:nil
completion:nil];
[self showSettingView:YES];
}
@@ -448,16 +476,32 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
}
- (void)keyBoardMainViewDidTapUndo:(KBKeyBoardMainView *)keyBoardMainView {
[[KBMaiPointReporter sharedReporter] reportClickWithEventName:@"click_keyboard_undo_btn"
pageId:@"keyboard_main_panel"
elementId:@"undo_btn"
extra:nil
completion:nil];
[[KBBackspaceUndoManager shared] performUndoFromResponder:self.view];
[self kb_scheduleContextRefreshResetSuppression:YES];
}
- (void)keyBoardMainViewDidTapEmojiSearch:(KBKeyBoardMainView *)keyBoardMainView {
[[KBMaiPointReporter sharedReporter] reportClickWithEventName:@"click_keyboard_emoji_search_btn"
pageId:@"keyboard_main_panel"
elementId:@"emoji_search_btn"
extra:nil
completion:nil];
[KBHUD showInfo:KBLocalized(@"Search coming soon")];
}
- (void)keyBoardMainView:(KBKeyBoardMainView *)keyBoardMainView didSelectSuggestion:(NSString *)suggestion {
if (suggestion.length == 0) { return; }
NSDictionary *extra = @{@"suggestion_len": @(suggestion.length)};
[[KBMaiPointReporter sharedReporter] reportClickWithEventName:@"click_keyboard_suggestion_item"
pageId:@"keyboard_main_panel"
elementId:@"suggestion_item"
extra:extra
completion:nil];
[[KBBackspaceUndoManager shared] registerNonClearAction];
NSString *current = self.currentWord ?: @"";
if (current.length > 0) {
@@ -481,6 +525,11 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
}
}
- (void)functionView:(KBFunctionView *_Nullable)functionView didRightTapToolActionAtIndex:(NSInteger)index{
[[KBMaiPointReporter sharedReporter] reportClickWithEventName:@"click_keyboard_function_right_action"
pageId:@"keyboard_function_panel"
elementId:@"right_action"
extra:@{@"action": @"login_or_recharge"}
completion:nil];
if (!KBAuthManager.shared.isLoggedIn) {
NSString *schemeStr = [NSString stringWithFormat:@"%@://login?src=keyboard", KB_APP_SCHEME];
NSURL *scheme = [NSURL URLWithString:schemeStr];
@@ -510,10 +559,24 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
#pragma mark - KBKeyboardSubscriptionViewDelegate
- (void)subscriptionViewDidTapClose:(KBKeyboardSubscriptionView *)view {
[[KBMaiPointReporter sharedReporter] reportClickWithEventName:@"click_keyboard_subscription_close_btn"
pageId:@"keyboard_subscription_panel"
elementId:@"close_btn"
extra:nil
completion:nil];
[self hideSubscriptionPanel];
}
- (void)subscriptionView:(KBKeyboardSubscriptionView *)view didTapPurchaseForProduct:(KBKeyboardSubscriptionProduct *)product {
NSMutableDictionary *extra = [NSMutableDictionary dictionary];
if ([product.productId isKindOfClass:NSString.class] && product.productId.length > 0) {
extra[@"product_id"] = product.productId;
}
[[KBMaiPointReporter sharedReporter] reportClickWithEventName:@"click_keyboard_subscription_product_btn"
pageId:@"keyboard_subscription_panel"
elementId:@"product_btn"
extra:extra.copy
completion:nil];
[self hideSubscriptionPanel];
[self kb_openRechargeForProduct:product];
}
@@ -588,6 +651,11 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
}
- (void)onTapSettingsBack {
[[KBMaiPointReporter sharedReporter] reportClickWithEventName:@"click_keyboard_settings_back_btn"
pageId:@"keyboard_settings"
elementId:@"back_btn"
extra:nil
completion:nil];
[self showSettingView:NO];
}

View File

@@ -4,6 +4,7 @@
#import "KBFunctionTagListView.h"
#import "KBFunctionTagCell.h"
#import "KBMaiPointReporter.h"
static NSString * const kKBFunctionTagCellId2 = @"KBFunctionTagCellId2";
static CGFloat const kKBItemSpace = 4;
@@ -66,8 +67,23 @@ static CGFloat const kKBItemSpace = 4;
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section { return kKBItemSpace; }
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
KBTagItemModel *model = (indexPath.item < self.items.count) ? self.items[indexPath.item] : [KBTagItemModel new];
NSInteger personaId = 0;
if ([model isKindOfClass:KBTagItemModel.class]) {
personaId = model.characterId > 0 ? model.characterId : model.tagId;
}
NSMutableDictionary *extra = [NSMutableDictionary dictionary];
extra[@"index"] = @(indexPath.item);
extra[@"id"] = @(personaId);
if ([model.characterName isKindOfClass:NSString.class] && model.characterName.length > 0) {
extra[@"name"] = model.characterName;
}
[[KBMaiPointReporter sharedReporter] reportClickWithEventName:@"click_keyboard_function_tag_item"
pageId:@"keyboard_function_panel"
elementId:@"renshe_item"
extra:extra.copy
completion:nil];
if ([self.delegate respondsToSelector:@selector(tagListView:didSelectIndex:title:)]) {
KBTagItemModel *model = (indexPath.item < self.items.count) ? self.items[indexPath.item] : [KBTagItemModel new];
[self.delegate tagListView:self didSelectIndex:indexPath.item title:model.characterName];
}
}

View File

@@ -640,6 +640,7 @@ static void KBULDarwinCallback(CFNotificationCenterRef center, void *observer, C
// UL App Scheme访
// 访 KBStreamTextView
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
// KBFunctionTagListView id/name
// + 访访
if ([[KBFullAccessManager shared] hasFullAccess]) {
KBTagItemModel *selModel = self.modelArray[indexPath.item];
@@ -682,6 +683,11 @@ static void KBULDarwinCallback(CFNotificationCenterRef center, void *observer, C
#pragma mark - Button Actions
- (void)onTapPaste {
[[KBMaiPointReporter sharedReporter] reportClickWithEventName:@"click_keyboard_function_paste_btn"
pageId:@"keyboard_function_panel"
elementId:@"paste_btn"
extra:nil
completion:nil];
//
// - iOS16+ App
// - iOS15
@@ -776,6 +782,11 @@ static void KBULDarwinCallback(CFNotificationCenterRef center, void *observer, C
- (void)onTapDelete {
NSLog(@"点击:删除");
[[KBMaiPointReporter sharedReporter] reportClickWithEventName:@"click_keyboard_function_delete_btn"
pageId:@"keyboard_function_panel"
elementId:@"delete_btn"
extra:nil
completion:nil];
UIInputViewController *ivc = KBFindInputViewController(self);
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
[[KBInputBufferManager shared] refreshFromProxyIfPossible:proxy];
@@ -786,11 +797,21 @@ static void KBULDarwinCallback(CFNotificationCenterRef center, void *observer, C
}
- (void)onTapClear {
NSLog(@"点击:清空");
[[KBMaiPointReporter sharedReporter] reportClickWithEventName:@"click_keyboard_function_clear_btn"
pageId:@"keyboard_function_panel"
elementId:@"clear_btn"
extra:nil
completion:nil];
[self.backspaceHandler performClearAction];
}
- (void)onTapSend {
NSLog(@"点击:发送");
[[KBMaiPointReporter sharedReporter] reportClickWithEventName:@"click_keyboard_function_send_btn"
pageId:@"keyboard_function_panel"
elementId:@"send_btn"
extra:nil
completion:nil];
[[KBBackspaceUndoManager shared] registerNonClearAction];
// App
UIInputViewController *ivc = KBFindInputViewController(self);