Mini Program Data Collection
After application data is collected into TrueWatch, you can use the TrueWatch console to customize scenarios and configure anomaly detection events.
Data Types
TrueWatch Real User Monitoring (RUM) includes six data types:
| Type |
Description |
session |
Records user session information. In the current session, user access data for pages, resources, actions, errors, and long tasks are aggregated based on the session dimension. |
view |
A page view record is generated each time a user visits a page. When the user stays on the same page, resource, long task, error, and action records are linked to the related RUM view via the view_id attribute. |
resource |
Records resource loading information when a user visits a page. |
error |
The RUM collector gathers all frontend errors from the browser. |
long_task |
Any task that blocks the main thread for more than 50ms in the browser generates a long task record. |
action |
Tracks all user interaction records during page browsing. |
Global Attributes
Both RUM scenario building and event alerting can be queried using the following global attributes.
SDK Attributes
| Field |
Type |
Description |
sdk_name |
string |
Collector name, fixed values:
df_web_rum_sdk
df_miniapp_rum_sdk
df_ios_rum_sdk
df_android_rum_sdk |
sdk_version |
string |
Collector version |
Application Attributes
| Field |
Type |
Description |
app_id |
string |
Required. Unique application ID for RUM, automatically generated when creating a monitor in the TrueWatch console. |
env |
string |
Required. Environment field. Values: prod/gray/pre/common/local. Where: prod: Production environment gray: Canary environment pre: Pre-release environment common: Daily environment local: Local environment |
version |
string |
Required. Version number. |
app_launch_query |
string |
Query parameters for launching the Mini Program. |
app_launch_referrer_info |
string |
Referrer information. Returned when entering the Mini Program from another Mini Program, Official Account, or App. |
For more details, see Related Field Documentation.
User & Session Attributes
| Field |
Type |
Description |
userid |
string |
For unauthenticated users, uses a cookie as userid; for authenticated users, uses the user ID generated by the application backend. |
session_id |
string |
Session ID. |
session_type |
string |
Session type. Reference values: user & synthetics
user: Data generated by RUM functionality;
synthetics: Data generated by headless synthetic tests. |
is_signin |
boolean |
Whether the user is a registered user. Values: True / False. |
Device & Resolution Attributes
| Field |
Type |
Description |
device |
string |
Mobile device manufacturer |
model |
string |
Mobile device model |
device_uuid |
string |
Unique mobile device ID |
os |
string |
Operating system information |
os_version |
string |
Operating system version |
os_version_major |
string |
Major operating system version |
screen_size |
string |
Screen resolution |
Geo & Network Attributes
| Field |
Type |
Description |
ip |
string |
User access IP address |
isp |
string |
Internet Service Provider |
network_type |
string |
Network connection type. Reference values:
wifi, 2g, 3g, 4g, 5g, unknown (unknown network), unreachable (network unreachable) |
country |
string |
Country |
country_iso_code |
string |
Country ISO code |
province |
string |
Province/State |
city |
string |
City |
| Field |
Type |
Description |
platform |
string |
The app platform where the Mini Program runs, e.g., the platform for WeChat Mini Programs is wechat. |
platform_version |
string |
Version of the app platform where the Mini Program runs. |
app_framework_version |
string |
Mini Program base library version. |
Custom Attributes
In addition to global attributes, you can also use custom attributes (SDK supports user-defined custom tag data) to build scenarios and configure event alerts. Custom attributes are non-global attributes. Through custom attributes, you can track the entire user access process, locate and identify affected user access, and monitor user access performance.
Attributes for Other Data Types
Session
Attributes
| Field |
Type |
Description |
session_id |
string |
Session ID |
session_type |
string |
Session type. Reference values: user & test
user: Data generated by RUM functionality;
test: Data generated by headless synthetic tests. |
session_referrer |
string |
Session referrer; typically records the page URL of the source. |
session_first_view_id |
string |
view_id of the first page in the current session |
session_first_view_name |
string |
Name of the first page in the current session |
session_last_view_id |
string |
view_id of the last visited page in the current session |
session_last_view_name |
string |
Name of the last page in the current session |
Metrics
| Field |
Type |
Description |
time_spent |
number (ns) |
Duration of the current session |
session_view_count |
number |
Number of view_id associated with the current session |
session_error_count |
number |
Number of errors generated in the current session |
session_resource_count |
number |
Number of resources loaded in the current session |
session_action_count |
number |
Number of user actions in the current session |
session_long_task_count |
number |
Number of long tasks generated in the current session |
View
Attributes
| Field |
Type |
Description |
view_id |
string |
Unique ID generated each time a page is visited |
view_referrer |
string |
Page referrer |
view_name |
string |
Page URL |
performance_supported |
boolean |
Whether the Performance Observer subscription was successful on the current platform |
first_render_supported |
boolean |
Whether a first-render signal usable by the SDK exists on the current platform |
view_start_reason |
string |
Reason for View creation: page_load, page_show, or session_renewal |
Metrics
| Field |
Type |
Description |
loading_time |
number (ns) |
Maximum loading time observed between page navigation and lifecycle events |
page_ready_time |
number (ns) |
Time from View start to onReady; page_fmp is a compatibility field |
first_render_time |
number (ns) |
WeChat: firstRender.duration; Douyin: first-paint - navigationStart; first_paint_time is a compatibility field |
page_fp |
number (ns) |
FP relative to the navigationStart of the current page |
page_fcp |
number (ns) |
FCP relative to the navigationStart of the current page |
page_lcp |
number (ns) |
Time of the most recent LCP on the current page relative to navigationStart |
first_render_data_transfer_time |
number (ns) |
Data transfer time for first-render initialization |
first_render_wait_time |
number (ns) |
Wait time from data reception completion to the start of rendering on the view layer |
first_render_view_layer_time |
number (ns) |
Time for the first render on the view layer |
time_spent |
number (ns) |
Page dwell time |
onload_to_onshow |
number (ns) |
Time from page onload to onshow |
onshow_to_onready |
number (ns) |
Time from page onshow to onready |
ready_reached |
boolean |
Whether the current page lifecycle has reached onReady |
first_render_reached |
boolean |
Whether the current page has received the platform's first-render signal |
ended_before_ready |
boolean |
Whether a page_load View ended before reaching onReady |
ended_before_render |
boolean |
When first-render signal is supported, whether the page_load View ended before the first render |
view_end_reason |
string |
Reason for View end: onHide, onUnload, or session_renewal |
view_is_active |
boolean |
Whether the View is still active |
view_setdata_duration |
number (ns) |
Cumulative time of all valid setData updates in the current View |
view_setdata_max_duration |
number (ns) |
Maximum time for a single setData update |
view_setdata_pending_duration |
number (ns) |
Cumulative wait time from setData entering the queue to starting the update |
view_setdata_update_duration |
number (ns) |
Cumulative execution time from setData start to end of update |
view_setdata_merged_count |
number |
Number of setData updates merged by the platform |
is_active |
boolean |
Whether the user is still active. Reference values: true & false |
For platform-specific performance field definitions, white-screen candidate statistics, and known limitations, see Performance Diagnostics.
Count Metrics
| Field |
Type |
Description |
view_error_count |
number |
Number of errors occurring on each page load |
view_resource_count |
number |
Number of resources requested on each page load |
view_long_task_count |
number |
Number of long tasks generated on each page load |
view_action_count |
number |
Number of actions during page viewing |
view_setdata_count |
number |
Number of setData calls on the page |
view_apdex_level |
number |
Page first render |
Resource
View Attributes
| Field |
Type |
Description |
view_id |
string |
Unique ID generated each time a page is visited |
view_referrer |
string |
Page referrer |
view_name |
string |
Page URL |
Resource Attributes
| Field |
Type |
Description |
resource_url |
string |
Resource URL |
resource_url_host |
string |
Domain part of the resource URL |
resource_url_path |
string |
Path part of the resource URL |
resource_url_query |
string |
Query part of the resource URL |
resource_url_path_group |
string |
Path group of the resource URL |
resource_type |
string |
Resource category |
resource_method |
string |
Resource request method |
resource_status |
string |
HTTP status code returned for the resource request |
resource_status_group |
string |
Grouped HTTP status code of the resource request |
Metrics
| Field |
Type |
Description |
resource_size |
number |
Resource size, default unit: bytes |
resource_dns |
number (ns) |
DNS resolution time for resource loading Calculation: domainLookupEnd - domainLookupStart |
resource_tcp |
number (ns) |
TCP connection time for resource loading Calculation: connectEnd - connectStart |
resource_ssl |
number (ns) |
SSL connection time for resource loading Calculation: connectEnd - secureConnectStart |
resource_ttfb |
number (ns) |
Time to first byte for resource loading Calculation: responseStart - requestStart |
resource_trans |
number (ns) |
Content transfer time for resource loading Calculation: responseEnd - responseStart |
resource_first_byte |
number (ns) |
First byte time for resource loading Calculation: responseStart - domainLookupStart |
duration |
number (ns) |
Resource load time Calculation: duration(responseEnd-startTime) |
Error
View Attributes
| Field |
Type |
Description |
view_id |
string |
Unique ID generated each time a page is visited |
is_active |
boolean |
Whether the user is still active. Reference values: true & false |
view_referrer |
string |
Page referrer |
view_name |
string |
Page URL |
Error Attributes
| Field |
Type |
Description |
error_source |
string |
Error source. Reference values: console, network, source, custom |
error_type |
string |
Error type. Reference link: error type |
resource_status |
string |
HTTP status code returned for the resource request |
resource_url |
string |
Resource URL |
resource_url_host |
string |
Domain part of the resource URL |
resource_url_path |
string |
Path part of the resource URL |
resource_url_path_group |
string |
Path group of the resource URL |
resource_method |
string |
Resource request method |
Metrics
| Field |
Type |
Description |
error_message |
string |
Error message |
error_stack |
string |
Error stack trace |
Long Task
View Attributes
| Field |
Type |
Description |
view_id |
string |
Unique ID generated each time a page is visited |
is_active |
boolean |
Whether the user is still active. Reference values: true & false |
view_referrer |
string |
Page referrer |
view_name |
string |
Page URL |
Metrics
| Field |
Type |
Description |
duration |
number (ns) |
Time spent on long tasks generated during page load |
Action
View Attributes
| Field |
Type |
Description |
view_id |
string |
Unique ID generated each time a page is visited |
is_active |
boolean |
Whether the user is still active. Reference values: true & false |
view_referrer |
string |
Page referrer |
view_name |
string |
Page URL |
Action Attributes
| Field |
Type |
Description |
action_id |
string |
Unique ID generated when the user performs an action on the page |
action_name |
string |
Action name |
action_type |
string |
Action type: Launch attempt - launch_attempt (without view-related information) Launch - launch (without view-related information) Mini Program package download - package_download (without view-related information) Script injection - script_insert (without view-related information) Click - click, etc. |
Metrics
| Field |
Type |
Description |
duration |
number (ns) |
Time spent on the page action |
app_launch_attempt |
boolean |
true when action_type=launch_attempt; this event does not include duration. |
Count Metrics
| Field |
Type |
Description |
action_long_task_count |
number |
Number of long tasks associated with the action |
action_resource_count |
number |
Number of resource requests associated with the action |
action_error_count |
number |
Number of errors associated with the action |