This commit is contained in:
xuhe@fangjia.com
2018-05-02 10:24:49 +08:00
parent c0f2f7df7f
commit cb85fed823
2 changed files with 43 additions and 4 deletions
+33
View File
@@ -39,3 +39,36 @@ function doSavePageLog(data) {
console.log(error);
});
}
/**
* 记录用户行为日志
*/
function saveBehaviorLog(event,dataMap) {
var page = document.getElementsByTagName("title")[0].innerHTML;
var device = plus.device.uuid;
var model = plus.device.model;
plus.geolocation.getCurrentPosition(function(p){
baidu_city = p.address.city;
baidu_lng = p.coords.longitude;
baidu_lat = p.coords.latitude;
baidu_address = p.address.street;
doSaveBehaviorLog({page:page, lng:baidu_lng, lat:baidu_lat, province:baidu_province, city:baidu_city, region:baidu_region, address:baidu_address, device:device, model:model,event:event,businessData:dataMap});
}, function(e){
doSaveBehaviorLog({page:page, device:device, model:model,event:event,businessData:dataMap});
},
{
provider:'baidu',
enableHighAccuracy:true,
coordsType:'bd09ll'
}
);
}
function doSaveBehaviorLog(data) {
axios.post("/rest/log/saveBehaviorLog", data).then(function (response) {
}).catch(function (error) {
console.log(error);
});
}