Skip to main content

Advanced guide

Last updated 09/16/2026

1. Initialization parameters​

Cocos Creator passes in configuration through TDRemoteConfig.init. Web and mini games use the JS channel. Native Android / iOS / HarmonyOS packages bridge the parameters to the native TDRemoteConfig.

1.1 Configuration options​

Property nameTypeDescription
appIdStringapp id of the project created in the AE backend. Required
serverUrlStringserver url of the project created in the AE backend. Required
debugModeStringSDK running mode. See 1.2. The native channel only recognizes 'debug'
enableLogBooleanWhether to enable log printing. Only controls logging and doesn't enter test mode
templateCodeStringTemplate code. Optional
customFetchParamsObjectCustom Fetch parameters carried during initialization. Optional
TDRemoteConfig.init({
appId: 'YOUR-APP-ID',
serverUrl: 'https://your-server-url',
enableLog: true,
debugMode: 'debug',
customFetchParams: { channel: 'cocos' }
});

1.2 SDK running modes​

ValueDescription
Not passed / other valuesNormal mode. Fetches configurations based on online strategies, and the data is stored.
debugTest mode. The device must be added to the test device list in the AE console. The client fetches test strategies at a shorter interval, so you can verify template tests or strategy tests in the AE Engage module.
debugOnlySupported only on the Web / mini game JS channel. Native Android / iOS / HarmonyOS doesn't recognize this value, and the effect is the same as normal mode.

2. Customize fetch timing​

2.1 Automatic fetching​

The SDK automatically fetches remote configuration data in the following scenarios.

Web / mini games (JS channel)

  • After the SDK is initialized successfully
  • The app switches between foreground and background, and more than 6 hours have passed since the last fetch
  • The TDAnalytics SDK account system changes, for example, on login or logout

Android / iOS / HarmonyOS (native channel)

After initialization, the native TDRemoteConfig fetches automatically and follows the app lifecycle and account changes. Initialize the analytics SDK first and then Config Center, so that account changes are synced to configuration fetching.

2.2 Manual fetching​

Call the SDK method manually to fetch remote configuration at any time. The native channel forwards the call to TDRemoteConfigProxyApi.

TDRemoteConfig.fetch();
// With multiple instances, you can specify appId / templateCode
TDRemoteConfig.fetch(appId, templateCode);

This API has internal rate limiting. Avoid fetching too frequently.

3. Customize Fetch parameters​

Fetch parameters are parameters that the client SDK can use when it requests values from the AE server. You can customize Fetch parameters and add them as environment parameters of config channels. You can then use the Fetch parameters to customize the target audience when you configure strategies.

3.1 Add​

TDRemoteConfig.setCustomFetchParams({
demo_param: 'from_demo'
}, appId);

3.2 Delete​

Delete by the specified key

TDRemoteConfig.removeCustomFetchParam('demo_param', appId);

4. Client Params​

Starting from v1.3.1, Cocos Creator supports Client Params. Like Fetch parameters, client parameters can also be used in remote strategy matching. The difference is that client parameters are stored locally on the client and carried by the SDK in requests. The Android / iOS / HarmonyOS native bridges have been updated accordingly.

TDRemoteConfig.addClientParams({
client_tag: 'demo',
client_count: 1
});
TDRemoteConfig.removeClientParam('client_tag');
TDRemoteConfig.accumulateNum('client_count', 1);
const tag = TDRemoteConfig.getClientParamValueForKey('client_tag');
const all = TDRemoteConfig.getClientParams();
Was this page helpful?