Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
xugenyuan
2024-04-30 16:33:40 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5e2e77174717d5400c0b6942e5f74f9c239e9564
5e2e7717
1 parent
31864699
ref |> 完善埋点统计
Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
446 additions
and
51 deletions
sight_harmony/commons/wdKit/oh-package-lock.json5
sight_harmony/features/wdTracking/Index.ets
sight_harmony/features/wdTracking/src/main/ets/TrackingModule.ets
sight_harmony/features/wdTracking/src/main/ets/tracking/PublicParams.ets → sight_harmony/features/wdTracking/src/main/ets/common/PublicParams.ets
sight_harmony/features/wdTracking/src/main/ets/common/TrackConstants.ets
sight_harmony/features/wdTracking/src/main/ets/common/TrackParamConvert.ets
sight_harmony/features/wdTracking/src/main/ets/tracking/Tracking.ets
sight_harmony/features/wdTracking/src/main/ets/tracking/TrackingButton.ets
sight_harmony/features/wdTracking/src/main/ets/tracking/TrackingContent.ets
sight_harmony/features/wdTracking/src/main/ets/tracking/TrackingPageBrowse.ets
sight_harmony/features/wdTracking/src/main/ets/tracking/TrackingPlay.ets
sight_harmony/commons/wdKit/oh-package-lock.json5
0 → 100644
View file @
5e2e771
{
"meta"
:
{
"stableOrder"
:
true
},
"lockfileVersion"
:
3
,
"ATTENTION"
:
"THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY."
,
"specifiers"
:
{
"@umeng/analytics@^1.0.19"
:
"@umeng/analytics@1.0.19"
,
"@umeng/common@^1.0.21"
:
"@umeng/common@1.0.21"
,
"libcommon.so@../../oh_modules/.ohpm/@umeng+common@1.0.21/oh_modules/@umeng/common/src/main/cpp/types/libcommon"
:
"libcommon.so@../../oh_modules/.ohpm/@umeng+common@1.0.21/oh_modules/@umeng/common/src/main/cpp/types/libcommon"
},
"packages"
:
{
"@umeng/analytics@1.0.19"
:
{
"name"
:
"@umeng/analytics"
,
"integrity"
:
"sha512-0m9z5l8to+POjDl9UkCQC8s4P+e2E1OILwUglC7ME4QwqfH44e59GLJtQdwF0h6kwpsy3YBft4SoWK8MYbuP7g=="
,
"resolved"
:
"https://ohpm.openharmony.cn/ohpm/@umeng/analytics/-/analytics-1.0.19.har"
,
"registryType"
:
"ohpm"
},
"@umeng/common@1.0.21"
:
{
"name"
:
"@umeng/common"
,
"integrity"
:
"sha512-EbXsd4OoRisTQf5egNY/+z1D2bvrYw9VwC2xu3EJA9TiDPSbnaJZ5+yltA/Se6yZ4oCcFvq6e5/AAfPuumunbw=="
,
"resolved"
:
"https://ohpm.openharmony.cn/ohpm/@umeng/common/-/common-1.0.21.har"
,
"registryType"
:
"ohpm"
,
"dependencies"
:
{
"libcommon.so"
:
"./src/main/cpp/types/libcommon"
}
},
"libcommon.so@../../oh_modules/.ohpm/@umeng+common@1.0.21/oh_modules/@umeng/common/src/main/cpp/types/libcommon"
:
{
"name"
:
"libcommon.so"
,
"resolved"
:
"../../oh_modules/.ohpm/@umeng+common@1.0.21/oh_modules/@umeng/common/src/main/cpp/types/libcommon"
,
"registryType"
:
"local"
}
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdTracking/Index.ets
View file @
5e2e771
export { TrackingModule } from "./src/main/ets/TrackingModule"
export { ParamType } from "./src/main/ets/common/PublicParams"
export { TrackConstants } from "./src/main/ets/common/TrackConstants"
export { TrackParamConvert } from "./src/main/ets/common/TrackParamConvert"
export { Tracking } from "./src/main/ets/tracking/Tracking"
export { TrackingButton } from "./src/main/ets/tracking/TrackingButton"
export { TrackingContent } from "./src/main/ets/tracking/TrackingContent"
export { TrackingPageBrowse } from "./src/main/ets/tracking/TrackingPageBrowse"
export { TrackingPlay } from "./src/main/ets/tracking/TrackingPlay"
\ No newline at end of file
...
...
sight_harmony/features/wdTracking/src/main/ets/TrackingModule.ets
View file @
5e2e771
...
...
@@ -5,33 +5,41 @@ import { HostEnum, HostManager } from 'wdNetwork/Index';
/// 统计埋点模块
export class TrackingModule {
private static SA_DATA_SERVER_URL_PRODUCT = "https://data.pdnews.cn/sa?project=PDChinese"
private static SA_DATA_SERVER_URL_TEST = "https://data.pdnews.cn/sa?project=PDChineseTest"
private static _init = false
static getHasInit() {
return TrackingModule._init;
}
/// 初始化
static startup(context: common.UIAbilityContext) {
// const isOnlineEnv = HostManager.getHost() === HostEnum.HOST_PRODUCT
//
// sensors.init({
// // 服务器接收地址
// server_url: isOnlineEnv ? '正式地址' : "测试地址",
// // Ability 上下文
// context: context,
// // 是否显示日志
// show_log: true,
// // 是否开启采集位置信息,需要 app 授权,默认 false
// enable_track_location: true,
// // 是否开启批量发送,默认 false
// batch_send: true,
// // 数据发送超时时间
// datasend_timeout: 10000,
// // 开启 App 打通 H5
// app_js_bridge: false
// });
// TrackingModule._init = true
static startup(context: common.UIAbilityContext) : Promise<void> {
return new Promise((resolve) => {
const isOnlineEnv = HostManager.getHost() === HostEnum.HOST_PRODUCT
sensors.init({
//TODO: 服务器接收地址 暂时用测试环境的
server_url: isOnlineEnv ? TrackingModule.SA_DATA_SERVER_URL_TEST : TrackingModule.SA_DATA_SERVER_URL_TEST,
// Ability 上下文
context: context,
// 是否显示日志
show_log: true,
// 是否开启采集位置信息,需要 app 授权,默认 false
enable_track_location: true,
// 是否开启批量发送,默认 false
batch_send: true,
// 数据发送超时时间
datasend_timeout: 10000,
// 开启 App 打通 H5
app_js_bridge: false
}).then((inited) => {
TrackingModule._init = inited
resolve()
});
})
}
...
...
sight_harmony/features/wdTracking/src/main/ets/
tracking
/PublicParams.ets → sight_harmony/features/wdTracking/src/main/ets/
common
/PublicParams.ets
View file @
5e2e771
import { SpConstants } from 'wdConstant/Index';
import { DeviceUtil, SPHelper, StringUtils } from 'wdKit/Index';
import {
AccountManagerUtils, AppUtils,
DeviceUtil, SPHelper, StringUtils } from 'wdKit/Index';
import { HostEnum, HostManager } from 'wdNetwork/Index';
export type ParamType = Record<string, string | number | boolean | Array<string>>
...
...
@@ -10,20 +10,20 @@ export class PublicParams {
return new Promise((resolve) => {
let pub: ParamType = {
"userName":"",
"pdUseId":"",
"creatorId":"",
"pdCnsBirthday":"",
"userName": SPHelper.default.getSync(SpConstants.USER_NAME, '') as string,
"pdUseId": SPHelper.default.getSync(SpConstants.USER_ID, '') as string,
"creatorId": SPHelper.default.getSync(SpConstants.USER_CREATOR_ID, '') as string,
"pdCnsBirthday": SPHelper.default.getSync(SpConstants.USER_BIRTHDAY, '') as string,
"city": PublicParams.getLocationCity(),
"sex":"",
"isSign":"0",
"sex":` ${SPHelper.default.getSync(SpConstants.USER_SEX, 0) as number}`,
"isSign": AccountManagerUtils.isLoginSync() ? "1" : "0",
"environment": PublicParams.getEnv(),
"os":
"harmonyos"
,
"os":
AppUtils.getOSName()
,
"actionTime": new Date().getTime() * 0.001,
"channel": "rmrb_china_0000",
"version": PublicParams.getVersionName(),
"channel": AppUtils.getAppChannel(),
"version": AppUtils.getAppVersionName(),
"deviceId": DeviceUtil.clientId(),
"model":
"
",
"model":
DeviceUtil.getMarketName() || "未知
",
"mpaasId": PublicParams.getMpaasId(),
}
resolve(pub)
...
...
@@ -53,23 +53,8 @@ export class PublicParams {
return ""
}
private static getBuildVersion() {
// TODO
return '202401242103';
}
private static getVersionCode() {
// TODO
return '10000';
}
private static getVersionName() {
// TODO 读取配置
return '1.0.0';
}
private static getMpaasId() {
// TODO
// TODO
: 新增mpaasId utdid
return 'alsjdflajxaljdlfjaldjfa';
}
}
...
...
sight_harmony/features/wdTracking/src/main/ets/common/TrackConstants.ets
0 → 100644
View file @
5e2e771
export namespace TrackConstants {
export enum EventType {
Show = 0,
Click = 1
}
// 行为类型
export enum ActionType {
Show = "show", // 曝光/展示
DetailPageShow = "detailPageShow",
Collect = "collect",
CollectTag = "collectTag",
UnCollect = "uncollect",
Follow = "follow",
UnFollow = "unfollow",
Like = "like",
DisLike = "dislike",
Share = "share",
Comment = "comment",
Browse = "browse",
Download = "download",
Subscribe = "subscribe",
UnSubscribe = "unSubscribe",
CloseInterestCard = "closeInterestCard",
SelectInterestCard = "selectInterestCard",
}
// 分享聚道
export enum ShareChannelType {
Poster = "poster",
Wechat = "wechat",
Moments = "moments",
Sina = "sinaweibo",
Dingtalk = "dingTalk",
QQ = "qq",
Qzone = "qzone",
CopyLink = "copyLink",
}
// 专题类型
export enum SummaryType {
Live = "liveTopic",
Article = "articleTopic",
Audio = "audioTopic",
Talk = "talkTopic",
MorningAndEveningNews = "morningAndEveningNewsTopic",
TimeAxis = "timeAxisTopic"
}
// 直播类别
export enum LiveType {
Subscribe = "liveSubscribe",
Running = "livePlaying",
End = "liveEnd"
}
// 所属区域
export enum RegionName{
KaiPing = "0",
GuaJiao = "1",
Feed = "2",
CaiDan = "3",
}
// 页面名称或页面id。这里是不包含运营配置页面的pageid的
export enum PageName {
DynamicDetail = "dynamicDetailPage",
VideoDetail = "videoDetailPage",
Live_Detail = "liveDetailPage",
/// 音频详情页
Audio_Detail = "audioDetailPage",
/// 音频正文页
Audio_Detail_Text = "audioTextPage",
/// 图文详情页
Article_Detail = "articleDetailPage",
/// 图集详情页
Atlas_Detail = "atlasDetailPage",
///电子报页面
Eletronic_Paper = "newsPaperPage",
/// 金刚位详情
KeyPosition = "diamondDetailPage",
/// 问政详情页
Ask_Detail = "questionAnswerPage",
/// 专题详情页
Summary_Detail = "summaryDetailPage",
/// 搜索页
Search = "searchPage",
/// 我的
My = "myPage",
/// 设置页
Setting = "settingPage",
/// 账号管理
Account_Management = "accountManagementPage",
/// 注销账户
Cancel_Account = "cancelAccountPage",
/// 隐私设置
Privacy_Setting = "privacySettingPage",
/// 意见反馈
Feedback = "feedbackPage",
/// 关于
About = "aboutPage",
/// 编辑资料
Edit_Information = "editInformationPage",
/// 登录页
Login_Page = "loginPage",
/// 手机号登录
Phone_Login_Page = "phoneNumberLoginPage",
/// 我的评论
My_Comment = "myCommentPage",
///草稿箱
My_DraftBox = "draftBoxPage",
/// 我的关注
My_Follow = "myFollowPage",
/// 我的收藏
My_Collect = "myCollectPage",
/// 浏览历史
My_History = "myHistoryPage",
/// 消息
My_Notification = "myNotificationPage",
/// 我的预约
My_Saved_Live = "mySavedLivePage",
/// 兴趣选择
Preference_Selection = "preferenceSelectionPage",
/// 升级页面
Update = "updatePage",
/// 开屏广告页
Open_Screen = "openScreenPage",
/// 新手引导页
Guide = "guidePage",
/// 启动页
Launch = "launchPage",
/// 个人主页(主态)
Main_Personal = "mainPersonalPage",
/// 个人主页(客态)
Customer_Personal = "customerPersonalPage",
/// 个人资料页
Personal_Data = "personalDataPage",
/// H5下载页面
H5download = "H5DownloadPage",
/// 找回密码
Retrieve_Password = "retrievePasswordPage",
/// 重置密码
Reset_Password = "resetPasswordPage",
/// 一键登录
OneClick_Login = "oneClickLoginPage",
/// 二维码扫描
QR_Scan = "QRCodeLoginPage",
/// 绑定手机号
Bind_PhoneNum = "bindPhoneNumberPage",
/// 验证当前手机号
Checking_PhoneNum = "checkingPhoneNumberPage",
/// 更改手机号
Change_PhoneNum = "changePhoneNumberPage",
/// 设置密码
Setup_Passwd = "setPasswordPage",
/// 修改密码
Change_Passwd = "changePasswordPage",
/// 第三方账号绑定手机号
Third_Part_Account_Bind_PhoneNum = "bindingThirdNumberPage",
/// 实名认证
RealName_Authentication = "realNameAuthenticationPage",
/// 发布文章
Publish_Article = "publishArticlePage",
/// 发布视频
Publish_Video = "publishVideoPage",
/// 发布动态
Publish_Dynamic = "publishDynamicPage",
/// 发布图集
Publish_Atlas = "publishAtlasPage",
/// 举报评论
Report_Comment = "reportCommentsPage",
/// 优质评论
Best_Comment = "bestCommentsPage",
/// 举报内容
Report_Content = "reportContentPage",
///兴趣偏好页
Interest = "preferenceSelectionPage",
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdTracking/src/main/ets/common/TrackParamConvert.ets
0 → 100644
View file @
5e2e771
import { ContentDetailDTO } from 'wdBean/Index';
import { ParamType } from './PublicParams';
export class TrackParamConvert {
static convertContentDetail(detail: ContentDetailDTO) : ParamType {
let param: ParamType = {
"contentType": detail.newsType.toFixed(0),
"contentId": detail.newsId,
"contentName": detail.newsTitle
//TODO: 添加更多参数
}
TrackParamConvert.appendRecommend(detail, param)
return param
}
private static appendRecommend(detail: ContentDetailDTO, to: ParamType) {
to["sceneId"] = "9999"
to["subSceneId"] = ""
to["cnsTraceId"] = "selfHold"
to["itemId"] = ""
to["expIds"] = ""
/// 这里填写默认值,后续在分享处 再重写
to["shareChannel"] = ""
/// 这里填写默认值,后续在action=browse时,再重写
to["duration"] = 0
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdTracking/src/main/ets/tracking/Tracking.ets
View file @
5e2e771
import { Logger } from 'wdKit/Index';
import { TrackingModule } from '../TrackingModule';
import sensors from '@sensorsdata/analytics';
import { ParamType, PublicParams } from './PublicParams';
import { ParamType, PublicParams } from '.
./common
/PublicParams';
import { HashMap } from '@kit.ArkTS';
import { TrackConstants } from '../common/TrackConstants';
const TAG = "WDTracking"
...
...
@@ -22,11 +23,10 @@ export class Tracking {
if (params) {
for (const obj of Object.entries(params)) {
Logger.info(TAG, ` ${obj[0]} => ` + `${obj[1]}`);
//
Logger.info(TAG, ` ${obj[0]} => ` + `${obj[1]}`);
pubParams[obj[0]] = obj[1]
}
}
sensors.track(eventId, pubParams)
})
}
...
...
sight_harmony/features/wdTracking/src/main/ets/tracking/TrackingButton.ets
0 → 100644
View file @
5e2e771
import { ParamType } from '../common/PublicParams';
import { Tracking } from './Tracking';
export class TrackingButton {
static click(buttonName: string, pageId: string, pageName: string, extParams?: ParamType) {
if (!extParams) {
extParams = {}
}
extParams["pageName"] = pageName
extParams["pageId"] = pageId
extParams["clickButtonName"] = buttonName
Tracking.event("name_click", extParams)
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdTracking/src/main/ets/tracking/TrackingContent.ets
0 → 100644
View file @
5e2e771
import { ParamType } from '../common/PublicParams'
import { TrackConstants } from "../common/TrackConstants"
export class TrackingContent {
/// 内容曝光/内容点击 事件
/// eventType 曝光 / 点击类型
/// pageName 如果是统一业务值 见 TrackConstants
/// pageId
/// extParams 模型转换成字段参数传值 转换方法见 TrackParamConvert
static common(eventType: TrackConstants.EventType, pageId: string, pageName: string, extParams: ParamType) {
}
static commonShare(shareType: number, pageId: string, pageName: string, extParams: ParamType) {
}
static like(like: boolean, pageId: string, pageName: string, extParams: ParamType) {
}
static collect(collect: boolean, pageId: string, pageName: string, extParams: ParamType) {
}
static follow(follow: boolean, followUserId: string, followUserName: string, pageId: string, pageName: string, extParams: ParamType) {
}
static commentClick(pageId: string, pageName: string, extParams: ParamType) {
}
static commentShare(pageId: string, pageName: string, extParams: ParamType) {
}
// 内容下载点击事件 1.图片 2.音频 3.视频
static download(donwloadContentType: number, pageId: string, pageName: string, extParams: ParamType) {
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdTracking/src/main/ets/tracking/TrackingPageBrowse.ets
0 → 100644
View file @
5e2e771
export class TrackingPageBrowse {
}
\ No newline at end of file
...
...
sight_harmony/features/wdTracking/src/main/ets/tracking/TrackingPlay.ets
0 → 100644
View file @
5e2e771
import { ParamType } from '../common/PublicParams';
/*
* 处理音频、视频、直播 正片播放、播放结束、播放错误等
* */
export class TrackingPlay {
// 视频
static videoPositivePlay(prepareTime: number, pageId: string, pageName: string, extParams: ParamType) {
}
static videoPlayEnd(currentPlayTime: number, totalTime: number, browseTime: number, pageId: string, pageName: string, extParams: ParamType) {
}
static videoPlayError(errorInfo: string, pageId: string, pageName: string, extParams: ParamType) {
}
// 音频
static audioPositivePlay(prepareTime: number, pageId: string, pageName: string, extParams: ParamType) {
}
static audioPlayEnd(currentPlayTime: number, totalTime: number, browseTime: number, pageId: string, pageName: string, extParams: ParamType) {
}
static audioPlayError(errorInfo: string, pageId: string, pageName: string, extParams: ParamType) {
}
// 直播
static liveVideoPositivePlay(prepareTime: number, pageId: string, pageName: string, extParams: ParamType) {
}
static liveVideoPlayEnd(currentPlayTime: number, totalTime: number, browseTime: number, pageId: string, pageName: string, extParams: ParamType) {
}
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment