Search code examples
androidiosanalyticshuawei-mobile-services

Why reporting of custom events fails when I was conducting cross-platform data analysis using User-ID?


I have integrated the iOS SDK and Android SDK of HUAWEI Analytics Kit and plan to use User-ID to perform cross-platform and cross-device analysis to find out the lifecycle and behavior differences between iOS and Android users. However, after I added a custom event for testing, the event is not displayed on the Real-time monitoring and App debugging pages. The code is as follows:

@Override
public void onClick(View v) {
for (int i = 0; i < 9; i++) {
// Set the custom event name to Purchase.
String eventId = "Purchase Test" + i;// DTM_Test
// Set parameters of the custom event.
Bundle bundle = new Bundle();
bundle.putDouble("price", 9.99 + i);
bundle.putLong("quantity", 100 + i);
bundle.putString("currency", "CNY");
// Trigger event reporting.
instance.onEvent(eventId, bundle);
}

Solution

  • In the code, eventId is Purchase Test, which contains a space character. This does not comply with the event ID definition rule. As a result, the event is filtered out.

    Event ID definition rule of HUAWEI Analytics Kit: An event ID cannot be left empty or contain spaces. It can consist of a maximum of 256 characters including digits, letters, and underscores (_) but cannot start with a digit. In addition, its value cannot be the same as the ID of an automatically collected event.

    Therefore, you can change Purchase Test to Purchase_Test or any other value that complies with the preceding rule.

    If you have multiple iOS and Android apps in a project, you can use the filter to view the overall analysis report or detailed report of an app. You can even link users' activity data from different devices by using User-ID to obtain cross-platform analysis data. For details about cross-platform analysis.