Switch configurations dynamically control log reporting by sending server-side switch values that modify the trigger conditions for automatic log reporting.
Mobile Analysis Service (MAS) relies on the client SDK for tagging to collect user behavior and app performance data. The SDK generates logs from this data and reports them to the server, where real-time or offline computing processes them into metrics and dashboards.
mPaaS charges for traffic from reported tagging logs. To avoid unnecessary costs, you can manage log reporting through switch configurations. For more information about traffic charges for log reporting, see Postpaid.
The following sections describe how to add and manage tagging configurations.
Add a tagging configuration
-
Log on to the mPaaS console. In the navigation pane on the left, choose Mobile Analysis Service > Log management > Configure upload switch. In the upper-left corner, click Tagging Configuration to open the log switch list page.
-
Click New Business and configure the tagging information.
-
Business Code: For custom behavior tags, the business code configuration varies by platform.
-
Android: The
bizTypeset by the client using theMPLogger.event(String logId, String bizType, Map<String, String> params)method. The bizType cannot contain underscores (_). -
iOS: The default value is
behavior. The client can customize it using thebizTypeparameter in thewriteLogWithActionIdinterface. For more information, see Android business codes or iOS business codes.
-
-
Business Name: A description of the tagging operation. You can customize the business name.
-
Log Header: Field 01 in the log model. It is used to distinguish different log types. The log header for custom behavior tags is
D-VM. For more information, see Log model.
-
-
Click Add to add the tagging configuration. For more information about modifying the configuration, see Modify a tagging configuration below.
Modify a tagging configuration
After you add a tagging configuration, it appears in the log switch list. You can set the log reporting switch, configure network settings, modify tags, and delete the configuration.
Set the log reporting switch
Turn log reporting on or off. When the switch is on, tagging logs for the operation are automatically reported.
Set the reporting network
Choose to report tagging logs in All network environments (such as 2G, 3G, 4G, and Wi-Fi) or only in a Wi-Fi environment.
Modify tagging information
In the Actions column, click Modify to open the modification page with the following settings:
-
Business Code: The business code entered when adding the tagging configuration.
-
Description: The business name entered when adding the tagging configuration.
-
Log Header: The log header entered when adding the tagging configuration.
-
Minimum upload level: Each log has an importance level of 1, 2, or 3. Level 1 is the most important, followed by level 2, and then level 3. If you set the minimum reporting level to 2, logs with levels 1 and 2 are reported, but level 3 logs are not. The default level for custom behavior tags is 2. For iOS applications, you can modify the log level during client-side tagging. For more information, see iOS custom behavior tagging.
-
Uploaded logs: Client-side tagging logs are first written to a local file. When the log count for this business code type reaches the specified threshold, the logs are automatically reported to the Mobile Analysis Service server. For more information, see Android automatic log reporting or iOS automatic log reporting.
-
Log upload rate: The rate of log reporting, calculated per user. This is a per-mille value. For example, a value of 1000 means logs are reported for all users.
-
Strategy: If you check the Upload in background policy, the reporting time varies by platform.
-
Android: Automatic log reporting is triggered when the application enters the background for more than half an hour.
-
iOS: Automatic log reporting is triggered immediately when the application enters the background. For more information, see Android log reporting or iOS log reporting.
-
Initialize the business
Client-side logs are automatically reported to the Mobile Analysis Service server when specified conditions are met. The default tagging configuration determines the trigger conditions for automatic reporting. After creating a new application, use the Initialize Business feature to sync the default tagging configurations to the new application.
To initialize the business configuration, click Initialize Business on the page and confirm the action. After initialization, the default tagging configuration list is displayed.
Even if you do not use the Initialize Business feature to sync the default tagging configurations to the new application's list, the default configurations still take effect. However, they will not be displayed in the tagging configuration list.
Mock
In addition to adding and modifying tagging configurations on the console page, you can configure tagging directly using JSON. However, we do not recommend this approach for the following reasons:
-
The mock feature is only a convenient way to configure tagging and does not provide additional features.
-
If you configure the same business tag using both the console page and the mock feature, the mock configuration takes precedence.
-
If you are not familiar with the tagging configuration format, incorrect use could affect the default automatic log reporting behavior.
Add a mock configuration
To add a mock configuration:
-
On the Configure Upload Switch page, click Add Mock Configuration.
-
Fill in the configuration information.
-
Version: Select your application version.
-
Platform: Select the application type.
-
Value: The configuration information in JSON format. For more information, see the Mock configuration format section below.
-
-
Verify the information and click OK to add the mock configuration.
Mock configuration format
The mock configuration format is as follows:
{
"LogHeader1": {
"BusinessCode1": {
"write": "yes",
"send": [
"wifi"
],
"maxLogCount": 50,
"level": 3,
"uploadRate": 1000,
"event": [
"gotoBackground"
]
},
"BusinessCode2": {
...
},
...
},
"LogHeader2": {
...
},
...
}
-
LogHeader: Corresponds to the log header in the tagging configuration.
-
BusinessCode: Corresponds to the business code in the tagging configuration.
-
write: Corresponds to the reporting switch in the tagging configuration. The value is
"yes"when the switch is on, and"no"otherwise. -
send: Corresponds to the network in the tagging configuration. The value is
["2g", "3g", "4g", "wifi"]for All networks and["wifi"]for Wi-Fi only. -
maxLogCount: Corresponds to the log reporting count in the tagging configuration.
-
level: Corresponds to the minimum reporting level in the tagging configuration.
-
uploadRate: Corresponds to the log reporting rate in the tagging configuration.
-
event: Corresponds to the policy in the tagging configuration. The value is
["gotoBackground"]if the Report in Background policy is selected, and[]otherwise.