Updated on 2025-06-27 GMT+08:00

Web & HTML5 SDK Access

Prerequisites

Before using the web & HTML5 SDK, you need to register a HUAWEI ID and enable APM.

Transport Protocol

HTTPS

Version Updates

Table 1 Version updates

Version

Update Description

1.0.61

Filtered out performance loading data whose LCP value is 0.

1.0.59

Supported sampling rate settings.

1.0.58

Supported the Furion Agent.

1.0.57

Added the Cumulative Layout Shift (CLS) and Largest Contentful Paint (LCP) metrics.

1.0.48

Supported the collection of Interaction to Next Paint (INP). By default, this function is disabled. You can configure this function by setting the enableInp parameter.

1.0.47

Supported the reporting of the pvid and ssid fields for session tracing and traffic analysis.

1.0.46

Added the custom tags uid and tag, and added the __rum.setUid and __rum.setTag methods.

Procedure

  1. On the Web Monitoring page, click Connect Website.

  2. Select an application, enter a site name, and click Create Website.

  3. Copy the code in Track Service to the entry HTML file. When the code is executed, the SDK is automatically introduced for tracking. Ensure that the app ID in the code is not empty.

    Table 2 Configuration parameters

    Parameter

    Mandatory

    Default Value

    Description

    appId

    Yes

    -

    Website ID. Each site has its own app ID.

    apiRepo

    No

    true

    Auto API reporting.

    Reports API call details and success rate.

    thirdApi

    No

    true

    Third-party API reporting.

    Reports third-party API information.

    hashMode

    No

    true

    Auto hash mode parsing.

    Processes the content following # as a part of a URL. If this option is disabled, # is regarded as an anchor.

    JsErrorClear

    No

    true

    JS error tracing.

    Listens on and reports all JS errors. This will change the service paths displayed on your browser.

    smartJsErr

    No

    true

    JS errors mitigation.

    Stops reporting a JS error after 100 times.

    webResource

    No

    true

    Page resource reporting.

    Collects loading performance.

    traceType

    No

    apm

    Open tracing.

    Tracing: Traces the frontend and backend using OpenTelemetry. If this option is disabled, APM tracing will be used instead. To view the tracing effect, choose API Requests, go to the URL details page, and click Analyze.

    uid

    No

    -

    Custom ID (string), which is added in version 1.0.46.

    tag

    No

    -

    Custom tag (string), which is added in version 1.0.46.

    enableInp

    No

    false

    Whether to collect INP.

    sampleRate

    No

    1

    Sampling rate. Range: 0–1. For example, if this parameter is set to 0.5, the sampling rate is 50%. This parameter can be configured in web & HTML5 SDK 1.0.59 or later.

  4. (Optional) Configure custom statistics reporting.

    Method

    Description

    __rum.log(key: String, value: String)

    key: event name (string). Max.: 2,048 characters.

    value: event content. Valid JSON objects such as String, Array, HashMap, and Number are supported. Max.: 30,720 characters.

  5. (Optional) Dynamically set the UID.

    Method

    Description

    __rum.setUid(uid: String)

    uid (string): max. 2,048 characters.

  6. (Optional) Dynamically set the tag.

    Method

    Description

    __rum.setTag(tag: String)

    tag (string): max. 2,048 characters.

Data Reporting Policy

  1. Basic user data and custom statistics are reported immediately when a user accesses the page.
  2. Page performance data is triggered to report after the page is loaded.
  3. Other types of data (such as API data and JS error data) are reported every minute.