All Products
Search
Document Center

Application Real-Time Monitoring Service:Integrate a web or HTML5 application

Last Updated:Mar 10, 2026

When your web or HTML5 application has performance issues or JavaScript errors in production, diagnosing the root cause requires visibility into real user sessions. Real User Monitoring (RUM), a feature of Application Real-Time Monitoring Service (ARMS), collects performance metrics and tracks exceptions by using JavaScript or npm packages. After integration, you can trace performance bottlenecks and exceptions across your user base.

Important

RUM has been available for commercial use since 00:00:00 (UTC +8) on June 24, 2024. For more information, see Billing. To get technical support, join the DingTalk group chat (ID: 67370002064).

Quick start

Install the SDK with npm, initialize it in your application entry file, and start collecting data immediately.

import ArmsRum from '@arms/rum-browser';

ArmsRum.init({
  pid: "<your-app-id>",        // Application ID from the ARMS console
  endpoint: "<your-endpoint>", // Endpoint URL from the ARMS console
});

Replace <your-app-id> and <your-endpoint> with the values generated after you create an application in the ARMS console. See Step 1: Create the application for details.

For the full list of SDK parameters, see SDK configuration reference for web and HTML5 applications.

Integration workflow

The integration has three steps:

  1. Create an application in the ARMS console to get your pid and endpoint.

  2. Install the SDK by using one of three methods: CDN async, CDN sync, or npm.

  3. Verify that monitoring data appears in the console.

Step 1: Create the application

  1. Log on to the ARMS console.

  2. In the left-side navigation pane, choose Real User Monitoring > Application List. In the top navigation bar, select a region.

  3. On the Applications page, click Add Application.

  4. In the Create Application panel, click Web & H5.

  5. In the Web & H5 panel, enter an application name and description, and then click Create.

    Note

    The application name must be unique.

  6. After the application is created, an endpoint (the address to which monitoring data is reported) and a pid (your application ID) are automatically generated in the STEP2 section.

  7. In the STEP2 section, select an installation method and install the OpenRUM SDK.

Step 2: Install the OpenRUM SDK

Choose one of the following installation methods.

MethodBest forTrade-off
CDN async (recommended)Applications with strict page load performance targetsCannot capture errors that occur before the SDK finishes loading
CDN syncApplications that need complete error coverage from page loadBlocks page rendering until the SDK loads
npmModern build-tooling setups that require reducing page scripts and controlling traffic flowRequires a build step

CDN async loading

Async (non-blocking) loading downloads the SDK without blocking page rendering. Use this method when page load speed is your top priority.

Important

Async loading cannot capture JavaScript errors or resource loading errors that occur before the OpenRUM SDK is initialized.

Copy the following snippet and paste it as the first element inside the <body> tag of your HTML page. Replace <your-app-id> and <your-endpoint> with the values from STEP2 in the console.

<script>
  !(function(c,b,d,a){c[a]||(c[a]={});c[a]={
    pid: "<your-app-id>",        // Application ID from the ARMS console
    endpoint: "<your-endpoint>"  // Endpoint URL from the ARMS console
  };
  with(b)with(body)with(insertBefore(createElement("script"),firstChild))setAttribute("crossorigin","",src=d)
  })(window, document, "https://sdk.rum.aliyuncs.com/v2/browser-sdk.js", "__rum");
</script>

CDN sync loading

Sync (blocking) loading ensures the SDK is fully loaded before any other scripts run. Use this method when you need to capture all JavaScript errors and resource loading errors from the moment the page starts loading.

Copy the following snippet and paste it as the first element inside the <body> tag of your HTML page. Replace <your-app-id> and <your-endpoint> with the values from STEP2 in the console.

<script>
  window.__rum = {
    pid: "<your-app-id>",        // Application ID from the ARMS console
    endpoint: "<your-endpoint>"  // Endpoint URL from the ARMS console
  };
</script>
<script type="text/javascript" src="https://sdk.rum.aliyuncs.com/v2/browser-sdk.js" crossorigin></script>

npm package

The npm package can be used to reduce the number of scripts loaded on a page, control the traffic flow, and select RUM as a separate module for subsequent processing.

  1. Install the package:

       npm install @arms/rum-browser --save
  2. Initialize the SDK in your application entry file. Replace <your-app-id> and <your-endpoint> with the values from STEP2 in the console.

       import ArmsRum from '@arms/rum-browser';
    
       ArmsRum.init({
         pid: "<your-app-id>",        // Application ID from the ARMS console
         endpoint: "<your-endpoint>", // Endpoint URL from the ARMS console
       });

Access the SDK API after CDN loading

When you use CDN loading (async or sync), access the SDK instance through the RumSDK.default global namespace. The API is identical to the npm method after initialization.

const ArmsRum = window.RumSDK.default;

// If __rum was not configured before SDK loading, initialize manually:
ArmsRum.init({
  pid: "<your-app-id>",
  endpoint: "<your-endpoint>",
});

// Set additional configuration. This API is the same for CDN and npm.
ArmsRum.setConfig('env', 'pre');

Step 3: Verify the integration

After you install the SDK:

  1. Open your application in a browser and interact with the page to generate monitoring events.

  2. Log on to the ARMS console.

  3. In the left-side navigation pane, choose Real User Monitoring > Application List.

  4. Confirm that your application appears in the list and that monitoring data is being reported.

Next steps

Configure advanced SDK options to meet your business requirements. For the full list of parameters, see SDK configuration reference for web and HTML5 applications.