wangliang_wd

feat:增加埋点

@@ -6,6 +6,8 @@ import { MessageItem } from '../../../viewmodel/MessageItem' @@ -6,6 +6,8 @@ import { MessageItem } from '../../../viewmodel/MessageItem'
6 import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh' 6 import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh'
7 import { CustomTitleUI } from '../../reusable/CustomTitleUI' 7 import { CustomTitleUI } from '../../reusable/CustomTitleUI'
8 import { MessageListItemUI } from './MessageListItemUI' 8 import { MessageListItemUI } from './MessageListItemUI'
  9 +import {TrackingButton,TrackConstants}from 'wdTracking/Index'
  10 +import TrackingPageBrowseUtils from '../../../utils/TrackingPageBrowseUtils'
9 11
10 const TAG = "MessageListUI" 12 const TAG = "MessageListUI"
11 13
@@ -185,6 +187,7 @@ export struct MessageListUI { @@ -185,6 +187,7 @@ export struct MessageListUI {
185 } 187 }
186 .padding({ left: "31lpx", right: "31lpx" }) 188 .padding({ left: "31lpx", right: "31lpx" })
187 .onClick(() => { 189 .onClick(() => {
  190 + this.messageCenterCommonButtonTracking(index)
188 switch (index) { 191 switch (index) {
189 case 0: //互动消息 192 case 0: //互动消息
190 if(item.unReadCount > 0){ 193 if(item.unReadCount > 0){
@@ -210,6 +213,25 @@ export struct MessageListUI { @@ -210,6 +213,25 @@ export struct MessageListUI {
210 } 213 }
211 } 214 }
212 215
  216 + messageCenterCommonButtonTracking(index:number){
  217 + let buttonName:string = ''
  218 + switch (index) {
  219 + case 0: //互动消息
  220 + buttonName = 'myNotificationPageInteractiveMessage'
  221 + break;
  222 + case 1: //预约消息
  223 + buttonName = 'myNotificationPageAppointmentMessage'
  224 + break;
  225 + case 2: //历史推送
  226 + buttonName = 'myNotificationPageHistoricalPush'
  227 + break;
  228 + case 3: //系统消息
  229 + buttonName = 'myNotificationPageSystemMessage'
  230 + break;
  231 + }
  232 +
  233 + TrackingButton.click(buttonName,TrackConstants.PageName.My_Notification,TrackConstants.PageName.My_Notification)
  234 + }
213 235
214 sendEnterEvent(type:number){ 236 sendEnterEvent(type:number){
215 MinePageDatasModel.sendEnterMessageData(type).then((value) => { 237 MinePageDatasModel.sendEnterMessageData(type).then((value) => {
@@ -6,6 +6,8 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter'; @@ -6,6 +6,8 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter';
6 import {AreaPickerDialog} from '../view/areaPickerDialog/AreaPickerDialog' 6 import {AreaPickerDialog} from '../view/areaPickerDialog/AreaPickerDialog'
7 import { AreaListModel } from '../../model/AreaListModel'; 7 import { AreaListModel } from '../../model/AreaListModel';
8 import router from '@ohos.router'; 8 import router from '@ohos.router';
  9 +import TrackingPageBrowseUtils from '../../utils/TrackingPageBrowseUtils'
  10 +import { TrackConstants } from 'wdTracking/Index';
9 11
10 @Entry 12 @Entry
11 @Component 13 @Component
@@ -37,6 +39,11 @@ struct EditUserInfoPage { @@ -37,6 +39,11 @@ struct EditUserInfoPage {
37 39
38 onPageShow(){ 40 onPageShow(){
39 this.updateUserNameAndIntroduction() 41 this.updateUserNameAndIntroduction()
  42 + TrackingPageBrowseUtils.TrackingPageBrowseExposureStart()
  43 + }
  44 +
  45 + onPageHide(): void {
  46 + TrackingPageBrowseUtils.TrackingPageBrowseExposureEnd(TrackConstants.PageName.Edit_Information,TrackConstants.PageName.Edit_Information)
40 } 47 }
41 48
42 build() { 49 build() {
@@ -13,6 +13,8 @@ import { contentListItemParams } from '../../model/MyCollectionModel'; @@ -13,6 +13,8 @@ import { contentListItemParams } from '../../model/MyCollectionModel';
13 import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; 13 import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
14 import { MyCustomDialog } from '../reusable/MyCustomDialog' 14 import { MyCustomDialog } from '../reusable/MyCustomDialog'
15 import { NetworkUtil } from 'wdKit/Index'; 15 import { NetworkUtil } from 'wdKit/Index';
  16 +import TrackingPageBrowseUtils from '../../utils/TrackingPageBrowseUtils'
  17 +import { TrackConstants } from 'wdTracking/Index';
16 18
17 @Entry 19 @Entry
18 @Component 20 @Component
@@ -45,6 +47,15 @@ struct MyCollectionListPage { @@ -45,6 +47,15 @@ struct MyCollectionListPage {
45 47
46 aboutToAppear(){ 48 aboutToAppear(){
47 this.getData() 49 this.getData()
  50 +
  51 + }
  52 +
  53 + onPageShow(){
  54 + TrackingPageBrowseUtils.TrackingPageBrowseExposureStart()
  55 + }
  56 +
  57 + onPageHide(): void {
  58 + TrackingPageBrowseUtils.TrackingPageBrowseExposureEnd(TrackConstants.PageName.My_Collect,TrackConstants.PageName.My_Collect)
48 } 59 }
49 60
50 build() { 61 build() {
@@ -7,7 +7,7 @@ import { HomePageBottomFollowComponent } from '../components/mine/home/HomePageB @@ -7,7 +7,7 @@ import { HomePageBottomFollowComponent } from '../components/mine/home/HomePageB
7 import MinePageDatasModel from '../model/MinePageDatasModel'; 7 import MinePageDatasModel from '../model/MinePageDatasModel';
8 import { EmptyComponent } from '../components/view/EmptyComponent'; 8 import { EmptyComponent } from '../components/view/EmptyComponent';
9 import { CustomTitleUI } from '../components/reusable/CustomTitleUI'; 9 import { CustomTitleUI } from '../components/reusable/CustomTitleUI';
10 -import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index'; 10 +import { TrackingPageBrowse, TrackConstants, TrackingButton } from 'wdTracking/Index';
11 11
12 const TAG = "MineHomePage" 12 const TAG = "MineHomePage"
13 13
@@ -454,6 +454,9 @@ struct MineHomePage { @@ -454,6 +454,9 @@ struct MineHomePage {
454 }, 1000); 454 }, 1000);
455 //route 跳转写这里 TODO 455 //route 跳转写这里 TODO
456 WDRouterRule.jumpWithPage(WDRouterPage.editUserInfoPage) 456 WDRouterRule.jumpWithPage(WDRouterPage.editUserInfoPage)
  457 +
  458 + //编辑资料只有个人主页
  459 + TrackingButton.click('mainPersonalHomePageEditorialMaterial',TrackConstants.PageName.Main_Personal,TrackConstants.PageName.Main_Personal)
457 } 460 }
458 } 461 }
459 getUserInfo(){ 462 getUserInfo(){
1 import { MessageListUI } from '../components/mine/message/MessageListUI'; 1 import { MessageListUI } from '../components/mine/message/MessageListUI';
2 - 2 +import {TrackConstants}from 'wdTracking/Index'
  3 +import TrackingPageBrowseUtils from '../utils/TrackingPageBrowseUtils'
3 @Entry 4 @Entry
4 @Component 5 @Component
5 struct MineMessagePage { 6 struct MineMessagePage {
6 7
  8 + onPageShow(): void {
  9 + TrackingPageBrowseUtils.TrackingPageBrowseExposureStart()
  10 + }
  11 +
  12 + onPageHide(): void {
  13 + TrackingPageBrowseUtils.TrackingPageBrowseExposureEnd(TrackConstants.PageName.My_Notification,TrackConstants.PageName.My_Notification)
  14 + }
  15 +
7 build() { 16 build() {
8 Column(){ 17 Column(){
9 MessageListUI() 18 MessageListUI()
  1 +import { DateTimeUtils } from 'wdKit/Index';
  2 +import { ParamType, TrackingPageBrowse } from 'wdTracking/Index';
  3 +
  4 +class TrackingPageBrowseUtils {
  5 + private static instance: TrackingPageBrowseUtils
  6 + pageShowTime:number = 0;
  7 + pageHideTime:number = 0;
  8 +
  9 + /**
  10 + * 单例模式
  11 + * @returns
  12 + */
  13 + public static getInstance(): TrackingPageBrowseUtils {
  14 + if (!TrackingPageBrowseUtils.instance) {
  15 + TrackingPageBrowseUtils.instance = new TrackingPageBrowseUtils();
  16 + }
  17 + return TrackingPageBrowseUtils.instance;
  18 + }
  19 +
  20 + TrackingPageBrowseExposureStart(){
  21 + this.pageShowTime = DateTimeUtils.getTimeStamp()
  22 + }
  23 +
  24 + TrackingPageBrowseExposureEnd(pageId: string, pageName: string,extParams?: ParamType){
  25 + this.pageHideTime = DateTimeUtils.getTimeStamp()
  26 + let duration = 0
  27 + duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000)
  28 + TrackingPageBrowse.trackCommonPageExposureEnd(pageId,pageName,duration,extParams)
  29 + }
  30 +}
  31 +
  32 +const pageBrowseUtils = TrackingPageBrowseUtils.getInstance();
  33 +export default pageBrowseUtils as TrackingPageBrowseUtils
1 -import { CompInfoBean, ContentDetailDTO, ContentDTO, PageInfoDTO } from 'wdBean/Index'; 1 +import { CompInfoBean, ContentDetailDTO, ContentDTO, PageInfoBean, PageInfoDTO } from 'wdBean/Index';
2 import { ParamType } from './PublicParams'; 2 import { ParamType } from './PublicParams';
  3 +import { TrackConstants } from './TrackConstants';
3 import { TrackingUtils } from './TrackingUtils'; 4 import { TrackingUtils } from './TrackingUtils';
4 5
5 export class TrackParamConvert { 6 export class TrackParamConvert {
@@ -70,7 +71,7 @@ export class TrackParamConvert { @@ -70,7 +71,7 @@ export class TrackParamConvert {
70 return param 71 return param
71 } 72 }
72 73
73 - private static appendRecommend(detail: ContentDetailDTO, to: ParamType) { 74 + private static appendRecommend(detail: object, to: ParamType) {
74 75
75 //TODO: ContentDetailDTO 增加推荐字段 76 //TODO: ContentDetailDTO 增加推荐字段
76 77
@@ -85,4 +86,42 @@ export class TrackParamConvert { @@ -85,4 +86,42 @@ export class TrackParamConvert {
85 /// 这里填写默认值,后续在action=browse时,再重写 86 /// 这里填写默认值,后续在action=browse时,再重写
86 to["duration"] = 0 87 to["duration"] = 0
87 } 88 }
  89 +
  90 +
  91 + ///早晚报 专题
  92 + static pageInfoBean_ParamType(pageInfo: PageInfoBean) : ParamType {
  93 +
  94 + let topTypeString: string = '';
  95 + switch (pageInfo.topicInfo.topicType){
  96 + case 21:
  97 + topTypeString = TrackConstants.SummaryType.Article
  98 + break;
  99 + case 22:
  100 + topTypeString = TrackConstants.SummaryType.Audio
  101 + break;
  102 + case 23:
  103 + topTypeString = TrackConstants.SummaryType.Live
  104 + break;
  105 + case 24:
  106 + topTypeString = TrackConstants.SummaryType.Talk
  107 + break;
  108 + case 25:
  109 + topTypeString = TrackConstants.SummaryType.MorningAndEveningNews
  110 + break;
  111 + case 26:
  112 + topTypeString = TrackConstants.SummaryType.TimeAxis
  113 + break;
  114 + }
  115 +
  116 + let param: ParamType = {
  117 + "summaryId": pageInfo.topicInfo.topicId,
  118 + "summaryType": topTypeString,
  119 + "specialLink": pageInfo.topicInfo.shareUrl,
  120 + "channelSourceId": pageInfo.name,
  121 + "pageId": 'summaryDetailPage',
  122 + }
  123 + TrackParamConvert.appendRecommend(pageInfo, param)
  124 +
  125 + return param
  126 + }
88 } 127 }
@@ -4,12 +4,8 @@ import { WDRouterPage } from 'wdRouter'; @@ -4,12 +4,8 @@ import { WDRouterPage } from 'wdRouter';
4 import { Logger, SPHelper } from 'wdKit/Index'; 4 import { Logger, SPHelper } from 'wdKit/Index';
5 import { SpConstants } from 'wdConstant/Index'; 5 import { SpConstants } from 'wdConstant/Index';
6 import LaunchDataModel from '../viewModel/LaunchDataModel' 6 import LaunchDataModel from '../viewModel/LaunchDataModel'
7 -import { LaunchModel } from '../viewModel/LaunchModel';  
8 -import { ifaa } from '@kit.OnlineAuthenticationKit';  
9 7
10 -import common from '@ohos.app.ability.common';  
11 -import Want from '@ohos.app.ability.Want';  
12 -import { BusinessError } from '@ohos.base'; 8 +import { ParamType, TrackConstants, TrackingButton, TrackingContent } from 'wdTracking/Index';
13 9
14 10
15 @Entry 11 @Entry
@@ -18,6 +14,7 @@ struct LaunchAdvertisingPage { @@ -18,6 +14,7 @@ struct LaunchAdvertisingPage {
18 @State time: number = 4 14 @State time: number = 4
19 timer :number = -1 15 timer :number = -1
20 @State model : LaunchDataModel = {} as LaunchDataModel 16 @State model : LaunchDataModel = {} as LaunchDataModel
  17 + pageParam: ParamType = {}
21 18
22 19
23 enter() { 20 enter() {
@@ -29,7 +26,6 @@ struct LaunchAdvertisingPage { @@ -29,7 +26,6 @@ struct LaunchAdvertisingPage {
29 } 26 }
30 27
31 aboutToAppear(): void { 28 aboutToAppear(): void {
32 -  
33 let dataModelStr : string = SPHelper.default.getSync(SpConstants.APP_LAUNCH_PAGE_DATA_MODEL,'') as string 29 let dataModelStr : string = SPHelper.default.getSync(SpConstants.APP_LAUNCH_PAGE_DATA_MODEL,'') as string
34 let dataModel : LaunchDataModel = JSON.parse(dataModelStr) 30 let dataModel : LaunchDataModel = JSON.parse(dataModelStr)
35 this.model = dataModel 31 this.model = dataModel
@@ -38,7 +34,9 @@ struct LaunchAdvertisingPage { @@ -38,7 +34,9 @@ struct LaunchAdvertisingPage {
38 //设置倒计时时间 34 //设置倒计时时间
39 this.time = this.model.launchAdInfo[0].displayDuration 35 this.time = this.model.launchAdInfo[0].displayDuration
40 } 36 }
  37 + this.contentTrackingDict()
41 38
  39 + this.trackingLaunchShow()
42 } 40 }
43 41
44 42
@@ -96,6 +94,7 @@ struct LaunchAdvertisingPage { @@ -96,6 +94,7 @@ struct LaunchAdvertisingPage {
96 .backgroundColor('#80000000') 94 .backgroundColor('#80000000')
97 .onClick(() => { 95 .onClick(() => {
98 this.enter() 96 this.enter()
  97 + this.trackingLaunchJumpOver()
99 }) 98 })
100 } 99 }
101 .width('100%') 100 .width('100%')
@@ -176,13 +175,15 @@ struct LaunchAdvertisingPage { @@ -176,13 +175,15 @@ struct LaunchAdvertisingPage {
176 action(){ 175 action(){
177 //跳转 url linkUrl https://news.bjd.com.cn/2024/03/19/10724331.shtml 176 //跳转 url linkUrl https://news.bjd.com.cn/2024/03/19/10724331.shtml
178 // openType 端外 端内 打开 177 // openType 端外 端内 打开
  178 +
  179 + ///埋点
  180 + this.trackingLaunchClick()
  181 +
179 if(this.model.launchAdInfo.length){ 182 if(this.model.launchAdInfo.length){
180 if (this.model.launchAdInfo[0].matInfo.openType == '2') { 183 if (this.model.launchAdInfo[0].matInfo.openType == '2') {
181 //端外打开 184 //端外打开
182 -  
183 ProcessUtils.jumpExternalWebPage(this.model.launchAdInfo[0].matInfo.linkUrl) 185 ProcessUtils.jumpExternalWebPage(this.model.launchAdInfo[0].matInfo.linkUrl)
184 //clearInterval(this.timer) 186 //clearInterval(this.timer)
185 -  
186 }else { 187 }else {
187 //端内打开 188 //端内打开
188 ProcessUtils.gotoDefaultWebPage(this.model.launchAdInfo[0].matInfo.linkUrl) 189 ProcessUtils.gotoDefaultWebPage(this.model.launchAdInfo[0].matInfo.linkUrl)
@@ -192,6 +193,25 @@ struct LaunchAdvertisingPage { @@ -192,6 +193,25 @@ struct LaunchAdvertisingPage {
192 } 193 }
193 } 194 }
194 195
  196 + contentTrackingDict(){
  197 + this.pageParam = {
  198 + 'adType':'0',
  199 + 'adId':this.model.launchAdInfo[0].matInfo.id.toString(),
  200 + 'adName':this.model.launchAdInfo[0].matInfo.advTitle,
  201 + 'regionName':'0'
  202 + }
  203 + }
  204 +
  205 + trackingLaunchJumpOver(){
  206 + TrackingButton.click('skip_click',TrackConstants.PageName.Open_Screen,TrackConstants.PageName.Open_Screen)
  207 + }
  208 +
  209 + trackingLaunchShow(){
  210 + TrackingContent.common(TrackConstants.EventType.Show,TrackConstants.PageName.Open_Screen,TrackConstants.PageName.Open_Screen,this.pageParam)
  211 + }
195 212
  213 + trackingLaunchClick(){
  214 + TrackingContent.common(TrackConstants.EventType.Click,TrackConstants.PageName.Open_Screen,TrackConstants.PageName.Open_Screen,this.pageParam)
  215 + }
196 216
197 } 217 }
@@ -26,6 +26,7 @@ export interface NetLayerLauncherADMaterialModel{ @@ -26,6 +26,7 @@ export interface NetLayerLauncherADMaterialModel{
26 matType : string //1 video 其他 image 26 matType : string //1 video 其他 image
27 startStyle : number // 1 WDDisplayStyle_Full 全屏样式 其他 WDDisplayStyle_Logo 底部logo样式 27 startStyle : number // 1 WDDisplayStyle_Full 全屏样式 其他 WDDisplayStyle_Logo 底部logo样式
28 advTitle : string 28 advTitle : string
  29 + id:number
29 matImageUrl : string[] //取firstObject 30 matImageUrl : string[] //取firstObject
30 matVideoUrl : string 31 matVideoUrl : string
31 32