Cocos Creator Application Data Collection
Introduction
Cocos Creator data collection relies on the Android and iOS Native SDKs. This page describes the RUM data that can actually be reported based on the unified data types and fields of the mobile SDK. Whether specific fields are generated depends on the Cocos Creator automatic collection, manual collection, and Native collection configuration.
Data Types
Real User Monitoring (RUM) in TrueWatch includes six data types.
| Type |
Description |
| session |
Records user session information. All access data in the current session, such as views, resources, actions, errors, and long tasks, is associated with this session. |
| view |
A View record is generated each time a user visits a page in the mobile application. While the user stays on the same page, resource, long task, error, and action records are associated with the corresponding RUM View through view_id. |
| resource |
Records resource information loaded when a user visits a page. |
| error |
Exceptions or crashes that occurred in the mobile application. |
| long_task |
Records long tasks that block the main thread for longer than the specified duration threshold. |
| action |
Records user activities in the mobile application (app launch, click, swipe, back, etc.). Each action is assigned a unique action_id. |
Global Attributes
The following global attributes can be used for scenario building and event alerts in RUM.
SDK Attributes
| Field |
Type |
Description |
sdk_name |
string |
SDK name. The Cocos Creator SDK reports data through the Native SDK, corresponding to df_ios_rum_sdk or df_android_rum_sdk. |
sdk_version |
string |
SDK version information. |
Application Attributes
| Field |
Type |
Description |
app_id |
string |
Required. Unique ID of the application, automatically generated when you create a monitor in the TrueWatch console. |
env |
string |
Required. Environment field. Values: prod, gray, pre, common, local. |
version |
string |
Required. Version number. |
service |
string |
Optional. Name of the business or service it belongs to. The default service name in the Native SDK is df_rum_ios or df_rum_android. |
User & Session Attributes
| Field |
Type |
Description |
userid |
string |
For users who are not signed in, a random UUID is used as the userid; for signed-in users, the user ID generated by the application backend is used. |
user_name |
string |
Optional. User name. |
user_email |
string |
Optional. User email. |
session_id |
string |
Session ID. A new session_id is generated after more than 15 minutes of inactivity. |
session_type |
string |
Session type. Reference values: user and synthetics. user indicates data generated by RUM features; synthetics indicates data generated by headless synthetic tests. |
is_signin |
boolean |
Whether the user is a registered user. Values: T or F. |
Device & Resolution Attributes
| Field |
Type |
Description |
device |
string |
Mobile device vendor. |
model |
string |
Mobile device model. |
device_uuid |
string |
Unique ID of the mobile device. On Android, it is generated using ANDROID_ID; on iOS, it is generated using UIDevice.identifierForVendor. |
os |
string |
Operating system information. |
os_version |
string |
Operating system version. |
os_version_major |
string |
Major operating system version. |
screen_size |
string |
Screen resolution. |
Geographic & Network Attributes
| Field |
Type |
Description |
ip |
string |
User access IP address. |
isp |
string |
ISP. |
network_type |
string |
Network connection type. Reference values: wifi, 2g, 3g, 4g, 5g, unknown (unknown network), unreachable (network unavailable). |
country |
string |
Country. |
country_iso_code |
string |
Country ISO code. |
province |
string |
Province. |
city |
string |
City. |
Custom Attributes
In addition to global attributes, you can use custom attributes (the SDK allows you to add custom tag data) to build scenarios and configure event alerts. Custom attributes are non-global attributes that can be used to track the entire user visit process and locate affected user visits.
Other Data Type Attributes
Session
Attributes
| Field |
Type |
Description |
session_id |
string |
Session ID. |
session_type |
string |
Session type. Reference values: user and test. user indicates data generated by RUM features; test indicates data generated by headless synthetic tests. |
session_referrer |
string |
Session referrer, usually records the address of the page from which the session originated. |
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 page visited in the current session. |
session_last_view_name |
string |
Name of the last page in the current session. |
Count Metrics
| Field |
Type |
Description |
time_spent |
number (ns) |
Duration of the current session. |
session_view_count |
number |
Number of view_id values 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, which is the parent of the page. |
view_name |
string |
Page name. For Cocos Creator automatic collection, this is the scene name. |
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, such as cold start, hot start, click, etc. |
Metrics
| Field |
Type |
Description |
loading_time |
number (ns) |
Page loading time. |
time_spent |
number (ns) |
Time spent on the page. |
is_active |
boolean |
Whether the user is still active. Reference values: true or false. |
Count Metrics
| Field |
Type |
Description |
view_error_count |
number |
Number of errors that occurred during each page load. |
view_resource_count |
number |
Number of resources requested during each page load. |
view_long_task_count |
number |
Number of long tasks generated during each page load. |
view_action_count |
number |
Number of actions during page view. |
Monitoring Metrics
| Field |
Type |
Description |
cpu_tick_count |
number |
Optional. Number of CPU ticks for this page. |
cpu_tick_count_per_second |
number |
Optional. Average number of CPU ticks per second. |
fps_avg |
number |
Optional. Average frames per second for the page. |
fps_mini |
number |
Optional. Minimum frames per second for the page. |
memory_avg |
number |
Optional. Average memory usage for the page. |
memory_max |
number |
Optional. Peak memory usage for the page. |
Resource
View Attributes
| Field |
Type |
Description |
view_id |
string |
Unique ID generated each time a page is visited. |
view_referrer |
string |
Page referrer, which is the parent of the page. |
view_name |
string |
Page name. |
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, such as cold start, hot start, click, etc. |
Resource Attributes
| Field |
Type |
Description |
resource_url |
string |
Resource URL. |
resource_url_host |
string |
Host 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 type. |
resource_method |
string |
Resource request method. |
resource_status |
string |
Status value returned by the resource request. |
resource_status_group |
string |
Status group value returned by 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: dnsEndTime - dnsStartTime. |
resource_tcp |
number (ns) |
TCP connection time for resource loading. Calculation: tcpEndTime - tcpStartTime. |
resource_ssl |
number (ns) |
SSL connection time for resource loading. Calculation: sslEndTime - sslStartTime. |
resource_ttfb |
number (ns) |
Time to first byte for resource loading. |
resource_trans |
number (ns) |
Content transfer time for resource loading. Calculation: responseEndTime - responseStartTime. |
resource_first_byte |
number (ns) |
First byte time for resource loading. |
duration |
number (ns) |
Total resource loading time. |
request_header |
string |
Resource request headers. |
response_header |
string |
Resource response headers. |
Resource Phase Metrics
Cocos Creator automatic collection for fetch and XMLHttpRequest reports the basic request/response information and the total duration. Phase metrics such as DNS, TCP, and SSL are generated only when the corresponding time values are provided through FTResourceMetrics during manual collection.
Error
View Attributes
| Field |
Type |
Description |
view_id |
string |
Unique ID generated each time a page is visited. |
view_referrer |
string |
Page referrer, which is the parent of the page. |
view_name |
string |
Page name. |
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, such as cold start, hot start, click, etc. |
Error Attributes
| Field |
Type |
Description |
error_source |
string |
Error source. Reference values: logger or network. |
error_type |
string |
Error type. Common values at the Cocos Creator layer: cocos_error, unhandled_promise_rejection, network_error. The Native layer may also produce java_crash, native_crash, anr_error, anr_crash, ios_crash, etc. |
error_situation |
string |
When the error occurred. Reference values: startup (at startup) and run (at runtime). |
When error_source=network, the following Network Error attributes can also be added.
| Field |
Type |
Description |
resource_status |
string |
Status value returned by the resource request. |
resource_url |
string |
Resource URL. |
resource_url_host |
string |
Host 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. |
Error Monitoring Attributes
| Field |
Type |
Description |
memory_total |
string |
Optional. Total memory. |
memory_use |
number |
Optional. Memory usage. |
cpu_use |
number |
Optional. CPU usage. |
battery_use |
number |
Optional. Current battery level. |
locale |
string |
Current system language. |
Metrics
| Field |
Type |
Description |
error_message |
string |
Error message. |
error_stack |
string |
Error stack. |
Long Task
View Attributes
| Field |
Type |
Description |
view_id |
string |
Unique ID generated each time a page is visited. |
view_referrer |
string |
Page referrer, which is the parent of the page. |
view_name |
string |
Page name. |
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, such as cold start, hot start, click, etc. |
Metrics
| Field |
Type |
Description |
duration |
number (ns) |
Long task duration. |
long_task_stack |
string |
Long task stack. |
Long Task Collection Notes
The Cocos JavaScript layer does not currently automatically monitor Long Tasks. Business code can measure the duration of known tasks and report them through addLongTask(). When Native UI Block/Freeze is enabled, long tasks at the Native layer can also be reported.
Action
View Attributes
| Field |
Type |
Description |
view_id |
string |
Unique ID generated each time a page is visited. |
view_referrer |
string |
Page referrer, which is the parent of the page. |
view_name |
string |
Page name. |
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. During Cocos Creator automatic collection, the event target node name is used first. |
action_type |
string |
Action type. The type automatically collected for global touch actions by Cocos Creator is click. |
Metrics
| Field |
Type |
Description |
duration |
number (ns) |
Time spent on the page action. |
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. |
Related Configuration
For automatic collection rules, see Custom Collection Rules. For manual collection APIs, see RUM Manual Instrumentation. For data collection boundaries and sensitive data handling, see Data and Privacy.