Minigame platforms like WeChat and TikTok run in sandboxed environments where traditional browser-based monitoring scripts cannot be injected. The Real User Monitoring (RUM) minigame SDK for Application Real-Time Monitoring Service (ARMS) provides an npm package designed for these platforms, so you can track performance and errors without modifying the platform runtime.
After integration, the SDK captures performance metrics and detects runtime exceptions for your minigame.
Prerequisites
Before you begin, make sure you have:
An Alibaba Cloud account with ARMS activated
A minigame project that uses npm for dependency management
Access to the domain whitelist settings in your minigame platform's management console
Currently, the agent for minigames can be installed only through an npm package.
Step 1: Create an application in the ARMS console
Log on to the ARMS console.
In the left-side navigation pane, choose . In the navigation bar at the top, select a region.
On the Applications page, click Add Application.
In the Create Application panel, click Minigames.
In the Minigames panel, enter a unique application name and a description, then click Create.
After the application is created, an endpoint and a process ID (pid) are generated automatically. Copy both values for the next step.
Step 2: Install and initialize the SDK
Install the npm package
npm install @arms/rum-minigameInitialize the SDK
Add the following code to the entry file of your minigame. Initialize the SDK as early as possible to capture all errors and performance data from startup.
Replace pid and endpoint in the following code with the pid and endpoint generated in Step 1.
import armsRum from '@arms/rum-minigame';
armsRum.init({
pid: "your app id", // Application ID generated in Step 1
endpoint: "your endpoint", // Reporting endpoint generated in Step 1
// Example endpoint: https://aokcd*****-default-cn.rum.aliyuncs.com
});Step 3: Configure a secure domain name
Minigame platforms require all outbound requests to go through whitelisted domains. Add your ARMS endpoint to the domain name whitelist in your minigame platform's management console. Without this configuration, the SDK cannot report data.
Custom configurations
The RUM SDK for minigames of ARMS provides a wide variety of custom configurations to meet your business requirements. For details, see Sample configurations for the RUM SDK for minigames.