Skip to content

Custom Rules for Data Collection

This article describes the default rules when Cocos Creator automatically collects View, Action, Resource, and Console Log, and how to handle cases where you need to customize names or filter scopes. RUM manual instrumentation is uniformly described in RUM Configuration, and custom log writing is described in Log Configuration.

View

After autoTrack.scenes is enabled, the SDK uses the Cocos scene name as the View name. On scene switching, the previous View is ended, and a new View is started for the new scene.

The current Cocos Creator SDK does not provide automatic View name transformation or filtering callbacks. If you need to customize View names or skip some scenes, disable autoTrack.scenes and manually manage Views via guanceSdk.rum.startView() and stopView().

Action

After autoTrack.actions is enabled, a global TOUCH_END event generates an Action:

  • The event target node name is used first as the Action name;
  • If the target node has no name, CocosTouch is used;
  • The Action type is click;
  • Additional attributes include the touch position x, y.

The current Cocos Creator SDK does not provide automatic Action name transformation or filtering callbacks. If you need to customize names, attributes, or collection scope, disable autoTrack.actions and report manually via guanceSdk.rum.addAction() or startAction().

Resource

After autoTrack.network is enabled, the SDK automatically collects fetch and XMLHttpRequest in the current JavaScript runtime, recording the URL, HTTP method, request headers, response headers, status code, and request duration.

The current Cocos Creator SDK does not provide URL filtering or Resource content processing callbacks. If you need to exclude requests, add custom attributes, or use a custom network stack, disable autoTrack.network and manually collect data via guanceSdk.rum.startResource(), stopResource(), and addResource(). To inject Trace Headers, use guanceSdk.trace.getHeaders().

Choose One: Automatic or Manual

For the same View, Action, or Resource, use only one method—automatic collection or manual collection—to avoid duplicate data.

Console Log

After autoTrack.console is enabled, the SDK wraps console.log/info/warn/error and writes them to Log. Currently, no console content filtering or transformation callback is provided. If you need to filter log content, disable autoTrack.console and write custom logs that have passed business filtering via guanceSdk.logger.log().

Feedback

Is this page helpful?