tencent cloud

Installation and Initialization
最終更新日:2024-01-22 19:25:42
Installation and Initialization
最終更新日: 2024-01-22 19:25:42
You can install the SDK through CDN or npm.

Installing and Initializing SDK Through CDN

1. Import the following code to the <head></head> tags on the HTML page:
<script src="https://cdn-go.cn/aegis/aegis-sdk/latest/aegis.min.js"></script>
As CDN uses the h3-Q050 protocol, cache-control is set to max-age=666 by default. If you need to modify cache-control, add the max_age parameter. For example:
<script src="https://cdn-go.cn/aegis/aegis-sdk/latest/aegis.min.js?max_age=3600"></script>
2. Create an Aegis instance and pass in the corresponding configuration in the following steps to initialize the SDK:
const aegis = new Aegis({
id: 'pGUVFTCZyewhxxxxxx', // Application ID, that is, reported ID
uin: 'xxx', // User UIN (optional)
reportApiSpeed: true, // API speed test
reportAssetSpeed: true, // Static resource speed test
spa: true // Enable PV calculation during SPA application page redirect
});

Installing and Initializing SDK Through npm

1. Run the following command to install aegis-web-sdk in your npm repository:
$ npm install --save aegis-web-sdk
2. Create an Aegis instance and pass in the corresponding configuration in the following steps to initialize the SDK:
import Aegis from 'aegis-web-sdk';

const aegis = new Aegis({
id: 'pGUVFTCZyewhxxxxxx', // Application ID, that is, reported ID
uin: 'xxx', // User UIN (optional)
reportApiSpeed: true, // API speed test
reportAssetSpeed: true, // Static resource speed test
spa: true // Enable PV calculation during SPA application page redirect
})
Note:
To avoid missing any data, you should initialize the SDK as early as possible. After you install and initialize the SDK, you can use the following RUM features:
Error monitoring: Monitoring of JavaScript execution errors, Promise errors, Ajax request exceptions, resource loading failures, and return code exceptions, PV reporting, and allowlist detection.
Speed test features: Speed tests for page performance, APIs, and static resources.
Statistics collection and analysis: You can analyze data in multiple dimensions in Data Overview.
Note:
aegis-sdk uses https://aegis.qq.com as the domain name to be reported by default. You can use the hostUrl parameter to configure the domain name to be reported. For regions in the Chinese mainland, you can choose https://tamaegis.com as the domain name to be reported. For Singapore region, you can choose https://rumt-sg.com as the domain name to be reported.
この記事はお役に立ちましたか?
営業担当者に お問い合わせ いただくか チケットを提出 してサポートを求めることができます。
はい
いいえ

フィードバック