Commit 30d2fa05 by 李嘉林

行为收集加参数

parent 06ef6380
...@@ -8,13 +8,18 @@ import { themeColor, checkShowConditionIds, getStoreInfo, setStoreInfo } from "@ ...@@ -8,13 +8,18 @@ import { themeColor, checkShowConditionIds, getStoreInfo, setStoreInfo } from "@
import { query_isEntry } from "@/utils/mayi_fenxiao"; import { query_isEntry } from "@/utils/mayi_fenxiao";
export default { export default {
data() {
return {
extConfig: {},
}
},
async created() { async created() {
wx.setStorageSync("firstView", 1); wx.setStorageSync("firstView", 1);
console.log(new Date().getTime(),'load-----app-created') console.log(new Date().getTime(),'load-----app-created')
// NODE_ENV // NODE_ENV
let extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}; this.extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {};
console.log(extConfig, "-----------extConfig"); console.log(this.extConfig, "-----------this.extConfig");
if (JSON.stringify(extConfig) == "{}") { if (JSON.stringify(this.extConfig) == "{}") {
let shopItem = { let shopItem = {
// development: { mixid: "IR8rkL", "shopid": 3813}, //道可测试1 // development: { mixid: "IR8rkL", "shopid": 3813}, //道可测试1
// development: { mixid: "iLntd3", "shopid": 3814}, //道可测试2 // development: { mixid: "iLntd3", "shopid": 3814}, //道可测试2
...@@ -36,19 +41,26 @@ export default { ...@@ -36,19 +41,26 @@ export default {
// production: { "mixid":"5BkDRR", "shopid": 1316 }, // lost in echo订货 // production: { "mixid":"5BkDRR", "shopid": 1316 }, // lost in echo订货
// production: { "mixid":"CYNZ", "shopid": 1609 }, // 晨语女装 // production: { "mixid":"CYNZ", "shopid": 1609 }, // 晨语女装
xhyx_uat: { "mixid":"xhyxshop", "shopid": 1 }, xhyx_uat: { "mixid":"xhyxshop", "shopid": 1 },
xhyx_beta: { "mixid":"xhyxshop", "shopid": 1 }, xhyx_beta: { "mixid":"xhyxshop", "shopid": 1, "groupId": 1 },
xhyx_prod: { "mixid":"xhyxshop", "shopid": 1 }, xhyx_prod: { "mixid":"xhyxshop", "shopid": 1, "groupId": 1 },
wly_prod: { "mixid":"WLYSWT", "shopid": 2 }, wly_prod: { "mixid":"WLYSWT", "shopid": 2 },
ylkj_uat: { "mixid":"YLKJ", "shopid": 8 } ylkj_uat: { "mixid":"YLKJ", "shopid": 8 }
} }
extConfig = shopItem[process.env.NODE_ENV]; this.extConfig = shopItem[process.env.NODE_ENV];
wx.setStorageSync("extConfig", JSON.stringify(extConfig)); wx.setStorageSync("this.extConfig", JSON.stringify(this.extConfig));
} }
// 行为收集初始化
this.$mpBehavior.init("mayi-moblie-shop-mp", this.extConfig.shopid, {
mode: process.env.NODE_ENV,
gid: this.extConfig.groupId,
mixid: this.extConfig.mixid,
host: process.env.MANALYTICS_HOST+'?',
})
console.log("1444444444", extConfig); console.log("1444444444", this.extConfig);
this.$store.commit("setExtConfig", extConfig.mixid); this.$store.commit("setExtConfig", this.extConfig.mixid);
this.$store.commit('setExtConfigInfo', extConfig) this.$store.commit('setExtConfigInfo', this.extConfig)
// 调用API从本地缓存中获取数据 // 调用API从本地缓存中获取数据
/* /*
* 平台 api 差异的处理方式: api 方法统一挂载到 mpvue 名称空间, 平台判断通过 mpvuePlatform 特征字符串 * 平台 api 差异的处理方式: api 方法统一挂载到 mpvue 名称空间, 平台判断通过 mpvuePlatform 特征字符串
...@@ -72,12 +84,10 @@ export default { ...@@ -72,12 +84,10 @@ export default {
mpvue.setStorageSync("logs", logs); mpvue.setStorageSync("logs", logs);
} }
// 初始 // 初始
await this.getShopInfo(extConfig); await this.getShopInfo(this.extConfig);
// 页面配置信息 // 页面配置信息
// this.getThemePage(extConfig); // this.getThemePage(this.extConfig);
let mpApp = getApp(); let mpApp = getApp();
console.log(mpApp, "this.mpApp"); console.log(mpApp, "this.mpApp");
mpApp.getShopInfo = this.getShopInfo mpApp.getShopInfo = this.getShopInfo
...@@ -116,6 +126,24 @@ export default { ...@@ -116,6 +126,24 @@ export default {
} }
console.log('app-mounted-结束') console.log('app-mounted-结束')
}, },
onLaunch(option) {
console.log('app-onLaunch-option', option, option.scene);
this.$mpBehavior.trackEvent('miniponlaunch', {
utm_matching_type: JSON.stringify({
type: 'wxminip',
launchOptions: option,
})
})
},
onShow(option) {
console.log('app-onShow-option', option);
this.$mpBehavior.trackEvent('miniponshow', {
utm_matching_type: JSON.stringify({
type: 'wxminip',
launchOptions: option,
})
})
},
methods: { methods: {
async setVisible(pageList, cb) { async setVisible(pageList, cb) {
// 首页显示条件 // 首页显示条件
...@@ -226,15 +254,7 @@ export default { ...@@ -226,15 +254,7 @@ export default {
async getShopInfo({ mixid }) { async getShopInfo({ mixid }) {
await shop.getShopInfo({ shopMixId: mixid }).then((res) => { await shop.getShopInfo({ shopMixId: mixid }).then((res) => {
console.log("--app---getShopInfo") console.log("--app---getShopInfo")
console.log(process.env.MANALYTICS_HOST,'-process.env.MANALYTICS_HOST')
if (res.data.code == 200) { if (res.data.code == 200) {
// 收集用户数据
this.$mpBehavior.init("mayi-moblie-shop-mp", res.data.data.id, {
mode: process.env.NODE_ENV,
gid: res.data.data.groupId,
mixid: mixid,
host: process.env.MANALYTICS_HOST+'?',
})
let mpApp = getApp(); let mpApp = getApp();
// 商城基本数据 // 商城基本数据
......
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