8040威尼斯
try {
window.CUSTOM_ITRACE_KEY = '__wpkFront'; // 为了与ioses注入的应用区分开
const isProd = 'prod' === 'prod'
const sampleRate = isProd ? 0.1 : 1;
if (Math.random() < sampleRate) { // 采样率10%
window[window.CUSTOM_ITRACE_KEY] = new window.wpkReporter({
bid: isProd ? '1sprjntr-cc2h3jjk' : '7kjqrdzr-9ploi083',
supportBeaconBody: false,
uid: localStorage.getItem('HASH_UID'),
rel: window.GRAY_INJECTOR && window.GRAY_INJECTOR.getAppVersion && window.GRAY_INJECTOR.getAppVersion(), // 前端应用版本
cluster: 'qg',
beforeSend: function (data) {
if (!data) return true;
switch (data.category) { // 上报的数据类型,比如2为api上报,具体需要看源码或者抓包
case 2:
if (data.w_res && data.w_res.indexOf('px-itrace.xuexi.cn') !== -1) { // itrace上报的数据本身不会上传api监控
return false;
}
return true;
default:
return true;
}
},
spa: true
});
window[window.CUSTOM_ITRACE_KEY].installAll();
window[window.CUSTOM_ITRACE_KEY].addPlugin(wpkblankPlugin, {enable:true});
}
} catch(e) {
console.error('init wpkReporter fail', e);
}8040威尼斯