Collection overview
Common event attributes
Before sending each RUM event, the SDK enriches it with application, session, page, connectivity, user, and context information. These fields let the Explorer correlate events from the same user session, page view, and network state.
The SDK reads the initial network type through
wx.getNetworkType and updates network state for later events through wx.onNetworkStatusChange.
Page views
WhentrackPages is enabled, the SDK wraps the global Page constructor and listens to page lifecycle hooks. Each page creates view events, and the default page name comes from the page instance route.
The SDK records the following page information:
The SDK updates the active page duration every 3 seconds. When a page moves to the background, is hidden, or unloads, the SDK sends a view update with the
hidden or terminated state.
User Actions
WhentrackActions is enabled, the SDK wraps functions in the page configuration. If a function receives a first argument that contains a string type field, the SDK records a user action.
Action events include the following information:
Network requests
WhentrackRequests is enabled, the SDK wraps wx.request, wx.uploadFile, and wx.downloadFile. The SDK’s own reporting requests are not collected.
Network requests create resource events:
Error collection
WhentrackErrors is enabled, the SDK subscribes to Mini Program app errors, unhandled Promise rejections, page-not-found events, and subpackage lazy-load failures. Failed network requests are also recorded as errors.
Error events include the error message, optional stack, and source. When manually reporting an error, pass
error.stack as the third argument to addError().
Performance metrics
WhentrackPerformance is enabled, the SDK reads Mini Program performance APIs. If the runtime supports the corresponding APIs, the SDK writes metrics to view events.
If the current Mini Program base library does not support
wx.getPerformance or setUpdatePerformanceListener, the SDK skips the corresponding metrics without affecting other data collection.
Custom events
CallingaddCustomEvent(name, context?) creates a custom event. Use it to record business events that cannot be inferred automatically from page lifecycle hooks, actions, or requests.
pages/order/detail.js
Disable automatic collection
Disable collection types you do not need during initialization:app.js
trackActions, you can still call addAction() to report a custom action.
Reporting batches
The SDK adds collected RUM events to batches before sending them:
Data that fails to send is resent on the next launch. The SDK keeps up to 10 pending payloads with a total size up to 64 KB, and discards data older than 24 hours.
Related Pages
SDK Integration
Install and initialize the WeChat Mini Program RUM SDK.
Advanced Configuration
Configure proxying, tracing, sessions, and manual instrumentation.
Compatibility
Learn about Mini Program base library, development tool, and platform API requirements.