[Huawei Developers] Mike-mei:
HMS Core Analytics Kit allows developers to download event data and import it to their own analytics systems to build custom reports or generate personalized audience analysis reports, thereby helping make effective marketing activities. Developers can filter data for export by user attribute or event, and view the estimated number of events to be exported. The number of estimated events changes as different time periods and filter criteria are selected.

Problem Description​

I find that the data task I created incorrectly obtains data of the day preceding the selected date. The data table for December 18, 2021 contains records whose event time (eventtime) stretches back to December 17, 2021, as shown in the figure below.

View attachment 5802971

Troubleshooting​

1. Check the baseline time for data export.

When I encountered this problem, I first checked which time is used when creating the data export task, as the baseline time for data export. Then, I checked the cloud data export rules and discovered that the selected date is judged based on the HUAWEI Analytics server time.

2. Analyze the proportion and characteristics of data reported across days.

Take an app's data on December 9 as an example. The total number of data records collected on this date by the server time is 15xxxxx. Among those records, the proportion of records whose event time is December 9 is 97.3%. About 2.65% of data records have December 8 as their event time. The data has no obvious characteristics. During data transmission from the server, the event time in the data is transparently transmitted and will not be calculated additionally.

3. Check the event reporting in the app and recur the problem.

The event time indicates the time when an event is triggered. I suspected that the triggered events are not reported to the server in time. Instead, the events were reported to the server on the next day, meaning the events were cached locally.

Upon analysis, I found that the default event reporting policies are used, that is, an event is reported when the app is minimized or when the specified threshold is reached. If no event reporting policy is specified, these two policies will take effect automatically. When the app is minimized, an event will be triggered to report. If the app process is stopped before event reporting is complete, the event will fail to be reported and will be cached locally for reporting next time the app starts. There are two other causes, which I'll describe in the next part.

Cause Analysis​

When the app is minimized, an event report will be triggered. However, before event reporting is complete, the app process is stopped, resulting in the event being unreported and it being cached locally for reporting the next time the app starts.

Poor network conditions may result in the event triggered by the app being minimized from being reported.

The user uses the app around midnight. As a result, the event to be triggered before midnight may be cached and reported after midnight, that is, on the next day.

Solution​

Call setReportPolicies to set four event reporting policies, and set the scheduled reporting interval to a value between 60 seconds (most sensitive) and 1800 seconds. If the interval is set to 60 seconds, data generated more than 60 seconds earlier than the time when the app process is stopped can be properly reported, avoiding data reporting delay.

For more details, you can go to:

>> Analytics Kit official website

>> Development Documentation page, to find the documents you need

>> Reddit to join developer discussion

>> GitHub for downloading demos and sample codes