tencent cloud

Real User Monitoring

Product Introduction
Overview
Features
Use Cases
Purchase Guide
Billing Overview
Purchase Methods
Payment Overdue
Getting Started
Operation Guide
Application Connection
Data Overview
Page Performance
Performance Data Analysis
Exception Analysis
Page View
API Monitoring
Static Resource
Custom Speed Test
Custom Event
Application Management
Access Management
Alarm Policy
Connection Guide
Web Use Cases
Mini Program Use Cases
API Documentation
History
Introduction
API Category
Making API Requests
Console APIs
Business System and Project Information APIs
Page Performance APIs
Custom Speed Test APIs
Custom Event APIs
Monitoring APIs
Exception Analysis APIs
Page Visit APIs
Static Resource Monitoring APIs
Log APIs
Page Performance APIs
Data Types
Error Codes
FAQs
Product
Troubleshooting
Usage
Service Protocol
Privacy Policy
Data Processing And Security Agreement
RUM Service Level Agreement
Terminal Performance Monitoring Privacy Policy
Terminal Performance Monitoring Data Processing And Security Agreement

Installation and Initialization

PDF
Focus Mode
Font Size
Last updated: 2024-01-22 19:25:42

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", // Project key
uin: 'xxx', // User UIN (optional)
reportApiSpeed: true, // API speed test
spa: true, // Report the PV during page switch
});
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.

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback