Notes
You can only use npm to install the SDK for mini program.
The SDK supports WeChat Mini Program and QQ Mini Program.
To connect to a mini program in the production environment, you need to add the reporting domain as a secure domain.
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.
Installing SDK
Run the following command to install aegis-mp-sdk
in your npm repository:
$ npm install --save aegis-mp-sdk
Initialization
Create an Aegis instance and pass in the corresponding configuration in the following steps to initialize the SDK:
import Aegis from 'aegis-mp-sdk';
const aegis = new Aegis({
id: "pGUVFTCZyewxxxxx",
uin: 'xxx',
reportApiSpeed: true,
spa: true,
});
Note:
To avoid missing any data, you should initialize the SDK as early as possible. If you use miniprogram-api-promise
to encapsulate the wx.request
request in your mini program project, you should note that Aegis rewrites wx.request
for API monitoring. Therefore, you must initialize Aegis before importing miniprogram-api-promise
; otherwise, Aegis may fail to collect the complete API information.
After you install and initialize the SDK, you can use the following RUM features:
1. Error monitoring: JavaScript execution error monitoring.
2. Speed test: API speed test.
3. Statistics collection and analysis: you can analyze data in multiple dimensions on the Data Overview page in the RUM console.
Was this page helpful?