All Products
Document Center

Configure upload switch

Last Updated: Jun 24, 2021

The switch configuration feature allows you to modify the trigger condition for automatic log uploading based on the switch value delivered by the server, to dynamically control log uploading.

Mobile Analysis Service (MAS) implements tracking based on the client SDK, collects user behaviors, app performance data, and other related data to generate logs, and then reports the logs to the server. Then, mPaaS generates various metrics reports and dashboards based on real-time or offline computing for your reference.

mPaaS charges the traffic consumed for tracking log uploading. To prevent unnecessary costs, you can manage log uploading by using the switch configuration feature. For more information about traffic fees for log uploading, see Post-paid method.

Add tracking configuration

  1. In the mPaaS console, go to the Mobile Analysis Service > Log management > Configure upload switch page, and click Tracking configuration in the upper-left corner.
  2. Click Add business.
  3. Fill in the configuration information.
    • Business code: Enter a business code. For custom behavior tracking, the business code is as follows:
      • Android: behaviourPro, set by calling demoBehavior.setBehaviourPro("Pay") on the client.
      • iOS: The default value is behavior. You can set a custom value for the client using the bizType parameter in the writeLogWithActionId API.
        For more information, see Android business codes or iOS business codes.
      • Business name: Enter the description of the tracking business. The value is customizable.
      • Log header: Enter the value of field 01 in the log model. This parameter is used to distinguish different log types. For example, the log header for custom behavior log is D-VM. For more information, see Log models.
  4. Click Add. The tracking configuration is added. To specify more configurations, see Modify tracking configuration.

The added tracking is displayed on the log switch list.

  • Upload switch: Once the switch is turned on, the tracking logs will be automatically uploaded.
  • Network: The network environment where tracking logs are uploaded. The network can be All networks (2G, 3G, 4G, Wi-Fi and others) or Wi-Fi only.

Modify tracking configuration

To modify tracking configurations, click Modify in the Operations column. You can modify the following configurations of the tracking point:

  • Business code: Corresponds to the business code that you set when adding the tracking.
  • Description: Corresponds to the business name that you set when adding the tracking.
  • Log header: Corresponds to the log header that you set when you adding the tracking.
  • Minimum upload level: Logs are classified into levels 1, 2, and 3, which are sorted by importance in descending order. For example, if this parameter is set to 2, logs of levels 1 and 2 will be uploaded, but logs of level 3 will not. For custom behavior tracking, the default value is 2. For iOS apps, you can set the log level when configuring events for the client. For more information, see iOS custom behavior log.
  • Upload quantity: Tracking logs of the client are first written to local files. When the number of local logs with the specified business code reaches the threshold defined by this parameter, the logs are automatically uploaded to MAS. For more information, see Automatic log upload for Android or Automatic log upload for iOS.
  • Log upload rate: Specify the rate of users whose logs are to be uploaded, in permillage. For example, the value 1000 indicates that logs of all users are to be uploaded.
  • Strategy: If the Upload when App moves to background strategy is selected:
    • Android: Logs are automatically uploaded after an app runs in the background for more than half an hour.
    • iOS: Logs are automatically uploaded when an app switches to the background.
      For more information, see Log upload for Android or Log upload for iOS.

Initialize business

Logs written by the client in local files are automatically uploaded to the MAS server when certain conditions are met. Such conditions depend on the default tracking configuration. After creating an app, you can use the business initialization function to synchronize the default tracking configuration to the app. The procedure is as follows:

  1. Click Initialize business. In the pop-up confirmation dialog box, click OK.
  2. When the initialization is successfully done, you can see the default tracking configuration list.
Note:The default tracking configuration will apply to your app even if you do not click Initialize business to synchronize it. The only difference is that it will not be displayed in the tracking configuration list.


In addition to adding and modifying tracking configurations on pages, you can use JSON to add and configure tracking to control the log reporting strategy. However, you are not suggested to use this function for the following reasons:

  • The mock function only facilitates tracking configuration but does not provide any other functions.
  • If you configure tracking for the same business through both page operations and the mock function, the mock configuration takes precedence.
  • If you are not familiar with the tracking configuration format, you may use the mock function incorrectly. As a result, the default automatic log upload function may be affected.

Add mock configurations

To add mock configurations, perform the following steps:

  1. On the Configure upload switch tab, click Add Mock configuration.
  2. Fill in the configuration information.
    • Version: Enter the version of your app.
    • Platform: Select the app platform.
    • Value: Enter the configurations in JSON. For more information, see Mock configuration format.
  3. Make sure that all the information is correct, and then click OK to add the mock configurations.

Mock configuration format

The mock configuration format is as follows:

  1. {
  2. "Log header 1": {
  3. "Business code 1": {
  4. "write": "yes",
  5. "send": [
  6. "wifi"
  7. ],
  8. "maxLogCount": 50,
  9. "level": 3,
  10. "uploadRate": 1000,
  11. "event": [
  12. "gotoBackground"
  13. ]
  14. },
  15. "Business code 2": {
  16. ...
  17. },
  18. ...
  19. },
  20. "Log header 2": {
  21. ...
  22. },
  23. ...
  24. }