王士厅

图集、点赞、收藏埋点

... ... @@ -10,6 +10,7 @@ import {
postExecuteLikeParams,
batchLikeAndCollectParams,
} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import { ParamType, TrackConstants, TrackingButton, TrackingContent } from 'wdTracking/Index';
const TAG = 'LikeComponent';
... ... @@ -30,6 +31,8 @@ export struct LikeComponent {
componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口
styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) 3 透明背景
@State likeCount: number = 0 //点赞数
pageParam: ParamType = {}
PageName: string = ''
//上层传值 样例
// this.data['contentId'] = '30035444649' //必须
... ... @@ -50,6 +53,7 @@ export struct LikeComponent {
this.likesStyle = this.contentDetailData.likesStyle
}
this.onDataUpdated()
this.contentTrackingDict()
}
onDataUpdated() {
... ... @@ -64,6 +68,27 @@ export struct LikeComponent {
}
}
contentTrackingDict(){
this.pageParam = {
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
}
if(this.contentDetailData.newsType == 1) {
this.PageName = TrackConstants.PageName.VideoDetail // 点播
} else if(this.contentDetailData.newsType == 2) {
this.PageName = TrackConstants.PageName.Live_Detail // 直播
} else if(this.contentDetailData.newsType == 5) {
this.PageName = TrackConstants.PageName.Summary_Detail // 专题详情页
} else if(this.contentDetailData.newsType == 8) {
this.PageName = TrackConstants.PageName.Article_Detail // 图文详情页
} else if(this.contentDetailData.newsType == 9) {
this.PageName = TrackConstants.PageName.Atlas_Detail // 图集详情页
} else if(this.contentDetailData.newsType == 14 || this.contentDetailData.newsType == 15) {
this.PageName = TrackConstants.PageName.DynamicDetail // 动态图文/动态视频
}
}
build() {
if (this.componentType == 2) {
... ... @@ -346,13 +371,16 @@ export struct LikeComponent {
if (this.contentDetailData.liveInfo) {
this.likeStatus = true
this.likeCount++
TrackingContent.like(true,this.PageName,this.PageName,this.pageParam)
} else {
this.likeStatus = !this.likeStatus
//点赞和取消点赞成功后更新点赞数
if (this.likeStatus) {
this.likeCount++
TrackingContent.like(true,this.PageName,this.PageName,this.pageParam)
} else {
this.likeCount--
TrackingContent.like(false,this.PageName,this.PageName,this.pageParam)
}
}
... ...
... ... @@ -23,6 +23,7 @@ import { WDShare } from 'wdShare/Index';
import { AudioSuspensionModel } from '../../viewmodel/AudioSuspensionModel'
import { EmitterEventId, EmitterUtils } from 'wdKit/Index'
import { PlayerConstants } from 'wdPlayer'
import { ParamType, TrackConstants, TrackingButton, TrackingContent } from 'wdTracking/Index';
const TAG = 'OperRowListView';
... ... @@ -91,6 +92,8 @@ export struct OperRowListView {
@State currentStatus: number | string | undefined = 0;
@State name: string = 'audio_recommend_status_wait'
@State dialogController: CustomDialogController | null = null;
pageParam: ParamType = {}
PageName: string = ''
async aboutToAppear() {
console.info(TAG, 'this.needLike', this.needLike)
... ... @@ -109,6 +112,28 @@ export struct OperRowListView {
}
}
})
this.contentTrackingDict()
}
contentTrackingDict(){
this.pageParam = {
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
}
if(this.contentDetailData.newsType == 1) {
this.PageName = TrackConstants.PageName.VideoDetail // 点播
} else if(this.contentDetailData.newsType == 2) {
this.PageName = TrackConstants.PageName.Live_Detail // 直播
} else if(this.contentDetailData.newsType == 5) {
this.PageName = TrackConstants.PageName.Summary_Detail // 专题详情页
} else if(this.contentDetailData.newsType == 8) {
this.PageName = TrackConstants.PageName.Article_Detail // 图文详情页
} else if(this.contentDetailData.newsType == 9) {
this.PageName = TrackConstants.PageName.Atlas_Detail // 图集详情页
} else if(this.contentDetailData.newsType == 14 || this.contentDetailData.newsType == 15) {
this.PageName = TrackConstants.PageName.DynamicDetail // 动态图文/动态视频
}
}
async onDetailUpdated() {
... ... @@ -440,6 +465,9 @@ export struct OperRowListView {
this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
if (this.newsStatusOfUser.collectStatus === 1) {
promptAction.showToast({ message: '收藏成功' })
TrackingContent.collect(true,this.PageName,this.PageName,this.pageParam)
} else {
TrackingContent.collect(false,this.PageName,this.PageName,this.pageParam)
}
this.queryContentInteractCount()
}
... ...
... ... @@ -100,7 +100,19 @@ export class TrackingContent {
// 内容下载点击事件 1.图片 2.音频 3.视频
static download(donwloadContentType: number, pageId: string, pageName: string, extParams?: ParamType) {
let params = TrackingUtils.generateParams(extParams)
if (donwloadContentType) {
params["donwloadContentType"] = donwloadContentType
}
if (pageId.length) {
params["pageId"] = pageId
}
if (pageName.length) {
params["pageName"] = pageName
}
params["action"] =TrackConstants.ActionType.Download
TrackingUtils.fillPositionWith(params)
Tracking.event("download_click", params)
}
}
\ No newline at end of file
... ...
import { Logger } from 'wdKit';
import { DateTimeUtils, NetworkUtil, StringUtils, Logger } from 'wdKit';
import router from '@ohos.router';
import { Params, Action } from 'wdBean';
import { WindowModel } from 'wdKit/Index';
import { MultiPictureDetailPageComponent } from '../view/MultiPictureDetailPageComponent';
import { TrackingPageBrowse, TrackConstants, TrackingButton } from 'wdTracking/Index';
const TAG = 'MultiPictureDetailPage';
... ... @@ -16,6 +17,8 @@ struct MultiPictureDetailPage {
@State relId: string = ''
@State contentId: string = ''
@State relType: string = ''
pageShowTime:number = 0;
pageHideTime:number = 0;
build() {
Row() {
... ... @@ -68,12 +71,17 @@ struct MultiPictureDetailPage {
onPageShow(): void {
console.log(TAG, 'onPageShow')
this.pageShowTime = DateTimeUtils.getTimeStamp()
this.openFullScreen()
}
onPageHide(): void {
console.log(TAG, 'onPageHide')
this.pageHideTime = DateTimeUtils.getTimeStamp()
let duration = 0
duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000)
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Atlas_Detail,TrackConstants.PageName.Atlas_Detail,duration)
this.closeFullScreen()
}
... ...
... ... @@ -23,6 +23,7 @@ import { EmptyComponent,
PageRepository,
publishCommentModel,
viewBlogItemInsightIntentShare} from 'wdComponent/Index';
import { ParamType, TrackConstants, TrackingButton, TrackingContent } from 'wdTracking/Index';
const TAG = 'MultiPictureDetailPageComponent';
/**
... ... @@ -58,6 +59,9 @@ export struct MultiPictureDetailPageComponent {
@State operationButtonList: string[] = ['comment', 'like', 'collect', 'share']
@State currentOffset: number = 0
@State duration: number = 0
pageParam: ParamType = {}
followUserId: string = ''
followUserName: string = ''
//watch监听页码回调
onCurrentPageNumUpdated(): void {
... ... @@ -88,6 +92,17 @@ export struct MultiPictureDetailPageComponent {
// 无网络
this.netStatus = 1
}
this.contentTrackingDict()
}
contentTrackingDict(){
this.pageParam = {
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
}
this.followUserId = this.contentDetailData?.rmhInfo?.rmhId || ''
this.followUserName = this.contentDetailData?.rmhInfo?.rmhName || ''
}
aboutToDisappear() {
... ... @@ -426,6 +441,11 @@ export struct MultiPictureDetailPageComponent {
bottom: 24,
right: 18
})
.parallelGesture(
TapGesture()
.onAction((event: GestureEvent) => {
TrackingContent.download(1,TrackConstants.PageName.Atlas_Detail,TrackConstants.PageName.Atlas_Detail,this.pageParam)
}))
}
}
}
... ... @@ -560,8 +580,10 @@ export struct MultiPictureDetailPageComponent {
console.log(TAG, '关注号主==', JSON.stringify(res.data))
if (this.followStatus == '1') {
this.followStatus = '0'
TrackingContent.follow(true,this.followUserId,this.followUserName,TrackConstants.PageName.Atlas_Detail,TrackConstants.PageName.Atlas_Detail,this.pageParam)
} else {
this.followStatus = '1'
TrackingContent.follow(false,this.followUserId,this.followUserName,TrackConstants.PageName.Atlas_Detail,TrackConstants.PageName.Atlas_Detail,this.pageParam)
}
})
}
... ...