xugenyuan

ref |> 增加直播预约更多列表页面的埋点事件

Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
@@ -14,6 +14,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter' @@ -14,6 +14,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter'
14 import { LazyDataSource } from 'wdKit/Index'; 14 import { LazyDataSource } from 'wdKit/Index';
15 import LoadMoreLayout from '../page/LoadMoreLayout' 15 import LoadMoreLayout from '../page/LoadMoreLayout'
16 import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; 16 import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
  17 +import { TrackConstants, Tracking, TrackingContent, TrackingPageBrowse, TrackParamConvert } from 'wdTracking/Index';
17 18
18 const TAG: string = 'ReserveMorePage'; 19 const TAG: string = 'ReserveMorePage';
19 20
@@ -47,6 +48,9 @@ struct ReserveMorePage { @@ -47,6 +48,9 @@ struct ReserveMorePage {
47 @State private liveId: string = '' 48 @State private liveId: string = ''
48 @State isLoadingAttention: boolean = false 49 @State isLoadingAttention: boolean = false
49 @State loadImg: boolean = false; 50 @State loadImg: boolean = false;
  51 + private pageId: string = TrackConstants.PageName.Live_Appointment_List
  52 + private pageName: string = TrackConstants.PageName.Live_Appointment_List
  53 + private pageShowStartTime: number = 0
50 54
51 build() { 55 build() {
52 Column() { 56 Column() {
@@ -249,8 +253,24 @@ struct ReserveMorePage { @@ -249,8 +253,24 @@ struct ReserveMorePage {
249 top: index == 0 ? '12vp' : '8vp' 253 top: index == 0 ? '12vp' : '8vp'
250 }) 254 })
251 .onClick(() => { 255 .onClick(() => {
  256 +
  257 + // 内容点击埋点
  258 + TrackingContent.common(TrackConstants.EventType.Click,
  259 + item.pageId,
  260 + item.pageId,
  261 + TrackParamConvert.program(item))
  262 +
252 ProcessUtils.processPage(item) 263 ProcessUtils.processPage(item)
253 }) 264 })
  265 + .onVisibleAreaChange([0, 1], (isVisiable: boolean, ratio: number) => {
  266 + if (isVisiable) {
  267 + // 内容曝光埋点
  268 + TrackingContent.common(TrackConstants.EventType.Show,
  269 + item.pageId,
  270 + item.pageId,
  271 + TrackParamConvert.program(item))
  272 + }
  273 + })
254 } 274 }
255 275
256 /*导航栏*/ 276 /*导航栏*/
@@ -358,12 +378,18 @@ struct ReserveMorePage { @@ -358,12 +378,18 @@ struct ReserveMorePage {
358 } 378 }
359 379
360 onPageShow(): void { 380 onPageShow(): void {
  381 + this.pageShowStartTime = Date.now()
361 if (this.isShow) { 382 if (this.isShow) {
362 this.data.reloadData() 383 this.data.reloadData()
363 this.isShow = false 384 this.isShow = false
364 } 385 }
365 } 386 }
366 387
  388 + onPageHide(): void {
  389 + const duration = Date.now() - this.pageShowStartTime
  390 + TrackingPageBrowse.trackCommonPageExposureEnd(this.pageId, this.pageName, duration)
  391 + }
  392 +
367 private async getData(resolve?: (value: string | PromiseLike<string>) => void) { 393 private async getData(resolve?: (value: string | PromiseLike<string>) => void) {
368 if (this.isLoading) { 394 if (this.isLoading) {
369 if (resolve) { 395 if (resolve) {
@@ -386,6 +412,8 @@ struct ReserveMorePage { @@ -386,6 +412,8 @@ struct ReserveMorePage {
386 this.reserveList = [] 412 this.reserveList = []
387 this.reservedIds = [] 413 this.reservedIds = []
388 } 414 }
  415 +
  416 + liveReviewDTO.list.forEach((content) => { content.pageId = this.pageId })
389 this.data.push(...liveReviewDTO.list) 417 this.data.push(...liveReviewDTO.list)
390 //批量查询关注状态 418 //批量查询关注状态
391 this.getAppointmentInfo(liveReviewDTO.list) 419 this.getAppointmentInfo(liveReviewDTO.list)
@@ -488,6 +516,11 @@ struct ReserveMorePage { @@ -488,6 +516,11 @@ struct ReserveMorePage {
488 this.isLoadingAttention = true 516 this.isLoadingAttention = true
489 this.liveId = reserveItem.liveId.toString() 517 this.liveId = reserveItem.liveId.toString()
490 try { 518 try {
  519 +
  520 + // 埋点
  521 + Tracking.event(!reserveItem.subscribe ? "live_subscribe_click":"cancel_live_subscribe_click",
  522 + TrackParamConvert.program(item))
  523 +
491 const res = await LiveModel.liveAppointment(reserveItem.relationId, reserveItem.liveId.toString(), 524 const res = await LiveModel.liveAppointment(reserveItem.relationId, reserveItem.liveId.toString(),
492 !reserveItem.subscribe); 525 !reserveItem.subscribe);
493 if (res.code == 0) { 526 if (res.code == 0) {
@@ -135,6 +135,9 @@ export namespace TrackConstants { @@ -135,6 +135,9 @@ export namespace TrackConstants {
135 /// 我的预约 135 /// 我的预约
136 My_Saved_Live = "mySavedLivePage", 136 My_Saved_Live = "mySavedLivePage",
137 137
  138 + /// 直播预约更多列表
  139 + Live_Appointment_List = "liveSubscribeListPage",
  140 +
138 /// 兴趣选择 141 /// 兴趣选择
139 Preference_Selection = "preferenceSelectionPage", 142 Preference_Selection = "preferenceSelectionPage",
140 /// 升级页面 143 /// 升级页面
1 import { CompInfoBean, ContentDetailDTO, ContentDTO, PageInfoBean, PageInfoDTO } from 'wdBean/Index'; 1 import { CompInfoBean, ContentDetailDTO, ContentDTO, PageInfoBean, PageInfoDTO } from 'wdBean/Index';
  2 +import { StringUtils } from 'wdKit/Index';
2 import { ParamType } from './PublicParams'; 3 import { ParamType } from './PublicParams';
3 import { TrackConstants } from './TrackConstants'; 4 import { TrackConstants } from './TrackConstants';
4 import { TrackingUtils } from './TrackingUtils'; 5 import { TrackingUtils } from './TrackingUtils';
@@ -22,17 +23,40 @@ export class TrackParamConvert { @@ -22,17 +23,40 @@ export class TrackParamConvert {
22 23
23 static pageCompProgram(pageInfo?: PageInfoDTO, comp?: CompInfoBean, program?: ContentDTO) : ParamType { 24 static pageCompProgram(pageInfo?: PageInfoDTO, comp?: CompInfoBean, program?: ContentDTO) : ParamType {
24 let params = TrackingUtils.generateParams() 25 let params = TrackingUtils.generateParams()
  26 +
  27 + //TODO: 转换参数
  28 + if (pageInfo) {
  29 + params["pageName"] = pageInfo.name
  30 + params["pageId"] = pageInfo.id + ''
  31 + TrackParamConvert.appendRecommendPageInfo(pageInfo, params)
  32 + }
  33 +
25 if (program) { 34 if (program) {
  35 +
26 params["contentType"] = program.objectType 36 params["contentType"] = program.objectType
27 params["contentId"] = program.objectId 37 params["contentId"] = program.objectId
28 params["contentName"] = program.newsTitle 38 params["contentName"] = program.newsTitle
29 params["channelSourceId"] = program.channelId 39 params["channelSourceId"] = program.channelId
30 params["rmhPlatform"] = program.rmhPlatform 40 params["rmhPlatform"] = program.rmhPlatform
31 41
32 - TrackParamConvert.appendRecommend(program, params)  
33 - }  
34 - //TODO: 转换参数 42 + if (program.liveInfo) {
  43 + params["liveType"] = program.liveInfo.liveState
  44 + params["liveStreamType"] = ((program.liveInfo.vrType + '') == "1") ? "2" : "1"
  45 + params["vliveId"] = program.objectId
  46 + params["vliveName"] = program.newsTitle
  47 + }
  48 +
  49 + if (!StringUtils.isEmpty(program.linkUrl)) {
  50 + params["linkUrl"] = program.linkUrl
  51 + }
  52 +
  53 + if (program.rmhInfo && program.rmhInfo.rmhId) {
  54 + params["saAuthorId"] = program.rmhInfo.rmhId || ""
  55 + params["saAuthorName"] = program.rmhInfo.rmhName || ""
  56 + }
35 57
  58 + TrackParamConvert.appendRecommendProgram(program, params)
  59 + }
36 return params 60 return params
37 } 61 }
38 62
@@ -79,10 +103,68 @@ export class TrackParamConvert { @@ -79,10 +103,68 @@ export class TrackParamConvert {
79 return param 103 return param
80 } 104 }
81 105
82 - private static appendRecommend(detail: object, to: ParamType) {  
83 - 106 + private static appendRecommend(detail: ContentDetailDTO, to: ParamType) {
84 //TODO: ContentDetailDTO 增加推荐字段 107 //TODO: ContentDetailDTO 增加推荐字段
85 108
  109 + to["sceneId"] = !StringUtils.isEmpty(detail.sceneId) ? detail.sceneId : "9999"
  110 + to["subSceneId"] = !StringUtils.isEmpty(detail.subSceneId) ? detail.subSceneId : ""
  111 + //to["cnsTraceId"] = !StringUtils.isEmpty(detail.cnsTraceId) ? detail.cnsTraceId : "selfHold"
  112 + to["cnsTraceId"] = "selfHold"
  113 + to["itemId"] = !StringUtils.isEmpty(detail.itemId) ? detail.itemId : ""
  114 + // to["expIds"] = !StringUtils.isEmpty(detail.expIds) ? detail.expIds : ""
  115 + to["expIds"] = ""
  116 +
  117 + /// 这里填写默认值,后续在分享处 再重写
  118 + to["shareChannel"] = ""
  119 + /// 这里填写默认值,后续在action=browse时,再重写
  120 + to["duration"] = 0
  121 + }
  122 +
  123 + private static appendRecommendProgram(program: ContentDTO, to: ParamType) {
  124 +
  125 + to["sceneId"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : "9999"
  126 + to["subSceneId"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : ""
  127 + to["cnsTraceId"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : "selfHold"
  128 + to["itemId"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : ""
  129 + to["expIds"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : ""
  130 +
  131 + /// 这里填写默认值,后续在分享处 再重写
  132 + to["shareChannel"] = ""
  133 + /// 这里填写默认值,后续在action=browse时,再重写
  134 + to["duration"] = 0
  135 + }
  136 +
  137 + private static appendRecommendCompInfo(program: CompInfoBean, to: ParamType) {
  138 +
  139 + // TODO:
  140 + // to["sceneId"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : "9999"
  141 + // to["subSceneId"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : ""
  142 + // to["cnsTraceId"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : "selfHold"
  143 + // to["itemId"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : ""
  144 + // to["expIds"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : ""
  145 +
  146 + /// 这里填写默认值,后续在分享处 再重写
  147 + to["shareChannel"] = ""
  148 + /// 这里填写默认值,后续在action=browse时,再重写
  149 + to["duration"] = 0
  150 + }
  151 +
  152 + private static appendRecommendPageInfo(program: PageInfoDTO, to: ParamType) {
  153 +
  154 + // TODO:
  155 + // to["sceneId"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : "9999"
  156 + // to["subSceneId"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : ""
  157 + // to["cnsTraceId"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : "selfHold"
  158 + // to["itemId"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : ""
  159 + // to["expIds"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : ""
  160 +
  161 + /// 这里填写默认值,后续在分享处 再重写
  162 + to["shareChannel"] = ""
  163 + /// 这里填写默认值,后续在action=browse时,再重写
  164 + to["duration"] = 0
  165 + }
  166 +
  167 + private static appendRecommendPageInfoBean(program: PageInfoBean, to: ParamType) {
86 to["sceneId"] = "9999" 168 to["sceneId"] = "9999"
87 to["subSceneId"] = "" 169 to["subSceneId"] = ""
88 to["cnsTraceId"] = "selfHold" 170 to["cnsTraceId"] = "selfHold"
@@ -95,6 +177,13 @@ export class TrackParamConvert { @@ -95,6 +177,13 @@ export class TrackParamConvert {
95 to["duration"] = 0 177 to["duration"] = 0
96 } 178 }
97 179
  180 + // 'sceneId': contentDTO.sceneId,
  181 + // 'subSceneId': contentDTO.subSceneId,
  182 + // 'cnsTraceId': contentDTO.cnsTraceId,
  183 + // 'cardItemId': compDTO.cardItemId,
  184 + // 'itemId': compDTO.itemId || contentDTO.itemId,
  185 + // 'expIds': compDTO.expIds || contentDTO.expIds
  186 +
98 187
99 ///早晚报 专题 188 ///早晚报 专题
100 static pageInfoBean_ParamType(pageInfo: PageInfoBean) : ParamType { 189 static pageInfoBean_ParamType(pageInfo: PageInfoBean) : ParamType {
@@ -128,7 +217,8 @@ export class TrackParamConvert { @@ -128,7 +217,8 @@ export class TrackParamConvert {
128 "channelSourceId": pageInfo.name, 217 "channelSourceId": pageInfo.name,
129 "pageId": 'summaryDetailPage', 218 "pageId": 'summaryDetailPage',
130 } 219 }
131 - TrackParamConvert.appendRecommend(pageInfo, param) 220 +
  221 + TrackParamConvert.appendRecommendPageInfoBean(pageInfo, param)
132 222
133 return param 223 return param
134 } 224 }