tencent cloud


Installation and Initialization

Last updated: 2022-08-05 18:01:08


    • You can only use npm to install the SDK for mini program.
    • The SDK supports WeChat Mini Program and QQ Mini Program.

    aegis-sdk uses aegis.qq.com as the reporting domain by default. You can also use tamaegis.com as the reporting domain.


    To connect to a mini program in the production environment, you need to add the reporting domain as a secure domain.

    Installing SDK

    Run the following command to install aegis-mp-sdk in your npm repository:

    $ npm install --save aegis-mp-sdk


    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

    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.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support