Commit 68ea55f1 by 张卓

客流渠道埋点

parent bb856523
...@@ -9,4 +9,10 @@ console.log(process.env,'-----------------config------') ...@@ -9,4 +9,10 @@ console.log(process.env,'-----------------config------')
return requestPOST(`${process.env.OLSHOP_URL}/shareSceneRecord/getShareSceneRecord/${options}`, {}); 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 { ...@@ -48,6 +48,8 @@ export default {
}; };
}, },
onLoad(options) { onLoad(options) {
//清空引客渠道id
wx.setStorageSync('attractingCustomerChannelId','')
Object.assign(this.$data, this.$options.data()); Object.assign(this.$data, this.$options.data());
console.log( console.log(
options, options,
...@@ -140,6 +142,20 @@ export default { ...@@ -140,6 +142,20 @@ export default {
if(res.data.code == '200'){ if(res.data.code == '200'){
this.page = res.data.data.pageUri; this.page = res.data.data.pageUri;
let paramsObj = JSON.parse(res.data.data.scene); 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 = ''; let params = '';
for(let i in paramsObj){ for(let i in paramsObj){
params += "&"+i+'='+paramsObj[i] params += "&"+i+'='+paramsObj[i]
......
...@@ -30,6 +30,7 @@ import { serialize } from "@/utils/index"; ...@@ -30,6 +30,7 @@ import { serialize } from "@/utils/index";
import { wx_decode } from "@/utils/wxIndex.js"; import { wx_decode } from "@/utils/wxIndex.js";
import login from "@/api/login"; import login from "@/api/login";
import shop from "@/api/shop"; import shop from "@/api/shop";
import indexApi from "@/api/index.js";
var WXBizDataCrypt = require("@/utils/WXBizDataCrypt"); var WXBizDataCrypt = require("@/utils/WXBizDataCrypt");
export default { export default {
components: { components: {
...@@ -148,6 +149,23 @@ export default { ...@@ -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) { getUserInfo: function(e) {
this.backParams=this.defalutBackParams this.backParams=this.defalutBackParams
wx.showLoading({ wx.showLoading({
...@@ -230,6 +248,7 @@ export default { ...@@ -230,6 +248,7 @@ export default {
this.userInfo = JSON.parse(e.target.rawData); this.userInfo = JSON.parse(e.target.rawData);
this.$store.commit('setUserInfo',this.userInfo) this.$store.commit('setUserInfo',this.userInfo)
this.addRecord(false);
this.pushPageType(); this.pushPageType();
} else { } else {
var data = wx_decode( var data = wx_decode(
...@@ -258,6 +277,7 @@ export default { ...@@ -258,6 +277,7 @@ export default {
key: "sessionid", key: "sessionid",
data: res.data.data.sessionId data: res.data.data.sessionId
}); });
this.addRecord(false)
// 跳转回小程序页面 // 跳转回小程序页面
this.pushPageType(); this.pushPageType();
// wx.reLaunch({ // wx.reLaunch({
...@@ -268,6 +288,7 @@ export default { ...@@ -268,6 +288,7 @@ export default {
} else { } else {
//不是会员需要绑定手机号 //不是会员需要绑定手机号
this.isShowPhone = true; this.isShowPhone = true;
this.addRecord(true)
} }
} }
}) })
...@@ -279,7 +300,9 @@ export default { ...@@ -279,7 +300,9 @@ export default {
wx.hideLoading(); wx.hideLoading();
//不是会员需要绑定手机号 //不是会员需要绑定手机号
this.isShowPhone = true; this.isShowPhone = true;
this.addRecord(true)
} }
} }
}, },
// 是否跳转h5或小程序 // 是否跳转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