2024年08月02日 建站教程
PV日志埋点参数包含应用开发管理平台appId、应用开发管理平台应用名称、经度、纬度和用户类型。
1、先根据ZWJSBridge.getLocation获取经纬度
ZWJSBridge.onReady(() => {
console.log("初始化完成后,执行bridge方法");
});
ZWJSBridge.getLocation().then((result) => {
console.log('获取经纬度', result);
this.latitudeStr = result.latitude;
this.longitudeStr = result.longitude;
}).catch((error) => {
console.log(error);
});
2、根据ZWJSBridge.getUserType获取用户类型
ZWJSBridge.getUserType().then((result) => {
console.log('用户类型', result);
if(result.userType==0 || result.userType==1){
this.userTypeStr='个人';
}else{
this.userTypeStr='企业';
}
}).catch((error) => {
console.log(error);
});
2、写入埋点
aplus_queue.push({
'action': 'aplus.sendPV',
'arguments': [{
is_auto: false
}, {
// 定义PV参数key-value键值对(只能是这种平铺的json,不能做多层嵌套), 如:
miniAppId: '应用开发管理平台appId',
miniAppName: '应用开发管理平台应用名称',
long: this.longitudeStr,
lati: this.latitudeStr,
userType: this.userTypeStr
}]
});
本文链接:http://so.lmcjl.com/news/9786/