提交 fe3de3af 编写于 作者: M mehaotian 提交者: qiang

fix(stat): 统计1.0 缺失 ak uuid p 等字段

上级 84089119
......@@ -21,9 +21,10 @@ let titleJsons = {};
let debug = !!process.env.UNI_STAT_DEBUG || false;
// #ifdef VUE3
titleJsons = process.env.UNI_STAT_TITLE_JSON;
// #endif
// #ifndef VUE3
// eslint-disable-next-line no-restricted-globals
const pagesTitle = require('uni-pages?{"type":"style"}').default;
let pagesData = pagesTitle.pages;
......@@ -44,39 +45,40 @@ for (let i in pagesData) {
// #endif
// TODO 在云函数中获取,暂时注释
// const UUID_KEY = '__DC_STAT_UUID'
// const UUID_VALUE = '__DC_UUID_VALUE'
// function getUuid() {
// let uuid = ''
// if (get_platform_name() === 'n') {
// try {
// uuid = plus.runtime.getDCloudId()
// } catch (e) {
// uuid = ''
// }
// return uuid
// }
// try {
// uuid = uni.getStorageSync(UUID_KEY)
// } catch (e) {
// uuid = UUID_VALUE
// }
// if (!uuid) {
// uuid = Date.now() + '' + Math.floor(Math.random() * 1e7)
// try {
// uni.setStorageSync(UUID_KEY, uuid)
// } catch (e) {
// uni.setStorageSync(UUID_KEY, UUID_VALUE)
// }
// }
// return uuid
// }
// export const get_uuid = (statData) => {
// // 有可能不存在 deviceId(一般不存在就是出bug了),就自己生成一个
// return sys.deviceId || getUuid()
// }
const UUID_KEY = '__DC_STAT_UUID';
const UUID_VALUE = '__DC_UUID_VALUE';
function getUuid() {
let uuid = '';
if (get_platform_name() === 'n') {
try {
uuid = plus.runtime.getDCloudId();
} catch (e) {
uuid = '';
}
return uuid
}
try {
uuid = uni.getStorageSync(UUID_KEY);
} catch (e) {
uuid = UUID_VALUE;
}
if (!uuid) {
uuid = Date.now() + '' + Math.floor(Math.random() * 1e7);
try {
uni.setStorageSync(UUID_KEY, uuid);
} catch (e) {
uni.setStorageSync(UUID_KEY, UUID_VALUE);
}
}
return uuid
}
const get_uuid = (statData) => {
// 有可能不存在 deviceId(一般不存在就是出bug了),就自己生成一个
return sys.deviceId || getUuid()
};
/**
* 获取配置信息 如 appid
......@@ -561,15 +563,15 @@ const get_first_visit_time = () => {
time = timeStorge;
} else {
time = get_time();
dbSet(FIRST_VISIT_TIME_KEY, time);
dbSet(FIRST_VISIT_TIME_KEY, time);
// 首次访问需要 将最后访问时间置 0
dbRemove(LAST_VISIT_TIME_KEY);
}
return time
};
/**
* 最后访问时间
/**
* 最后访问时间
*/
const get_last_visit_time = () => {
const timeStorge = dbGet(LAST_VISIT_TIME_KEY);
......@@ -600,20 +602,20 @@ const set_page_residence_time = () => {
*/
const get_page_residence_time = () => {
Last_Page_Residence_Time = get_time();
First_Page_Residence_Time = dbGet(PAGE_RESIDENCE_TIME);
First_Page_Residence_Time = dbGet(PAGE_RESIDENCE_TIME);
return Last_Page_Residence_Time - First_Page_Residence_Time
};
/**
* 获取总访问次数
/**
* 获取总访问次数
*/
const TOTAL_VISIT_COUNT = '__total__visit__count';
const TOTAL_VISIT_COUNT = '__total__visit__count';
const get_total_visit_count = () => {
const timeStorge = dbGet(TOTAL_VISIT_COUNT);
let count = 1;
let count = 1;
if (timeStorge) {
count = timeStorge;
count++;
count++;
}
dbSet(TOTAL_VISIT_COUNT, count);
return count
......@@ -621,9 +623,9 @@ const get_total_visit_count = () => {
let Set__First__Time = 0;
let Set__Last__Time = 0;
/**
* 获取第一次时间
/**
* 获取第一次时间
*/
const get_first_time = () => {
let time = new Date().getTime();
......@@ -632,8 +634,8 @@ const get_first_time = () => {
return time
};
/**
* 获取最后一次时间
/**
* 获取最后一次时间
*/
const get_last_time = () => {
let time = new Date().getTime();
......@@ -641,16 +643,16 @@ const get_last_time = () => {
return time
};
/**
* 获取页面 \ 应用停留时间
/**
* 获取页面 \ 应用停留时间
*/
const get_residence_time = (type) => {
let residenceTime = 0;
let residenceTime = 0;
if (Set__First__Time !== 0) {
residenceTime = Set__Last__Time - Set__First__Time;
}
residenceTime = parseInt(residenceTime / 1000);
residenceTime = parseInt(residenceTime / 1000);
residenceTime = residenceTime < 1 ? 1 : residenceTime;
if (type === 'app') {
let overtime = residenceTime > APP_PVER_TIME ? true : false;
......@@ -673,9 +675,9 @@ const get_residence_time = (type) => {
// 统计数据默认值
let statData = {
// uuid: get_uuid(), // 设备标识
// ak: stat_config.appid, // uni-app 应用 Appid
// p: sys.platform === 'android' ? 'a' : 'i', // 手机系统
uuid: get_uuid(), // 设备标识
ak: stat_config.appid, // uni-app 应用 Appid
p: sys.platform === 'android' ? 'a' : 'i', // 手机系统
ut: get_platform_name(), // 平台类型
mpn: get_pack_name(), // 原生平台包名、小程序 appid
usv: STAT_VERSION, // 统计 sdk 版本
......@@ -948,9 +950,9 @@ class Report {
let { url, urlref, urlref_ts } = opt;
this._navigationBarTitle.lt = '11';
let options = {
// ak: this.statData.ak,
// uuid: this.statData.uuid,
// p: this.statData.p,
ak: this.statData.ak,
uuid: this.statData.uuid,
p: this.statData.p,
lt: '11',
ut: this.statData.ut,
url,
......@@ -972,9 +974,9 @@ class Report {
sendHideRequest(opt, type) {
let { urlref, urlref_ts } = opt;
let options = {
// ak: this.statData.ak,
// uuid: this.statData.uuid,
// p: this.statData.p,
ak: this.statData.ak,
uuid: this.statData.uuid,
p: this.statData.p,
lt: '3',
ut: this.statData.ut,
urlref,
......@@ -995,9 +997,9 @@ class Report {
this._navigationBarTitle.config = get_page_name(routepath);
this._navigationBarTitle.lt = '21';
let options = {
// ak: this.statData.ak,
// uuid: this.statData.uuid,
// p: this.statData.p,
ak: this.statData.ak,
uuid: this.statData.uuid,
p: this.statData.p,
lt: '21',
ut: this.statData.ut,
url: routepath,
......@@ -1297,9 +1299,9 @@ class Stat extends Report {
emVal = em.stack;
}
let options = {
// ak: this.statData.ak,
// uuid: this.statData.uuid,
// p: this.statData.p,
ak: this.statData.ak,
uuid: this.statData.uuid,
p: this.statData.p,
lt: '31',
ut: this.statData.ut,
ch: this.statData.ch,
......
......@@ -19,9 +19,10 @@ let titleJsons = {};
let debug = !!process.env.UNI_STAT_DEBUG || false;
// #ifdef VUE3
titleJsons = process.env.UNI_STAT_TITLE_JSON;
// #endif
// #ifndef VUE3
// eslint-disable-next-line no-restricted-globals
const pagesTitle = require('uni-pages?{"type":"style"}').default;
let pagesData = pagesTitle.pages;
......@@ -42,39 +43,40 @@ for (let i in pagesData) {
// #endif
// TODO 在云函数中获取,暂时注释
// const UUID_KEY = '__DC_STAT_UUID'
// const UUID_VALUE = '__DC_UUID_VALUE'
// function getUuid() {
// let uuid = ''
// if (get_platform_name() === 'n') {
// try {
// uuid = plus.runtime.getDCloudId()
// } catch (e) {
// uuid = ''
// }
// return uuid
// }
// try {
// uuid = uni.getStorageSync(UUID_KEY)
// } catch (e) {
// uuid = UUID_VALUE
// }
// if (!uuid) {
// uuid = Date.now() + '' + Math.floor(Math.random() * 1e7)
// try {
// uni.setStorageSync(UUID_KEY, uuid)
// } catch (e) {
// uni.setStorageSync(UUID_KEY, UUID_VALUE)
// }
// }
// return uuid
// }
// export const get_uuid = (statData) => {
// // 有可能不存在 deviceId(一般不存在就是出bug了),就自己生成一个
// return sys.deviceId || getUuid()
// }
const UUID_KEY = '__DC_STAT_UUID';
const UUID_VALUE = '__DC_UUID_VALUE';
function getUuid() {
let uuid = '';
if (get_platform_name() === 'n') {
try {
uuid = plus.runtime.getDCloudId();
} catch (e) {
uuid = '';
}
return uuid
}
try {
uuid = uni.getStorageSync(UUID_KEY);
} catch (e) {
uuid = UUID_VALUE;
}
if (!uuid) {
uuid = Date.now() + '' + Math.floor(Math.random() * 1e7);
try {
uni.setStorageSync(UUID_KEY, uuid);
} catch (e) {
uni.setStorageSync(UUID_KEY, UUID_VALUE);
}
}
return uuid
}
const get_uuid = (statData) => {
// 有可能不存在 deviceId(一般不存在就是出bug了),就自己生成一个
return sys.deviceId || getUuid()
};
/**
* 获取配置信息 如 appid
......@@ -559,15 +561,15 @@ const get_first_visit_time = () => {
time = timeStorge;
} else {
time = get_time();
dbSet(FIRST_VISIT_TIME_KEY, time);
dbSet(FIRST_VISIT_TIME_KEY, time);
// 首次访问需要 将最后访问时间置 0
dbRemove(LAST_VISIT_TIME_KEY);
}
return time
};
/**
* 最后访问时间
/**
* 最后访问时间
*/
const get_last_visit_time = () => {
const timeStorge = dbGet(LAST_VISIT_TIME_KEY);
......@@ -598,20 +600,20 @@ const set_page_residence_time = () => {
*/
const get_page_residence_time = () => {
Last_Page_Residence_Time = get_time();
First_Page_Residence_Time = dbGet(PAGE_RESIDENCE_TIME);
First_Page_Residence_Time = dbGet(PAGE_RESIDENCE_TIME);
return Last_Page_Residence_Time - First_Page_Residence_Time
};
/**
* 获取总访问次数
/**
* 获取总访问次数
*/
const TOTAL_VISIT_COUNT = '__total__visit__count';
const TOTAL_VISIT_COUNT = '__total__visit__count';
const get_total_visit_count = () => {
const timeStorge = dbGet(TOTAL_VISIT_COUNT);
let count = 1;
let count = 1;
if (timeStorge) {
count = timeStorge;
count++;
count++;
}
dbSet(TOTAL_VISIT_COUNT, count);
return count
......@@ -619,9 +621,9 @@ const get_total_visit_count = () => {
let Set__First__Time = 0;
let Set__Last__Time = 0;
/**
* 获取第一次时间
/**
* 获取第一次时间
*/
const get_first_time = () => {
let time = new Date().getTime();
......@@ -630,8 +632,8 @@ const get_first_time = () => {
return time
};
/**
* 获取最后一次时间
/**
* 获取最后一次时间
*/
const get_last_time = () => {
let time = new Date().getTime();
......@@ -639,16 +641,16 @@ const get_last_time = () => {
return time
};
/**
* 获取页面 \ 应用停留时间
/**
* 获取页面 \ 应用停留时间
*/
const get_residence_time = (type) => {
let residenceTime = 0;
let residenceTime = 0;
if (Set__First__Time !== 0) {
residenceTime = Set__Last__Time - Set__First__Time;
}
residenceTime = parseInt(residenceTime / 1000);
residenceTime = parseInt(residenceTime / 1000);
residenceTime = residenceTime < 1 ? 1 : residenceTime;
if (type === 'app') {
let overtime = residenceTime > APP_PVER_TIME ? true : false;
......@@ -671,9 +673,9 @@ const get_residence_time = (type) => {
// 统计数据默认值
let statData = {
// uuid: get_uuid(), // 设备标识
// ak: stat_config.appid, // uni-app 应用 Appid
// p: sys.platform === 'android' ? 'a' : 'i', // 手机系统
uuid: get_uuid(), // 设备标识
ak: stat_config.appid, // uni-app 应用 Appid
p: sys.platform === 'android' ? 'a' : 'i', // 手机系统
ut: get_platform_name(), // 平台类型
mpn: get_pack_name(), // 原生平台包名、小程序 appid
usv: STAT_VERSION, // 统计 sdk 版本
......@@ -946,9 +948,9 @@ class Report {
let { url, urlref, urlref_ts } = opt;
this._navigationBarTitle.lt = '11';
let options = {
// ak: this.statData.ak,
// uuid: this.statData.uuid,
// p: this.statData.p,
ak: this.statData.ak,
uuid: this.statData.uuid,
p: this.statData.p,
lt: '11',
ut: this.statData.ut,
url,
......@@ -970,9 +972,9 @@ class Report {
sendHideRequest(opt, type) {
let { urlref, urlref_ts } = opt;
let options = {
// ak: this.statData.ak,
// uuid: this.statData.uuid,
// p: this.statData.p,
ak: this.statData.ak,
uuid: this.statData.uuid,
p: this.statData.p,
lt: '3',
ut: this.statData.ut,
urlref,
......@@ -993,9 +995,9 @@ class Report {
this._navigationBarTitle.config = get_page_name(routepath);
this._navigationBarTitle.lt = '21';
let options = {
// ak: this.statData.ak,
// uuid: this.statData.uuid,
// p: this.statData.p,
ak: this.statData.ak,
uuid: this.statData.uuid,
p: this.statData.p,
lt: '21',
ut: this.statData.ut,
url: routepath,
......@@ -1295,9 +1297,9 @@ class Stat extends Report {
emVal = em.stack;
}
let options = {
// ak: this.statData.ak,
// uuid: this.statData.uuid,
// p: this.statData.p,
ak: this.statData.ak,
uuid: this.statData.uuid,
p: this.statData.p,
lt: '31',
ut: this.statData.ut,
ch: this.statData.ch,
......
......@@ -21,9 +21,10 @@ let titleJsons = {};
let debug = !!process.env.UNI_STAT_DEBUG || false;
// #ifdef VUE3
titleJsons = process.env.UNI_STAT_TITLE_JSON;
// #endif
// #ifndef VUE3
// eslint-disable-next-line no-restricted-globals
const pagesTitle = require('uni-pages?{"type":"style"}').default;
let pagesData = pagesTitle.pages;
......@@ -44,39 +45,40 @@ for (let i in pagesData) {
// #endif
// TODO 在云函数中获取,暂时注释
// const UUID_KEY = '__DC_STAT_UUID'
// const UUID_VALUE = '__DC_UUID_VALUE'
// function getUuid() {
// let uuid = ''
// if (get_platform_name() === 'n') {
// try {
// uuid = plus.runtime.getDCloudId()
// } catch (e) {
// uuid = ''
// }
// return uuid
// }
// try {
// uuid = uni.getStorageSync(UUID_KEY)
// } catch (e) {
// uuid = UUID_VALUE
// }
// if (!uuid) {
// uuid = Date.now() + '' + Math.floor(Math.random() * 1e7)
// try {
// uni.setStorageSync(UUID_KEY, uuid)
// } catch (e) {
// uni.setStorageSync(UUID_KEY, UUID_VALUE)
// }
// }
// return uuid
// }
// export const get_uuid = (statData) => {
// // 有可能不存在 deviceId(一般不存在就是出bug了),就自己生成一个
// return sys.deviceId || getUuid()
// }
const UUID_KEY = '__DC_STAT_UUID';
const UUID_VALUE = '__DC_UUID_VALUE';
function getUuid() {
let uuid = '';
if (get_platform_name() === 'n') {
try {
uuid = plus.runtime.getDCloudId();
} catch (e) {
uuid = '';
}
return uuid
}
try {
uuid = uni.getStorageSync(UUID_KEY);
} catch (e) {
uuid = UUID_VALUE;
}
if (!uuid) {
uuid = Date.now() + '' + Math.floor(Math.random() * 1e7);
try {
uni.setStorageSync(UUID_KEY, uuid);
} catch (e) {
uni.setStorageSync(UUID_KEY, UUID_VALUE);
}
}
return uuid
}
const get_uuid = (statData) => {
// 有可能不存在 deviceId(一般不存在就是出bug了),就自己生成一个
return sys.deviceId || getUuid()
};
/**
* 获取配置信息 如 appid
......@@ -529,15 +531,15 @@ const get_first_visit_time = () => {
time = timeStorge;
} else {
time = get_time();
dbSet(FIRST_VISIT_TIME_KEY, time);
dbSet(FIRST_VISIT_TIME_KEY, time);
// 首次访问需要 将最后访问时间置 0
dbRemove(LAST_VISIT_TIME_KEY);
}
return time
};
/**
* 最后访问时间
/**
* 最后访问时间
*/
const get_last_visit_time = () => {
const timeStorge = dbGet(LAST_VISIT_TIME_KEY);
......@@ -568,20 +570,20 @@ const set_page_residence_time = () => {
*/
const get_page_residence_time = () => {
Last_Page_Residence_Time = get_time();
First_Page_Residence_Time = dbGet(PAGE_RESIDENCE_TIME);
First_Page_Residence_Time = dbGet(PAGE_RESIDENCE_TIME);
return Last_Page_Residence_Time - First_Page_Residence_Time
};
/**
* 获取总访问次数
/**
* 获取总访问次数
*/
const TOTAL_VISIT_COUNT = '__total__visit__count';
const TOTAL_VISIT_COUNT = '__total__visit__count';
const get_total_visit_count = () => {
const timeStorge = dbGet(TOTAL_VISIT_COUNT);
let count = 1;
let count = 1;
if (timeStorge) {
count = timeStorge;
count++;
count++;
}
dbSet(TOTAL_VISIT_COUNT, count);
return count
......@@ -589,9 +591,9 @@ const get_total_visit_count = () => {
let Set__First__Time = 0;
let Set__Last__Time = 0;
/**
* 获取第一次时间
/**
* 获取第一次时间
*/
const get_first_time = () => {
let time = new Date().getTime();
......@@ -600,8 +602,8 @@ const get_first_time = () => {
return time
};
/**
* 获取最后一次时间
/**
* 获取最后一次时间
*/
const get_last_time = () => {
let time = new Date().getTime();
......@@ -609,16 +611,16 @@ const get_last_time = () => {
return time
};
/**
* 获取页面 \ 应用停留时间
/**
* 获取页面 \ 应用停留时间
*/
const get_residence_time = (type) => {
let residenceTime = 0;
let residenceTime = 0;
if (Set__First__Time !== 0) {
residenceTime = Set__Last__Time - Set__First__Time;
}
residenceTime = parseInt(residenceTime / 1000);
residenceTime = parseInt(residenceTime / 1000);
residenceTime = residenceTime < 1 ? 1 : residenceTime;
if (type === 'app') {
let overtime = residenceTime > APP_PVER_TIME ? true : false;
......@@ -641,9 +643,9 @@ const get_residence_time = (type) => {
// 统计数据默认值
let statData = {
// uuid: get_uuid(), // 设备标识
// ak: stat_config.appid, // uni-app 应用 Appid
// p: sys.platform === 'android' ? 'a' : 'i', // 手机系统
uuid: get_uuid(), // 设备标识
ak: stat_config.appid, // uni-app 应用 Appid
p: sys.platform === 'android' ? 'a' : 'i', // 手机系统
ut: get_platform_name(), // 平台类型
mpn: get_pack_name(), // 原生平台包名、小程序 appid
usv: STAT_VERSION, // 统计 sdk 版本
......@@ -916,9 +918,9 @@ class Report {
let { url, urlref, urlref_ts } = opt;
this._navigationBarTitle.lt = '11';
let options = {
// ak: this.statData.ak,
// uuid: this.statData.uuid,
// p: this.statData.p,
ak: this.statData.ak,
uuid: this.statData.uuid,
p: this.statData.p,
lt: '11',
ut: this.statData.ut,
url,
......@@ -940,9 +942,9 @@ class Report {
sendHideRequest(opt, type) {
let { urlref, urlref_ts } = opt;
let options = {
// ak: this.statData.ak,
// uuid: this.statData.uuid,
// p: this.statData.p,
ak: this.statData.ak,
uuid: this.statData.uuid,
p: this.statData.p,
lt: '3',
ut: this.statData.ut,
urlref,
......@@ -963,9 +965,9 @@ class Report {
this._navigationBarTitle.config = get_page_name(routepath);
this._navigationBarTitle.lt = '21';
let options = {
// ak: this.statData.ak,
// uuid: this.statData.uuid,
// p: this.statData.p,
ak: this.statData.ak,
uuid: this.statData.uuid,
p: this.statData.p,
lt: '21',
ut: this.statData.ut,
url: routepath,
......@@ -1253,9 +1255,9 @@ class Stat extends Report {
emVal = em.stack;
}
let options = {
// ak: this.statData.ak,
// uuid: this.statData.uuid,
// p: this.statData.p,
ak: this.statData.ak,
uuid: this.statData.uuid,
p: this.statData.p,
lt: '31',
ut: this.statData.ut,
ch: this.statData.ch,
......
......@@ -19,9 +19,10 @@ let titleJsons = {};
let debug = !!process.env.UNI_STAT_DEBUG || false;
// #ifdef VUE3
titleJsons = process.env.UNI_STAT_TITLE_JSON;
// #endif
// #ifndef VUE3
// eslint-disable-next-line no-restricted-globals
const pagesTitle = require('uni-pages?{"type":"style"}').default;
let pagesData = pagesTitle.pages;
......@@ -42,39 +43,40 @@ for (let i in pagesData) {
// #endif
// TODO 在云函数中获取,暂时注释
// const UUID_KEY = '__DC_STAT_UUID'
// const UUID_VALUE = '__DC_UUID_VALUE'
// function getUuid() {
// let uuid = ''
// if (get_platform_name() === 'n') {
// try {
// uuid = plus.runtime.getDCloudId()
// } catch (e) {
// uuid = ''
// }
// return uuid
// }
// try {
// uuid = uni.getStorageSync(UUID_KEY)
// } catch (e) {
// uuid = UUID_VALUE
// }
// if (!uuid) {
// uuid = Date.now() + '' + Math.floor(Math.random() * 1e7)
// try {
// uni.setStorageSync(UUID_KEY, uuid)
// } catch (e) {
// uni.setStorageSync(UUID_KEY, UUID_VALUE)
// }
// }
// return uuid
// }
// export const get_uuid = (statData) => {
// // 有可能不存在 deviceId(一般不存在就是出bug了),就自己生成一个
// return sys.deviceId || getUuid()
// }
const UUID_KEY = '__DC_STAT_UUID';
const UUID_VALUE = '__DC_UUID_VALUE';
function getUuid() {
let uuid = '';
if (get_platform_name() === 'n') {
try {
uuid = plus.runtime.getDCloudId();
} catch (e) {
uuid = '';
}
return uuid
}
try {
uuid = uni.getStorageSync(UUID_KEY);
} catch (e) {
uuid = UUID_VALUE;
}
if (!uuid) {
uuid = Date.now() + '' + Math.floor(Math.random() * 1e7);
try {
uni.setStorageSync(UUID_KEY, uuid);
} catch (e) {
uni.setStorageSync(UUID_KEY, UUID_VALUE);
}
}
return uuid
}
const get_uuid = (statData) => {
// 有可能不存在 deviceId(一般不存在就是出bug了),就自己生成一个
return sys.deviceId || getUuid()
};
/**
* 获取配置信息 如 appid
......@@ -527,15 +529,15 @@ const get_first_visit_time = () => {
time = timeStorge;
} else {
time = get_time();
dbSet(FIRST_VISIT_TIME_KEY, time);
dbSet(FIRST_VISIT_TIME_KEY, time);
// 首次访问需要 将最后访问时间置 0
dbRemove(LAST_VISIT_TIME_KEY);
}
return time
};
/**
* 最后访问时间
/**
* 最后访问时间
*/
const get_last_visit_time = () => {
const timeStorge = dbGet(LAST_VISIT_TIME_KEY);
......@@ -566,20 +568,20 @@ const set_page_residence_time = () => {
*/
const get_page_residence_time = () => {
Last_Page_Residence_Time = get_time();
First_Page_Residence_Time = dbGet(PAGE_RESIDENCE_TIME);
First_Page_Residence_Time = dbGet(PAGE_RESIDENCE_TIME);
return Last_Page_Residence_Time - First_Page_Residence_Time
};
/**
* 获取总访问次数
/**
* 获取总访问次数
*/
const TOTAL_VISIT_COUNT = '__total__visit__count';
const TOTAL_VISIT_COUNT = '__total__visit__count';
const get_total_visit_count = () => {
const timeStorge = dbGet(TOTAL_VISIT_COUNT);
let count = 1;
let count = 1;
if (timeStorge) {
count = timeStorge;
count++;
count++;
}
dbSet(TOTAL_VISIT_COUNT, count);
return count
......@@ -587,9 +589,9 @@ const get_total_visit_count = () => {
let Set__First__Time = 0;
let Set__Last__Time = 0;
/**
* 获取第一次时间
/**
* 获取第一次时间
*/
const get_first_time = () => {
let time = new Date().getTime();
......@@ -598,8 +600,8 @@ const get_first_time = () => {
return time
};
/**
* 获取最后一次时间
/**
* 获取最后一次时间
*/
const get_last_time = () => {
let time = new Date().getTime();
......@@ -607,16 +609,16 @@ const get_last_time = () => {
return time
};
/**
* 获取页面 \ 应用停留时间
/**
* 获取页面 \ 应用停留时间
*/
const get_residence_time = (type) => {
let residenceTime = 0;
let residenceTime = 0;
if (Set__First__Time !== 0) {
residenceTime = Set__Last__Time - Set__First__Time;
}
residenceTime = parseInt(residenceTime / 1000);
residenceTime = parseInt(residenceTime / 1000);
residenceTime = residenceTime < 1 ? 1 : residenceTime;
if (type === 'app') {
let overtime = residenceTime > APP_PVER_TIME ? true : false;
......@@ -639,9 +641,9 @@ const get_residence_time = (type) => {
// 统计数据默认值
let statData = {
// uuid: get_uuid(), // 设备标识
// ak: stat_config.appid, // uni-app 应用 Appid
// p: sys.platform === 'android' ? 'a' : 'i', // 手机系统
uuid: get_uuid(), // 设备标识
ak: stat_config.appid, // uni-app 应用 Appid
p: sys.platform === 'android' ? 'a' : 'i', // 手机系统
ut: get_platform_name(), // 平台类型
mpn: get_pack_name(), // 原生平台包名、小程序 appid
usv: STAT_VERSION, // 统计 sdk 版本
......@@ -914,9 +916,9 @@ class Report {
let { url, urlref, urlref_ts } = opt;
this._navigationBarTitle.lt = '11';
let options = {
// ak: this.statData.ak,
// uuid: this.statData.uuid,
// p: this.statData.p,
ak: this.statData.ak,
uuid: this.statData.uuid,
p: this.statData.p,
lt: '11',
ut: this.statData.ut,
url,
......@@ -938,9 +940,9 @@ class Report {
sendHideRequest(opt, type) {
let { urlref, urlref_ts } = opt;
let options = {
// ak: this.statData.ak,
// uuid: this.statData.uuid,
// p: this.statData.p,
ak: this.statData.ak,
uuid: this.statData.uuid,
p: this.statData.p,
lt: '3',
ut: this.statData.ut,
urlref,
......@@ -961,9 +963,9 @@ class Report {
this._navigationBarTitle.config = get_page_name(routepath);
this._navigationBarTitle.lt = '21';
let options = {
// ak: this.statData.ak,
// uuid: this.statData.uuid,
// p: this.statData.p,
ak: this.statData.ak,
uuid: this.statData.uuid,
p: this.statData.p,
lt: '21',
ut: this.statData.ut,
url: routepath,
......@@ -1251,9 +1253,9 @@ class Stat extends Report {
emVal = em.stack;
}
let options = {
// ak: this.statData.ak,
// uuid: this.statData.uuid,
// p: this.statData.p,
ak: this.statData.ak,
uuid: this.statData.uuid,
p: this.statData.p,
lt: '31',
ut: this.statData.ut,
ch: this.statData.ch,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册