Commit 68ea55f1 by 张卓

客流渠道埋点

parent bb856523
......@@ -9,4 +9,10 @@ console.log(process.env,'-----------------config------')
return requestPOST(`${process.env.OLSHOP_URL}/shareSceneRecord/getShareSceneRecord/${options}`, {});
},
}
export default {
//POST /shareSceneRecord/getShareSceneRecord/{sceneCode} 获取分享场景参数记录
addRecord(data) {
return requestPOST(`${process.env.OLSHOP_URL}/scanCodeCustomerRecord/addRecord`, {data});
},
}
\ No newline at end of file
......@@ -48,6 +48,8 @@ export default {
};
},
onLoad(options) {
//清空引客渠道id
wx.setStorageSync('attractingCustomerChannelId','')
Object.assign(this.$data, this.$options.data());
console.log(
options,
......@@ -140,6 +142,20 @@ export default {
if(res.data.code == '200'){
this.page = res.data.data.pageUri;
let paramsObj = JSON.parse(res.data.data.scene);
wx.setStorageSync('attractingCustomerChannelId',paramsObj.attractingCustomerChannelId)
console.log(flag,99999999,wx.getStorageSync('attractingCustomerChannelId'),wx.getStorageSync("openid"))
if(wx.getStorageSync("openid")) {
indexApi.addRecord(
{
attractingCustomersChannelId: paramsObj.attractingCustomerChannelId,
miniOpenId: wx.getStorageSync("openid"),
registerFlag: 1,
newRegisterFlag: 0,
}
).then(ele=>{
alert(ele,9999)
})
}
let params = '';
for(let i in paramsObj){
params += "&"+i+'='+paramsObj[i]
......
......@@ -30,6 +30,7 @@ import { serialize } from "@/utils/index";
import { wx_decode } from "@/utils/wxIndex.js";
import login from "@/api/login";
import shop from "@/api/shop";
import indexApi from "@/api/index.js";
var WXBizDataCrypt = require("@/utils/WXBizDataCrypt");
export default {
components: {
......@@ -148,6 +149,23 @@ export default {
});
});
},
addRecord(flag) {
console.log(flag,99999999,wx.getStorageSync('attractingCustomerChannelId'),this.openid)
//埋点引客渠道
if(wx.getStorageSync('attractingCustomerChannelId')) {
indexApi.addRecord(
{
attractingCustomersChannelId: wx.getStorageSync('attractingCustomerChannelId'),
miniOpenId: this.openid,
registerFlag: 1,
newRegisterFlag: flag?1:0,//1是新注册用户
}
).then(ele=>{
wx.setStorageSync('attractingCustomerChannelId','')
})
}
},
getUserInfo: function(e) {
this.backParams=this.defalutBackParams
wx.showLoading({
......@@ -230,6 +248,7 @@ export default {
this.userInfo = JSON.parse(e.target.rawData);
this.$store.commit('setUserInfo',this.userInfo)
this.addRecord(false);
this.pushPageType();
} else {
var data = wx_decode(
......@@ -258,6 +277,7 @@ export default {
key: "sessionid",
data: res.data.data.sessionId
});
this.addRecord(false)
// 跳转回小程序页面
this.pushPageType();
// wx.reLaunch({
......@@ -268,6 +288,7 @@ export default {
} else {
//不是会员需要绑定手机号
this.isShowPhone = true;
this.addRecord(true)
}
}
})
......@@ -279,7 +300,9 @@ export default {
wx.hideLoading();
//不是会员需要绑定手机号
this.isShowPhone = true;
this.addRecord(true)
}
}
},
// 是否跳转h5或小程序
......
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