Showing
5 changed files
with
100 additions
and
2 deletions
| @@ -10,6 +10,7 @@ import { | @@ -10,6 +10,7 @@ import { | ||
| 10 | postExecuteLikeParams, | 10 | postExecuteLikeParams, |
| 11 | batchLikeAndCollectParams, | 11 | batchLikeAndCollectParams, |
| 12 | } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; | 12 | } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; |
| 13 | +import { ParamType, TrackConstants, TrackingButton, TrackingContent } from 'wdTracking/Index'; | ||
| 13 | 14 | ||
| 14 | const TAG = 'LikeComponent'; | 15 | const TAG = 'LikeComponent'; |
| 15 | 16 | ||
| @@ -30,6 +31,8 @@ export struct LikeComponent { | @@ -30,6 +31,8 @@ export struct LikeComponent { | ||
| 30 | componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口 | 31 | componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口 |
| 31 | styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) 3 透明背景 | 32 | styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) 3 透明背景 |
| 32 | @State likeCount: number = 0 //点赞数 | 33 | @State likeCount: number = 0 //点赞数 |
| 34 | + pageParam: ParamType = {} | ||
| 35 | + PageName: string = '' | ||
| 33 | 36 | ||
| 34 | //上层传值 样例 | 37 | //上层传值 样例 |
| 35 | // this.data['contentId'] = '30035444649' //必须 | 38 | // this.data['contentId'] = '30035444649' //必须 |
| @@ -50,6 +53,7 @@ export struct LikeComponent { | @@ -50,6 +53,7 @@ export struct LikeComponent { | ||
| 50 | this.likesStyle = this.contentDetailData.likesStyle | 53 | this.likesStyle = this.contentDetailData.likesStyle |
| 51 | } | 54 | } |
| 52 | this.onDataUpdated() | 55 | this.onDataUpdated() |
| 56 | + this.contentTrackingDict() | ||
| 53 | } | 57 | } |
| 54 | 58 | ||
| 55 | onDataUpdated() { | 59 | onDataUpdated() { |
| @@ -64,6 +68,27 @@ export struct LikeComponent { | @@ -64,6 +68,27 @@ export struct LikeComponent { | ||
| 64 | } | 68 | } |
| 65 | } | 69 | } |
| 66 | 70 | ||
| 71 | + contentTrackingDict(){ | ||
| 72 | + this.pageParam = { | ||
| 73 | + 'contentType': `${this.contentDetailData.newsType}`, | ||
| 74 | + 'contentId': `${this.contentDetailData.newsId}`, | ||
| 75 | + 'contentName': `${this.contentDetailData.newsTitle || ''}`, | ||
| 76 | + } | ||
| 77 | + if(this.contentDetailData.newsType == 1) { | ||
| 78 | + this.PageName = TrackConstants.PageName.VideoDetail // 点播 | ||
| 79 | + } else if(this.contentDetailData.newsType == 2) { | ||
| 80 | + this.PageName = TrackConstants.PageName.Live_Detail // 直播 | ||
| 81 | + } else if(this.contentDetailData.newsType == 5) { | ||
| 82 | + this.PageName = TrackConstants.PageName.Summary_Detail // 专题详情页 | ||
| 83 | + } else if(this.contentDetailData.newsType == 8) { | ||
| 84 | + this.PageName = TrackConstants.PageName.Article_Detail // 图文详情页 | ||
| 85 | + } else if(this.contentDetailData.newsType == 9) { | ||
| 86 | + this.PageName = TrackConstants.PageName.Atlas_Detail // 图集详情页 | ||
| 87 | + } else if(this.contentDetailData.newsType == 14 || this.contentDetailData.newsType == 15) { | ||
| 88 | + this.PageName = TrackConstants.PageName.DynamicDetail // 动态图文/动态视频 | ||
| 89 | + } | ||
| 90 | + } | ||
| 91 | + | ||
| 67 | build() { | 92 | build() { |
| 68 | 93 | ||
| 69 | if (this.componentType == 2) { | 94 | if (this.componentType == 2) { |
| @@ -346,13 +371,16 @@ export struct LikeComponent { | @@ -346,13 +371,16 @@ export struct LikeComponent { | ||
| 346 | if (this.contentDetailData.liveInfo) { | 371 | if (this.contentDetailData.liveInfo) { |
| 347 | this.likeStatus = true | 372 | this.likeStatus = true |
| 348 | this.likeCount++ | 373 | this.likeCount++ |
| 374 | + TrackingContent.like(true,this.PageName,this.PageName,this.pageParam) | ||
| 349 | } else { | 375 | } else { |
| 350 | this.likeStatus = !this.likeStatus | 376 | this.likeStatus = !this.likeStatus |
| 351 | //点赞和取消点赞成功后更新点赞数 | 377 | //点赞和取消点赞成功后更新点赞数 |
| 352 | if (this.likeStatus) { | 378 | if (this.likeStatus) { |
| 353 | this.likeCount++ | 379 | this.likeCount++ |
| 380 | + TrackingContent.like(true,this.PageName,this.PageName,this.pageParam) | ||
| 354 | } else { | 381 | } else { |
| 355 | this.likeCount-- | 382 | this.likeCount-- |
| 383 | + TrackingContent.like(false,this.PageName,this.PageName,this.pageParam) | ||
| 356 | } | 384 | } |
| 357 | } | 385 | } |
| 358 | 386 |
| @@ -23,6 +23,7 @@ import { WDShare } from 'wdShare/Index'; | @@ -23,6 +23,7 @@ import { WDShare } from 'wdShare/Index'; | ||
| 23 | import { AudioSuspensionModel } from '../../viewmodel/AudioSuspensionModel' | 23 | import { AudioSuspensionModel } from '../../viewmodel/AudioSuspensionModel' |
| 24 | import { EmitterEventId, EmitterUtils } from 'wdKit/Index' | 24 | import { EmitterEventId, EmitterUtils } from 'wdKit/Index' |
| 25 | import { PlayerConstants } from 'wdPlayer' | 25 | import { PlayerConstants } from 'wdPlayer' |
| 26 | +import { ParamType, TrackConstants, TrackingButton, TrackingContent } from 'wdTracking/Index'; | ||
| 26 | 27 | ||
| 27 | const TAG = 'OperRowListView'; | 28 | const TAG = 'OperRowListView'; |
| 28 | 29 | ||
| @@ -91,6 +92,8 @@ export struct OperRowListView { | @@ -91,6 +92,8 @@ export struct OperRowListView { | ||
| 91 | @State currentStatus: number | string | undefined = 0; | 92 | @State currentStatus: number | string | undefined = 0; |
| 92 | @State name: string = 'audio_recommend_status_wait' | 93 | @State name: string = 'audio_recommend_status_wait' |
| 93 | @State dialogController: CustomDialogController | null = null; | 94 | @State dialogController: CustomDialogController | null = null; |
| 95 | + pageParam: ParamType = {} | ||
| 96 | + PageName: string = '' | ||
| 94 | 97 | ||
| 95 | async aboutToAppear() { | 98 | async aboutToAppear() { |
| 96 | console.info(TAG, 'this.needLike', this.needLike) | 99 | console.info(TAG, 'this.needLike', this.needLike) |
| @@ -109,6 +112,28 @@ export struct OperRowListView { | @@ -109,6 +112,28 @@ export struct OperRowListView { | ||
| 109 | } | 112 | } |
| 110 | } | 113 | } |
| 111 | }) | 114 | }) |
| 115 | + this.contentTrackingDict() | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + contentTrackingDict(){ | ||
| 119 | + this.pageParam = { | ||
| 120 | + 'contentType': `${this.contentDetailData.newsType}`, | ||
| 121 | + 'contentId': `${this.contentDetailData.newsId}`, | ||
| 122 | + 'contentName': `${this.contentDetailData.newsTitle || ''}`, | ||
| 123 | + } | ||
| 124 | + if(this.contentDetailData.newsType == 1) { | ||
| 125 | + this.PageName = TrackConstants.PageName.VideoDetail // 点播 | ||
| 126 | + } else if(this.contentDetailData.newsType == 2) { | ||
| 127 | + this.PageName = TrackConstants.PageName.Live_Detail // 直播 | ||
| 128 | + } else if(this.contentDetailData.newsType == 5) { | ||
| 129 | + this.PageName = TrackConstants.PageName.Summary_Detail // 专题详情页 | ||
| 130 | + } else if(this.contentDetailData.newsType == 8) { | ||
| 131 | + this.PageName = TrackConstants.PageName.Article_Detail // 图文详情页 | ||
| 132 | + } else if(this.contentDetailData.newsType == 9) { | ||
| 133 | + this.PageName = TrackConstants.PageName.Atlas_Detail // 图集详情页 | ||
| 134 | + } else if(this.contentDetailData.newsType == 14 || this.contentDetailData.newsType == 15) { | ||
| 135 | + this.PageName = TrackConstants.PageName.DynamicDetail // 动态图文/动态视频 | ||
| 136 | + } | ||
| 112 | } | 137 | } |
| 113 | 138 | ||
| 114 | async onDetailUpdated() { | 139 | async onDetailUpdated() { |
| @@ -440,6 +465,9 @@ export struct OperRowListView { | @@ -440,6 +465,9 @@ export struct OperRowListView { | ||
| 440 | this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 | 465 | this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 |
| 441 | if (this.newsStatusOfUser.collectStatus === 1) { | 466 | if (this.newsStatusOfUser.collectStatus === 1) { |
| 442 | promptAction.showToast({ message: '收藏成功' }) | 467 | promptAction.showToast({ message: '收藏成功' }) |
| 468 | + TrackingContent.collect(true,this.PageName,this.PageName,this.pageParam) | ||
| 469 | + } else { | ||
| 470 | + TrackingContent.collect(false,this.PageName,this.PageName,this.pageParam) | ||
| 443 | } | 471 | } |
| 444 | this.queryContentInteractCount() | 472 | this.queryContentInteractCount() |
| 445 | } | 473 | } |
| @@ -108,7 +108,19 @@ export class TrackingContent { | @@ -108,7 +108,19 @@ export class TrackingContent { | ||
| 108 | 108 | ||
| 109 | // 内容下载点击事件 1.图片 2.音频 3.视频 | 109 | // 内容下载点击事件 1.图片 2.音频 3.视频 |
| 110 | static download(donwloadContentType: number, pageId: string, pageName: string, extParams?: ParamType) { | 110 | static download(donwloadContentType: number, pageId: string, pageName: string, extParams?: ParamType) { |
| 111 | - | 111 | + let params = TrackingUtils.generateParams(extParams) |
| 112 | + if (donwloadContentType) { | ||
| 113 | + params["donwloadContentType"] = donwloadContentType | ||
| 114 | + } | ||
| 115 | + if (pageId.length) { | ||
| 116 | + params["pageId"] = pageId | ||
| 117 | + } | ||
| 118 | + if (pageName.length) { | ||
| 119 | + params["pageName"] = pageName | ||
| 120 | + } | ||
| 121 | + params["action"] =TrackConstants.ActionType.Download | ||
| 122 | + TrackingUtils.fillPositionWith(params) | ||
| 123 | + Tracking.event("download_click", params) | ||
| 112 | } | 124 | } |
| 113 | 125 | ||
| 114 | } | 126 | } |
| 1 | -import { Logger } from 'wdKit'; | 1 | +import { DateTimeUtils, NetworkUtil, StringUtils, Logger } from 'wdKit'; |
| 2 | import router from '@ohos.router'; | 2 | import router from '@ohos.router'; |
| 3 | import { Params, Action } from 'wdBean'; | 3 | import { Params, Action } from 'wdBean'; |
| 4 | import { WindowModel } from 'wdKit/Index'; | 4 | import { WindowModel } from 'wdKit/Index'; |
| 5 | import { MultiPictureDetailPageComponent } from '../view/MultiPictureDetailPageComponent'; | 5 | import { MultiPictureDetailPageComponent } from '../view/MultiPictureDetailPageComponent'; |
| 6 | +import { TrackingPageBrowse, TrackConstants, TrackingButton } from 'wdTracking/Index'; | ||
| 6 | 7 | ||
| 7 | const TAG = 'MultiPictureDetailPage'; | 8 | const TAG = 'MultiPictureDetailPage'; |
| 8 | 9 | ||
| @@ -16,6 +17,8 @@ struct MultiPictureDetailPage { | @@ -16,6 +17,8 @@ struct MultiPictureDetailPage { | ||
| 16 | @State relId: string = '' | 17 | @State relId: string = '' |
| 17 | @State contentId: string = '' | 18 | @State contentId: string = '' |
| 18 | @State relType: string = '' | 19 | @State relType: string = '' |
| 20 | + pageShowTime:number = 0; | ||
| 21 | + pageHideTime:number = 0; | ||
| 19 | 22 | ||
| 20 | build() { | 23 | build() { |
| 21 | Row() { | 24 | Row() { |
| @@ -68,12 +71,17 @@ struct MultiPictureDetailPage { | @@ -68,12 +71,17 @@ struct MultiPictureDetailPage { | ||
| 68 | 71 | ||
| 69 | onPageShow(): void { | 72 | onPageShow(): void { |
| 70 | console.log(TAG, 'onPageShow') | 73 | console.log(TAG, 'onPageShow') |
| 74 | + this.pageShowTime = DateTimeUtils.getTimeStamp() | ||
| 71 | this.openFullScreen() | 75 | this.openFullScreen() |
| 72 | 76 | ||
| 73 | } | 77 | } |
| 74 | 78 | ||
| 75 | onPageHide(): void { | 79 | onPageHide(): void { |
| 76 | console.log(TAG, 'onPageHide') | 80 | console.log(TAG, 'onPageHide') |
| 81 | + this.pageHideTime = DateTimeUtils.getTimeStamp() | ||
| 82 | + let duration = 0 | ||
| 83 | + duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000) | ||
| 84 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Atlas_Detail,TrackConstants.PageName.Atlas_Detail,duration) | ||
| 77 | this.closeFullScreen() | 85 | this.closeFullScreen() |
| 78 | } | 86 | } |
| 79 | 87 |
| @@ -23,6 +23,7 @@ import { EmptyComponent, | @@ -23,6 +23,7 @@ import { EmptyComponent, | ||
| 23 | PageRepository, | 23 | PageRepository, |
| 24 | publishCommentModel, | 24 | publishCommentModel, |
| 25 | viewBlogItemInsightIntentShare} from 'wdComponent/Index'; | 25 | viewBlogItemInsightIntentShare} from 'wdComponent/Index'; |
| 26 | +import { ParamType, TrackConstants, TrackingButton, TrackingContent } from 'wdTracking/Index'; | ||
| 26 | 27 | ||
| 27 | const TAG = 'MultiPictureDetailPageComponent'; | 28 | const TAG = 'MultiPictureDetailPageComponent'; |
| 28 | /** | 29 | /** |
| @@ -58,6 +59,9 @@ export struct MultiPictureDetailPageComponent { | @@ -58,6 +59,9 @@ export struct MultiPictureDetailPageComponent { | ||
| 58 | @State operationButtonList: string[] = ['comment', 'like', 'collect', 'share'] | 59 | @State operationButtonList: string[] = ['comment', 'like', 'collect', 'share'] |
| 59 | @State currentOffset: number = 0 | 60 | @State currentOffset: number = 0 |
| 60 | @State duration: number = 0 | 61 | @State duration: number = 0 |
| 62 | + pageParam: ParamType = {} | ||
| 63 | + followUserId: string = '' | ||
| 64 | + followUserName: string = '' | ||
| 61 | 65 | ||
| 62 | //watch监听页码回调 | 66 | //watch监听页码回调 |
| 63 | onCurrentPageNumUpdated(): void { | 67 | onCurrentPageNumUpdated(): void { |
| @@ -88,6 +92,17 @@ export struct MultiPictureDetailPageComponent { | @@ -88,6 +92,17 @@ export struct MultiPictureDetailPageComponent { | ||
| 88 | // 无网络 | 92 | // 无网络 |
| 89 | this.netStatus = 1 | 93 | this.netStatus = 1 |
| 90 | } | 94 | } |
| 95 | + this.contentTrackingDict() | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + contentTrackingDict(){ | ||
| 99 | + this.pageParam = { | ||
| 100 | + 'contentType': `${this.contentDetailData.newsType}`, | ||
| 101 | + 'contentId': `${this.contentDetailData.newsId}`, | ||
| 102 | + 'contentName': `${this.contentDetailData.newsTitle || ''}`, | ||
| 103 | + } | ||
| 104 | + this.followUserId = this.contentDetailData?.rmhInfo?.rmhId || '' | ||
| 105 | + this.followUserName = this.contentDetailData?.rmhInfo?.rmhName || '' | ||
| 91 | } | 106 | } |
| 92 | 107 | ||
| 93 | aboutToDisappear() { | 108 | aboutToDisappear() { |
| @@ -426,6 +441,11 @@ export struct MultiPictureDetailPageComponent { | @@ -426,6 +441,11 @@ export struct MultiPictureDetailPageComponent { | ||
| 426 | bottom: 24, | 441 | bottom: 24, |
| 427 | right: 18 | 442 | right: 18 |
| 428 | }) | 443 | }) |
| 444 | + .parallelGesture( | ||
| 445 | + TapGesture() | ||
| 446 | + .onAction((event: GestureEvent) => { | ||
| 447 | + TrackingContent.download(1,TrackConstants.PageName.Atlas_Detail,TrackConstants.PageName.Atlas_Detail,this.pageParam) | ||
| 448 | + })) | ||
| 429 | } | 449 | } |
| 430 | } | 450 | } |
| 431 | } | 451 | } |
| @@ -560,8 +580,10 @@ export struct MultiPictureDetailPageComponent { | @@ -560,8 +580,10 @@ export struct MultiPictureDetailPageComponent { | ||
| 560 | console.log(TAG, '关注号主==', JSON.stringify(res.data)) | 580 | console.log(TAG, '关注号主==', JSON.stringify(res.data)) |
| 561 | if (this.followStatus == '1') { | 581 | if (this.followStatus == '1') { |
| 562 | this.followStatus = '0' | 582 | this.followStatus = '0' |
| 583 | + TrackingContent.follow(true,this.followUserId,this.followUserName,TrackConstants.PageName.Atlas_Detail,TrackConstants.PageName.Atlas_Detail,this.pageParam) | ||
| 563 | } else { | 584 | } else { |
| 564 | this.followStatus = '1' | 585 | this.followStatus = '1' |
| 586 | + TrackingContent.follow(false,this.followUserId,this.followUserName,TrackConstants.PageName.Atlas_Detail,TrackConstants.PageName.Atlas_Detail,this.pageParam) | ||
| 565 | } | 587 | } |
| 566 | }) | 588 | }) |
| 567 | } | 589 | } |
-
Please register or login to post a comment