Commit c9ffd775 authored by 张九刚's avatar 张九刚

feat: 首页埋点

parent 7352416d
No preview for this file type
{
"editor.semanticHighlighting.enabled": false,
"files.associations": {
"*.wxml": "html",
"*.wxss": "css",
"*.wxs": "javascript"
},
"editor.tokenColorCustomizations": {
"comments": "#9AA0A6",
"textMateRules": [
{
"scope": [
"comment",
"comment.block",
"comment.block.documentation",
"punctuation.definition.comment"
],
"settings": { "foreground": "#9AA0A6" }
},
{
"scope": [
"comment.block.html",
"punctuation.definition.comment.html",
"comment.block.vue",
"punctuation.definition.comment.vue",
"comment.block.vue-html",
"punctuation.definition.comment.vue-html",
"comment.block.xml",
"punctuation.definition.comment.xml"
],
"settings": { "foreground": "#9AA0A6" }
},
{
"scope": [
"comment.block.js",
"comment.line.double-slash.js",
"punctuation.definition.comment.js",
"comment.block.javascript",
"comment.line.double-slash.javascript",
"punctuation.definition.comment.javascript"
],
"settings": { "foreground": "#9AA0A6" }
},
{
"scope": [
"comment.block.css",
"punctuation.definition.comment.css"
],
"settings": { "foreground": "#9AA0A6" }
}
],
"[Default Dark+]": {
"comments": "#9AA0A6",
"textMateRules": [
{
"scope": [
"comment",
"comment.block",
"comment.block.documentation",
"punctuation.definition.comment",
"comment.block.html",
"punctuation.definition.comment.html",
"comment.block.vue",
"punctuation.definition.comment.vue",
"comment.block.vue-html",
"punctuation.definition.comment.vue-html",
"comment.block.xml",
"punctuation.definition.comment.xml",
"comment.block.js",
"comment.line.double-slash.js",
"punctuation.definition.comment.js",
"comment.block.javascript",
"comment.line.double-slash.javascript",
"punctuation.definition.comment.javascript",
"comment.block.css",
"punctuation.definition.comment.css"
],
"settings": { "foreground": "#9AA0A6" }
}
]
},
"[Default Light+]": {
"comments": "#80868B",
"textMateRules": [
{
"scope": [
"comment",
"comment.block",
"comment.block.documentation",
"punctuation.definition.comment",
"comment.block.html",
"punctuation.definition.comment.html",
"comment.block.vue",
"punctuation.definition.comment.vue",
"comment.block.vue-html",
"punctuation.definition.comment.vue-html",
"comment.block.xml",
"punctuation.definition.comment.xml",
"comment.block.js",
"comment.line.double-slash.js",
"punctuation.definition.comment.js",
"comment.block.javascript",
"comment.line.double-slash.javascript",
"punctuation.definition.comment.javascript",
"comment.block.css",
"punctuation.definition.comment.css"
],
"settings": { "foreground": "#80868B" }
}
]
},
"[Cursor Dark]": {
"comments": "#9AA0A6",
"textMateRules": [
{
"scope": [
"comment",
"comment.block",
"comment.block.documentation",
"punctuation.definition.comment",
"comment.block.html",
"punctuation.definition.comment.html",
"comment.block.vue",
"punctuation.definition.comment.vue",
"comment.block.vue-html",
"punctuation.definition.comment.vue-html",
"comment.block.xml",
"punctuation.definition.comment.xml",
"comment.block.js",
"comment.line.double-slash.js",
"punctuation.definition.comment.js",
"comment.block.javascript",
"comment.line.double-slash.javascript",
"punctuation.definition.comment.javascript",
"comment.block.css",
"punctuation.definition.comment.css"
],
"settings": { "foreground": "#9AA0A6" }
}
]
},
"[Cursor Light]": {
"comments": "#80868B",
"textMateRules": [
{
"scope": [
"comment",
"comment.block",
"comment.block.documentation",
"punctuation.definition.comment",
"comment.block.html",
"punctuation.definition.comment.html",
"comment.block.vue",
"punctuation.definition.comment.vue",
"comment.block.vue-html",
"punctuation.definition.comment.vue-html",
"comment.block.xml",
"punctuation.definition.comment.xml",
"comment.block.js",
"comment.line.double-slash.js",
"punctuation.definition.comment.js",
"comment.block.javascript",
"comment.line.double-slash.javascript",
"punctuation.definition.comment.javascript",
"comment.block.css",
"punctuation.definition.comment.css"
],
"settings": { "foreground": "#80868B" }
}
]
}
},
"editor.semanticTokenColorCustomizations": {
"enabled": false
}
}
......@@ -16,8 +16,8 @@ const {
// request.js
// 通常可以吧 baseUrl 单独放在一个 js 文件了
// const baseUrl = "http://172.16.230.108:7777/pmall";
// const baseUrl = "https://momclub-uat.feihe.com/pmall";//测试环境
let baseUrl = "https://momclub.feihe.com/pmall";//生产环境
const baseUrl = "https://momclub-uat.feihe.com/pmall";//测试环境
// let baseUrl = "https://momclub.feihe.com/pmall";//生产环境
// const baseUrl = "https://docs.dui88.com/mock/1956/api";//mock
// const baseUrl = "https://feihe.m.duibatest.com.cn/pmall"
......
......@@ -62,13 +62,13 @@ const sensorLog = (evt) => {
trackObj[key] = logObj[key];
}
if (xcxPage && xcxPage.length > 0) {
console.warn("xcxPage", trackObj);
// console.warn("xcxPage", trackObj);
sensors.track("xcxPage", {
...trackObj,
});
}
if (xcxClick && xcxClick.length > 0) {
console.warn("xcxClick", trackObj);
// console.warn("xcxClick", trackObj);
sensors.track("xcxClick", {
...trackObj,
});
......@@ -91,10 +91,56 @@ const sensorLogTake = (logObj) => {
};
sensorLog(evt);
};
const sensorComponentLog = (evt) => {
const _dataset = evt.currentTarget.dataset;
const logObj = _dataset.comlog;
if (!logObj) {
return;
}
const { xcxComponentExposure, xcxComponentClick } = logObj;
let trackObj = {};
for (let key in logObj) {
trackObj[key] = logObj[key];
}
if (xcxComponentExposure && xcxComponentExposure.length > 0) {
console.warn("-----xcxComponentExposure-----", trackObj);
sensors.track("xcxComponentExposure", {
...trackObj,
});
}
if (xcxComponentClick && xcxComponentClick.length > 0) {
console.warn("-----xcxComponentClick-----", trackObj);
sensors.track("xcxComponentClick", {
...trackObj,
});
}
};
/**
* 主动通过配置数据触发埋点
* @param {*} evt
*/
const sensorComponentLogTake = (logObj) => {
if (!logObj) {
return;
}
const evt = {
currentTarget: {
dataset: {
comlog: logObj,
},
},
};
sensorComponentLog(evt);
};
export default {
init,
sensors,
login,
sensorLog,
sensorLogTake,
sensorComponentLog,
sensorComponentLogTake,
};
......@@ -33,17 +33,6 @@
"jtIcon": "homepage/tool_jt.png",
"subtitle": "更多妈妈都在用,告别手忙脚乱,助你轻松带娃!",
"tools": [
{
"icon": "homepage/tool_icon_1.png",
"link": {
"extra": {},
"type": 1,
"url": "/pages/naming/naming"
},
"context": "AI生成吉利好名",
"type": 1,
"title": "AI起名"
},
{
"icon": "homepage/tool_icon_2.png",
"link": {
......@@ -114,13 +103,28 @@
"type": 1,
"url": "/pages/syWebview/syWebview?p=xmh09"
},
"title":"北纬47°鲜活溯源之旅",
"type": 1,
"url": "homepage/homeSwiper/V1/7.jpg"
},
{
"videoUrl": "homepage/homeSwiper/V1/2.m4v",
"link": {},
"title":"成为妈妈更懂妈妈",
"url": "homepage/homeSwiper/V1/2.png"
},
{
"img": "homepage/homeSwiper/V1/28会员日.jpg",
"title":"28会员日",
"link": {
"extra": {
"envVersion": "release",
"appId": "wx4205ec55b793245e"
},
"type": 2,
"url": "/subPackages/shopMainList/topicNew/index?id=1001087"
},
"url": "homepage/homeSwiper/V1/28会员日.jpg"
}
],
"childrenInfoList": [
......
......@@ -58,8 +58,13 @@ class ExposureTracker {
const isVisible = this.isElementInViewport(res, scrollTop);
if (isVisible && !value.isExposed) {
value.isExposed = true;
// 触发埋点
md.sensorLogTake(value.logParams);
if(value.logParams.xcxComponentExposure){
md.sensorComponentLogTake(value.logParams);
}else{
md.sensorLogTake(value.logParams);
}
}
});
});
......
......@@ -58,7 +58,7 @@
<swiper-item v-for="(item, index) in toolList.tools" :key="index"
:class="['swiperItem', { 'active': currentIndex === index }]">
<view class="tool">
<button v-if="homeStore && !homeStore.isLogin && index>0" open-type="getPhoneNumber"
<button v-if="homeStore && !homeStore.isLogin && index > 0" open-type="getPhoneNumber"
@getphonenumber="onGetPhoneNumber" class="sq_btn"></button>
<image class="tool_bg" :src="$baseUrl + item.icon" @tap="handleToolClick(item)">
</image>
......@@ -80,7 +80,7 @@
<!--推荐工具-->
<!--专家团-->
<view class="et_box">
<view class="et_box" id="expertTeam">
<view class="et_maintitle">{{ expertTeam.maintitle }}</view>
<view :data-log="{
xcxClick: '首页-二屏页面点击',
......@@ -88,7 +88,8 @@
buttonName: '专家团副标题点击'
}" class="et_subtitle">
<view class="txtlink" @tap="showPopup1(1, 1)">星妈会医生在线答疑群,为孩子成长保驾护航</view>
<image class="icon_more" @tap="showPopup1(1, 2)" :src="$baseUrl + 'homepage/et_more.png'"></image>
<image id="et_joingroup" class="icon_more" @tap="showPopup1(1, 2)"
:src="$baseUrl + 'homepage/et_more.png'"></image>
</view>
<view class="et_main_box">
<view class="et_con_bg">
......@@ -126,7 +127,7 @@
<image class="et_con3" v-if="etTabSelIndex == 2" :src="$baseUrl + expertTeam.etConUrl3">
</image>
</view>
<view class="et_more_txt" @tap="onETMore(2, etTabSelIndex)">
<view id="et_more" class="et_more_txt" @tap="onETMore(2, etTabSelIndex)">
<text class="txtlink">点击查看更多</text>
<image class="icon_arrow_yellow" :src="$baseUrl + 'homepage/icon_arrow_yellow.png'"></image>
</view>
......@@ -175,23 +176,35 @@
</view> -->
<view class="channelbox">
<view id="childrenInfoList" class="channelbox">
<text class="maintitle">{{ childrenInfoListMianTitle }}</text>
<view class="subtitle_box">
<text class="subtitle">从专业到实用,一站式解决你的育儿难题</text>
<image class="icon_more" :src="$baseUrl + 'homepage/home_more_btn_v2.png'" :data-log="{
xcxClick: '首页-三屏页面点击',
pageName: '首页-三屏',
buttonName: `次位内容资源位-查看更多文字`
}" @tap="jumpLink(suggest.link, false, false, $event)"></image>
<image id="childrenInfoListMore" class="icon_more" :src="$baseUrl + 'homepage/home_more_btn_v2.png'"
:data-log="{
xcxClick: '首页-三屏页面点击',
pageName: '首页-三屏',
buttonName: `次位内容资源位-查看更多文字`
}" :data-comlog="{
xcxComponentClick: 'true',
pageName: '首页',
componentName: '育儿智库',
componentContent: '育儿智库-more'
}" @tap="jumpLink(suggest.link, false, false, $event)"></image>
</view>
<view class="channelscroll">
<view class="box">
<view class="infobox" :key="index" v-for="(infoItem, index) in childrenInfoList" :data-log="{
xcxClick: '首页-三屏页面点击',
pageName: '首页-三屏',
buttonName: `次位内容资源位-轮播-${index + 1}`
}" @tap="jumpLink(infoItem.link, false, false, $event)">
<view class="infobox" :key="index" :id="'childrenInfoList' + index"
v-for="(infoItem, index) in childrenInfoList" :data-log="{
xcxClick: '首页-三屏页面点击',
pageName: '首页-三屏',
buttonName: `次位内容资源位-轮播-${index + 1}`
}" :data-comlog="{
xcxComponentClick: 'true',
pageName: '首页',
componentName: '育儿智库',
componentContent: infoItem.desc
}" @tap="jumpLink(infoItem.link, false, false, $event)">
<image class="infoimg" :src="$baseUrl + infoItem.bgUrl"></image>
<view class="infotitlebox">
<view class="infotitlecon">
......@@ -261,10 +274,16 @@
<view id="fourthScreen" class="bottomlink">
<image class="bottombg" :src="$baseUrl + 'homepage/bottombg.png'"></image>
<view class="box">
<image class="icon" v-for="(icon, index) in bottomLinkList" :key="index" :data-log="{
<image class="icon" :id="'bottomLink' + index" v-for="(icon, index) in bottomLinkList" :key="index" :data-log="{
xcxClick: '首页-四屏页面点击',
pageName: '首页-四屏',
buttonName: `${qrNameList[index]}`
}" :data-comlog="{
xcxComponentClick: 'true',
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '跳转工具',
componentContent: `${qrNameList[index]}`
}" :src="$baseUrl + icon.bgUrl" :style="icon._style" @tap="showPopup(index, $event)"></image>
</view>
</view>
......@@ -532,7 +551,96 @@ export default {
} else {
this.vipCardList[0] = data.vipConfigList[0];
}
//拿到数据之后,初始化曝光一些节点
this.initExposure();
}
},
initExposure() {
const componentContent = this.toolList.tools?.[this.currentIndex]?.title || '';
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "首页",
componentName: "工具推荐",
componentContent: componentContent
});
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "首页",
componentName: "焦点图",
componentContent: this.swiperList[0]?.title || ''
});
const childrenInfoList = this.childrenInfoList;
childrenInfoList.forEach((item, index) => {
this.exposureTracker.addExposureElement({
id: 'childrenInfoList' + index,
logParams: {
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '育儿智库',
componentContent: item.desc
}
});
});
this.qrNameList.forEach((item, index) => {
this.exposureTracker.addExposureElement({
id: 'bottomLink' + index,
logParams: {
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '跳转工具',
componentContent: `${item}`
}
});
});
//动态添加专家团的首屏数据
this.exposureTracker.addExposureElements([{
id: 'expertTeam',
logParams: {
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '专家团',
componentContent: '专家团tab切换-名医专家'
}
},
{
id: 'et_joingroup',
logParams: {
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '专家团',
componentContent: '专家团-进群咨询'
}
}, {
id: 'et_more',
logParams: {
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '专家团',
componentContent: '专家团-查看更多'
}
}, {
id: 'childrenInfoList',
logParams: {
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '育儿智库',
componentContent: '育儿智库'
}
},
{
id: 'childrenInfoListMore',
logParams: {
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '育儿智库',
componentContent: '育儿智库-more'
}
}
]);
},
changeIndicatorDots(e) {
this.indicatorDots = !this.indicatorDots
......@@ -597,6 +705,10 @@ export default {
jumpLink(link, videoUrl, index, evt) {
if (evt) {
md.sensorLog(evt);
if(evt.currentTarget.dataset.comlog)
{
md.sensorComponentLog(evt);
}
}
if (videoUrl) {
if (videoUrl.indexOf('http') === -1) {
......@@ -629,6 +741,9 @@ export default {
showPopup(_index, evt) {
if (evt) {
md.sensorLog(evt);
if (evt.currentTarget.dataset.comlog) {
md.sensorComponentLog(evt);
}
}
md.sensorLogTake({
xcxPage: `${this.qrNameList[_index]}拉起半屏二维码入口页面浏览`,
......@@ -650,7 +765,14 @@ export default {
pageName: `首页-二屏`,
buttonName: type == 1 ? '专家团副标题点击' : '专家团进群咨询按钮点击'
});
if (type == 2) {
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "首页",
componentName: "专家团",
componentContent: '专家团-进群咨询'
});
}
if (_index === 3) {
this.qrObj = null;
} else {
......@@ -754,10 +876,23 @@ export default {
onSwiperChange(e) {
this.currentIndex = e.detail.current;
const componentContent = this.toolList.tools?.[this.currentIndex]?.title || '';
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "首页",
componentName: "工具推荐",
componentContent: componentContent
});
},
onBannerSwiperChange(e) {
this.bannerCurrentIndex = e.detail.current;
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "首页",
componentName: "焦点图",
componentContent: this.swiperList[e.detail.current].title
});
},
async handleToolClick(item) {
......@@ -766,6 +901,12 @@ export default {
pageName: "首页-二屏",
buttonName: item.title + "工具点击",
});
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "首页",
componentName: "工具推荐",
componentContent: item.title
});
if (item.title === "医生问诊") {
// if (!cfgStatus.value.isRegister) return;
......@@ -817,6 +958,14 @@ export default {
pageName: "首页-二屏",
buttonName: str + "tab按钮点击",
});
md.sensorComponentLogTake({
xcxComponentClick: "true",
xcxComponentExposure: "true",
pageName: "首页",
componentName: "专家团",
componentContent: '专家团tab切换-' + str
});
this.etTabSelIndex = index;
},
onETMore(index, type) {
......@@ -838,6 +987,12 @@ export default {
pageName: "首页-二屏",
buttonName: str + "-点击",
});
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "首页",
componentName: "专家团",
componentContent: str
});
jump({
type: 1,
url: '/pages/expertTeamPage/expertTeamPage?tab=' + (this.etTabSelIndex + 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment