All Products
Search
Document Center

Application Real-Time Monitoring Service:User Session Trace

Last Updated:Mar 18, 2026

User Session Trace captures the complete journey of end users from app launch to exit. The SDK automatically collects user behaviors and performance events, correlating all events within a session using a unique Session ID to form a comprehensive timeline.

Function overview

User Session Trace lets you:

  • With User Session Trace, you can:

    • Reconstruct individual user navigation paths within a session.

    • Identify the context surrounding errors, freezes, or slow loading issues.

    • Analyze page transitions, time spent, and interaction patterns to optimize experience.

    • Diagnose network-level performance bottlenecks by correlating resource request data.

Prerequisites

Before you begin, ensure that you have:

Note: User Session Trace is enabled by default after SDK initialization. Page loads, user actions, resource requests, errors, and performance issues are collected automatically without additional instrumentation.

Session Lifecycle

The SDK automatically manages session lifecycle without manual intervention. Session management differs by platform.

Mobile (iOS and Android)

Session Creation

A new session with a unique Session ID is created when the app:

  • Launches for the first time

  • Returns to the foreground from the background

Session Continuation

If the app returns to the foreground within 60 seconds of entering the background, the SDK reuses the current session instead of creating a new one.

Session Expiration

If the app remains in the background for more than 60 seconds, the previous session ends. The SDK creates a new session when the app returns to the foreground.

Session Termination

The current session ends when the app is terminated.

┌─────────────┐    ┌──────────────┐    ┌─────────────┐
│  App Launch │───▶│ Create Session│───▶│ Collect Events│
└─────────────┘    └──────────────┘    └──────┬──────┘
                                              │
                          ┌───────────────────┤
                          ▼                   ▼
                   ┌─────────────┐    ┌──────────────┐
                   │ Enter Background│  │ App Terminated│
                   └──────┬──────┘    └──────────────┘
                          │
              ┌───────────┴───────────┐
              ▼                       ▼
     ┌────────────────┐     ┌────────────────┐
     │ Return ≤60s    │     │ Return >60s    │
     │ Reuse Session  │     │ New Session    │
     └────────────────┘     └────────────────┘

Web (Web and Mini Programs)

Session Creation

A new session with a unique Session ID is created when a user first visits the page.

Session Continuation

The session remains active while the user continues interacting with the page (clicks, scrolls, navigation).

Session Expiration

When the user has no interaction for longer than the timeout period, the session ends. A new session is created automatically upon the next interaction.

Session Termination

The current session ends when the user closes the page or browser.

Session Sampling

The SDK supports session-level sampling control. The default sampling rate is 100% (all sessions collected). For sampled sessions, all events are reported. For unsampled sessions, events are discarded without generating network overhead.

Configure Sampling Rate

Manual Configuration (Web and Mini Programs)

During RUM integration, initialize the sessionConfig function to configure the sampling rate.

Parameter

Type

Description

Required

Default

sampleRate

number

Session sample rate: [0, 1].

For example, a 50% sample rate is 0.5.

No

1

maxDuration

number(ms)

Maximum session duration. Default: 24 hours.

No

86400000

overtime

number(ms)

Session timeout duration. Default: 1 hour.

No

3600000

storage

string

Storage location for session-related data.

  • cookie

  • localStorage

No

localStorage

armsRum.init({
  endpoint: "your endpoint",
  sessionConfig: {
    sampleRate: 0.5, // 50% sample rate
    maxDuration: 86400000,
    overtime: 3600000,
    storage: 'cookie',
  },
});

Remote Configuration (All Platforms)

  1. Log in to the RUM console.

  2. Navigate to Application List > Application Details > Application Settings > SDK Configuration.

  3. Configure the session sampling rate under Session Configuration.

Note: For Web and Mini Program applications, add the remoteConfig field when initializing the RUM SDK to enable remote session sampling rate configuration. The SDK fetches the remote OSS configuration during initialization and updates the probe configuration accordingly.

Parameter

Type

Description

Required

Default

enable

boolean

Specifies whether to enable remote configuration.

No

false

mode

string

  • launch-first: Quick Launch mode. The SDK starts quickly with the local configuration and asynchronously fetches the latest configuration.

  • remote-first: Remote-first mode. The SDK blocks and waits for the cloud configuration, falling back to the local configuration after a timeout.

No

launch-first

cacheTimeout

number(ms)

Configuration cache validity period. Default: 1 hour.

No

3600000

armsRum.init({
  endpoint: "your endpoint",
  remoteConfig: {
    enable: true,
    mode: 'remote-first',
  }
});

After the SDK retrieves the remote configuration, it immediately updates the settings and stores the configuration locally. This allows the SDK to use the stored configuration for initialization the next time it starts. Note that the SDK version must be 0.0.37 or later.

Event Correlation

The SDK generates a unique Session ID for each session. All events collected during the session—page loads, user actions, resource requests, errors, and performance issues—are automatically correlated with this Session ID, ensuring full traceability and reconstruction.

Each event also records the current page context (Page ID and Page Name), making it easy to locate the specific page where an event occurred within the session trace.

Collected Event Types

The SDK automatically collects the following event types during a user session.

Page Load (View)

Records loading and engagement metrics for each page. The SDK captures page lifecycle events automatically without manual instrumentation.

Attribute

Description

Page Name

Page identifier name

Page URL

Page path

Previous Page

Source page information for analyzing navigation flow

Page Load Time

Time from load start to completion (ms)

Time on Page

Duration the user spent on the page (ms)

First Paint (FP)

Time when the page first renders

First Contentful Paint (FCP)

Time when the page first renders content

Largest Contentful Paint (LCP)

Time when the largest content element finishes rendering

Cumulative Layout Shift (CLS)

Page layout stability metric

First Input Delay (FID)

Delay from first user interaction to app response

User Action (Action)

Records user interactions such as clicks and scrolls. The SDK automatically intercepts user interaction events.

Attribute

Description

Action Type

Interaction type (tap, click, scroll)

Action Name

Name or description of the action target

View Path

Path of the action target within the view hierarchy

Action Coordinates

Screen coordinates of the user action

Response Time

Time from action trigger to completion (ms)

Resource Request (Resource)

Captures network requests initiated by the application, recording the complete request lifecycle and performance metrics.

Attribute

Description

Request URL

Complete request address

HTTP Method

Request method (GET, POST)

Status Code

HTTP response status code

Resource Type

Resource category (API, Image, Media, Font)

Success Status

Whether the request succeeded

DNS Time

DNS resolution time (ms)

TCP Connection Time

TCP connection establishment time (ms)

TLS Time

TLS handshake time (ms)

Time to First Byte (TTFB)

Time from request sent to first byte received (ms)

Response Time

Complete response time (ms)

Request Size

Request body size (bytes)

Response Size

Response body size (bytes)

Exception and Crash (Error)

Collects application crashes and uncaught exceptions. The SDK also supports manual reporting of custom exceptions through its API. Exception events are automatically correlated with the current session and page context, helping reconstruct the complete user operation path when the exception occurred.

Attribute

Description

Exception Type

Classification identifier of the exception

Exception Reason

Description of what caused the exception

Stack Trace

Call stack when the exception occurred, used to locate code position

Page Context

Page where the user was when the exception occurred

Session ID

Session to which the exception belongs, enabling reconstruction of complete user behavior before the exception

Exception Types

  • Application Crashes

    • Mobile: Runtime uncaught exceptions and system signal exceptions (SIGSEGV, SIGABRT), reported automatically on next launch

    • Web: JavaScript errors and unhandled Promise rejections, reported in real-time

  • Custom Exceptions: Exceptions actively caught in business code can be manually reported through the SDK reporting interface, suitable for recording non-fatal errors or business logic exceptions

Long Task and ANR (Performance Issue)

Detects performance bottlenecks during application runtime.

Attribute

Description

Duration

Duration of the blocking or long task (ms)

Stack Trace

Call stack when the performance issue occurred

Page Context

Page where the user was when the issue occurred

Session ID

Session to which the issue belongs, enabling correlation with surrounding operations

Performance Issue Types

  • ANR (Application Not Responding) - Mobile: Main thread unresponsive for an extended period, typically caused by deadlock, excessive synchronous I/O, or complex computation

  • Frame Rate Drops - Mobile: Rendering frame rate falls below threshold, causing users to perceive UI lag

  • Long Task: Tasks with execution time exceeding the threshold, detected on both web and mobile platforms

Use Cases

Investigating User Complaints

Scenario: A user reports "the page showed a blank screen after opening."

Solution: Use User Session Trace to locate the corresponding session by User ID or Device ID and examine the complete event sequence before and after the blank screen. Check whether page load time was abnormal, whether any resource requests failed, or whether JavaScript exceptions were triggered, enabling rapid root cause identification.

Analyzing Page Conversion Funnels

Scenario: Analyze the conversion path from homepage to checkout page.

Solution: Use the page navigation sequence in session traces to track user journey. Combined with time spent on each page and action events, identify where users drop off—whether due to slow page loads, interaction lag, or overly complex navigation flows.

Diagnosing Slow Request Impact

Scenario: An API endpoint becomes slow.

Solution: Use session traces to examine the complete experience of affected users. Determine which page the slow request occurred on, whether users repeatedly clicked while waiting, and whether they ultimately abandoned the application. Combined with phased timing data for resource requests (DNS, TCP, TTFB), determine whether the issue is network-related or server-side.

FAQ

Does User Session Trace need to be manually enabled?

No. User Session Trace is enabled by default after SDK initialization, and all events are collected automatically.

Can the session timeout be customized?

The session timeout is currently fixed at 60 seconds and cannot be customized.

How do I adjust the sampling rate?

The session sampling rate is delivered through remote configuration in the console, with a default of 100%. Adjust the sampling rate in the console—changes take effect immediately without requiring a new release.

Are crash events also correlated with sessions?

Yes. Crash events record the Session ID and page information when the crash occurred. For mobile crashes that cause the app to exit, crash data is reported when the app next launches. Web JavaScript errors are reported in real-time. Both types are correlated with the session when the exception occurred.