infomationCardClick.ets
3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import { TrackingContent, TrackConstants, ParamType } from 'wdTracking';
import { CompDTO, ContentDTO } from 'wdBean';
import { Logger } from 'wdKit';
export class InfomationCardClick {
private static getLiveState(contentDTO: ContentDTO) {
if (contentDTO?.liveInfo?.liveState === 'wait') {
return 'liveSubscribe'
} else if (contentDTO?.liveInfo?.liveState === 'running') {
return 'livePlaying'
} else if (contentDTO?.liveInfo?.liveState === 'end') {
return 'liveEnd'
} else {
return ''
}
}
private static getSummaryType(objectType: string) {
let summaryType: string = ''
switch(objectType) {
case '2':
summaryType = 'liveTopic';
break;
case '8':
summaryType = 'articleTopic';
break;
case '13':
summaryType = 'audioTopic';
break;
// case '':
// summaryType = 'talkTopic';
// break;
// case '':
// summaryType = 'morningAndEveningNewsTopic';
// break;
// case '':
// summaryType = 'timeAxisTopic';
// break;
default:
summaryType = '';
break;
}
return summaryType;
}
public static track(
compDTO: CompDTO,
contentDTO: ContentDTO,
pageId: string,
pageName: string,
action = 'detailPageShow', // like, commentClick, follow
bl = false,
followUserId = '',
followUserName = ''
): void {
try {
const extParams: ParamType = {
'action': action,
'shareChannel': '',
'duration': 0,
'contentName': contentDTO.newsTitle,
'contentType': contentDTO.objectType,
// 'contentClassify': '' // 废除
'contentId': contentDTO.objectId,
// 'compId': contentDTO.relId,
'contentStyle': contentDTO.appStyle,
'liveType': InfomationCardClick.getLiveState(contentDTO),
'channelSourceId': contentDTO.channelId,
'contentShowChannelId': contentDTO.channelId,
// 'contentShowChannelName': '',
'linkUrl': contentDTO.linkUrl,
'regionName': 2, // 信息流:2
'componentType': compDTO.compStyle,
'sceneId': contentDTO.sceneId,
'subSceneId': contentDTO.subSceneId,
'cnsTraceId': contentDTO.cnsTraceId,
'cardItemId': compDTO.cardItemId,
'itemId': compDTO.itemId || contentDTO.itemId,
'expIds': compDTO.expIds || contentDTO.expIds
}
if (contentDTO.objectType === '5') {
extParams['summaryId'] = contentDTO.objectId;
extParams['summaryType'] = InfomationCardClick.getSummaryType(contentDTO.objectType);
extParams['specialLink'] = contentDTO.linkUrl;
}
if (contentDTO.objectType === '2') {
extParams['liveStreamType'] = contentDTO?.liveInfo.vrType === 0 ? 1 : 2;
extParams['vliveId'] = contentDTO.objectId;
extParams['vliveName'] = contentDTO.newsTitle;
extParams['liveMode'] = 1;
}
if (contentDTO.rmhPlatform === 1) {
extParams['saAuthorName'] = contentDTO.rmhInfo?.rmhName;
extParams['saAuthorId'] = contentDTO.rmhInfo?.rmhId;
} else if (contentDTO.source) {
extParams['saAuthorName'] = contentDTO.source;
}
Logger.debug('InfomationCardClick-params:', JSON.stringify(extParams))
if (action === 'detailPageShow') {
TrackingContent.common(TrackConstants.EventType.Click, pageId, pageName, extParams);
} else if (action === 'like') {
TrackingContent.like(bl, pageId, pageName, extParams);
} else if (action === 'commentClick') {
TrackingContent.commentClick(pageId, pageName, extParams);
} else if (action === 'follow') {
TrackingContent.follow(bl, followUserId, followUserName, pageId, pageName, extParams)
}
} catch (err) {
Logger.error('InfomationCardClick-err', JSON.stringify(err))
}
}
}