-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
📦 feat: 新增性能跟踪功能 #3
Labels
enhancement
New feature or request
Comments
对应的一个配置文件 {"aegis_env":"prod"} 没错,就这么短 |
回顾发现写错咯。。。。。我服了 <script src="https://tam.cdn-go.cn/aegis-sdk/latest/aegis.f.min.js" crossorigin="anonymous"></script>
<script>let VisitorID=localStorage.getItem('VisitorID');if(!VisitorID){VisitorID=(function(){const array=new Uint32Array(3);window.crypto.getRandomValues(array);return array.join('').slice(0,10)})();localStorage.setItem('VisitorID',VisitorID);console.log("UIN:",VisitorID)}else{console.log("UIN:",VisitorID)}const AegisENVs=Object.freeze({prod:'production',dev:'development',gray:'gray',pre:'pre',daily:'daily',local:'local',test:'test',others:'others'});let env=AegisENVs.prod;fetch('/config.json').then(res=>res.json()).then(config=>{env=AegisENVs[config.aegis_env]||AegisENVs.prod}).catch(error=>{console.error('获取上报环境失败:',error);env=AegisENVs.dev});</script>
<!-- Aegis Init-->
<script>
if (typeof Aegis === 'function') {
var aegis = new Aegis({
// Env
id: 'mZxy9hL2PY1GozZLD9',
uin: VisitorID,
env: env,
hostUrl: 'https://rumt-zh.com',
// Speed Report
reportApiSpeed: true,
pagePerformance: true,
reportAssetSpeed: true,
speedSample: false,
// Error Report
onError: true,
// SPA Set
spa: true,
// API
api: {
// Report
apiDetail: true,
reportRequest: true,
websocketHack: true,
usePerformanceTiming: true,
// Trace Header
// injectTraceHeader: 'traceparent',
// Header Report
// reqHeaders: ['traceparent'],
resHeaders: ['content-type', 'server'],
// Ignore URL
// injectTraceIgnoreUrls: ['/gstatic.com/', '/bilibili.com/'],
// RC Report
// retCodeHandler(data, url, xhr) {
// }
}
});
}
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
此代码应插入在
<head>
标签的首部以获取相对准确的数据📦 feat: 新增性能跟踪功能
以下代码需插入主页面内
The text was updated successfully, but these errors were encountered: