All Products
Search
Document Center

Mobile Platform as a Service:Configure upload switch

Last Updated:Jul 07, 2023

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 referrence.

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 Pay-as-you-go mode.

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 to enter the log switch list page.

  2. Click New business, and configure the tracking information.

    • Business code: Enter a business code. For custom behavior tracking, the business code is as follows:

      • Android: Correspond to the behaviourPro set by calling demoBehavior.setBehaviourPro("Pay") on the client.

      • iOS: It defaults to 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.

  3. Click Add. The tracking configuration is added. To specify more configurations, see Modify tracking configuration.

Modify tracking configuration

The new tracking configuration is displayed on the log switch list page. You can set the log upload switch and network, modify and delete the tracking configuration.

Set log upload switch

Enable or disable log uploading. Once the log upload switch is turned on, the tracking logs of the business will be automatically uploaded.

Set upload network

Set 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: Correspond to the business code that you set when adding the tracking.

  • Description: Correspond to the business name that you set when adding the tracking.

  • Log header: Correspond to the log header that you set when 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 event 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 event log.

  • Uploaded logs: 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 in 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.

Mock

In addition to adding and modifying tracking configurations on pages, you can use JSON to add and configure tracking. However, we do not recommend you 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 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. After you make sure that all the information is correct, click OK to add the mock configurations.

Mock configuration format

The mock configuration format is as follows:

{
  "Log header 1": {
    "Business code 1": {
      "write": "yes",
      "send": [
        "wifi"
      ],
      "maxLogCount": 50,
      "level": 3,
      "uploadRate": 1000,
      "event": [
        "gotoBackground"
      ]
    },
    "Business code 2": {
        ...
    },
    ...
  },
  "Log header 2": {
    ...
  },
  ...
}
  • Log header: Correspond to the log header in the tracking configuration.

  • Business code: Correspond to business code in the tracking configuration.

  • write: Correspond to the upload switch in the tracking configuration. To turn on the switch, set this parameter to "yes". Otherwise, set this parameter to "no".

  • send: Correspond to network in the tracking configuration. To upload logs on all networks, set this parameter to ["2g", "3g", "4g", "wifi"]. To upload logs only on Wi-Fi, set this parameter to ["wifi"].

  • maxLogCount: Correspond to the uploaded logs in the tracking configuration.

  • level: Correspond to the minimum upload level in the tracking configuration.

  • uploadRate: Correspond to the log upload rate in the tracking configuration.

  • event: Correspond to the strategy in the tracking configuration. To use the "Upload in background" strategy, you can set this parameter as ["gotoBackground"]. Otherwise, set this parameter to [].