Functionality of the Flex Analytics Feature
As described in Flow of Flex Analysis, in order to perform a flex analysis, set an aggregation rule and get analysis results in the developer portal or your device.
This topic shows the steps to set an aggregation rule and available features when you get analysis results in the developer portal.
To learn how to perform a flex analysis, see the following sections:
From the viewpoint of the Application Analytics feature, items that are measured in your application are called metrics. For example, the number of users and its sub categories such as the number of created users and the number of deleted users are metrics. Timeline graphs for changes in these metrics will be displayed in the developer portal.
In order to analyze app data or event data, you need to define how to convert data of KiiObjects and events into metrics in advance. The procedures are the same for app data and event data.
You define your custom metrics by configuring the axes of the graph.
First, configure the y-axis by selecting a fact (which data field to aggregate) and an aggregate method (how to aggregate). The example in Analyzing App Data defines the average value of the
Select a field from the JSON data in KiiObjects or event data as a fact.
You can select one from the following aggregate methods. When you select a field that has the type other than int or float, you can only select the first option (count).
- The count of the data that have the valid values in the specified field.
- The average of the values in the specified int/float field.
- The sum of the values in the specified int/float field.
- The maximum value in the specified int/float field.
- The minimum value in the specified int/float field.
Only a pair of a fact and an aggregate method determines the y-axis of a graph. Although you can configure items like dimensions and filters (which we will explain later), they do not affect the y-axis.
The x-axis of the graph shows the time, and you cannot customize it. The data interval is 24 hours.
Dimension is a field to be used as a grouping key for the fact values. By setting a dimension, you can group data in the graph per the value of the dimension field. This means that the number of graphs you will see is equal to the number of the dimension field values (Note that if there are many dimension fields, some of them will be aggregated as "Other").
For example, if the fact is "temperature" and the dimension is "city", the graph shows changes in the temperature per city in chronological order. If the dimension is "weather", the graph shows those per weather. Note that the y-axis always indicates the temperature for different dimensions.
You can analyze values of the y-axis with various dimensions to find the reason and background for the changes in the graph.
You can define multiple dimensions. When viewing the graph, however, you can only select one of them. You can switch the dimension while viewing the graph.
When you are going to use an attribute that will have many variations (e.g., age) as a dimension, consider defining classes rather than using raw values. We recommend you to calculate the classes in your mobile app and use them for the analysis.
Suppose you are using "age" as a dimension. If you use raw value, there will be many variations in the dimension (20, 21, 22 and so on) that will make the result less useful. The analysis results become more informative by introducing classes like "20-29" and "30-39" and registering the data with these classes.
If it is difficult to register classes together with the analysis data, you can add classes by using a server hook later.
You can view the analysis results in the developer portal. You can also get the results (raw data used for creating the graphs in the developer portal) via dedicated APIs.
When viewing/getting the results, you can perform the followings:
Change the data range
You can specify the data range to be shown in the x-axis of the graph. This will be useful to focus on the specific date and time.
Kii Cloud aggregates the results every 24 hours. You cannot get finer results than this time interval.
Filter by a field value
Besides the dimension, you can filter the data with a certain field value. For instance, in the example above, you can view the aggregated results only from data whose "weather" field has "rain" while viewing the graph with the "city" dimension.
The filter only narrows down the data. It will not slice the graph like the dimension does.
Filter by values of a dimension
While viewing the graph with a dimension, you can filter the data with selected values of the dimension. For instance, in the example above, you can view the aggregated results grouped by the "city" dimension and show only data from Tokyo and Osaka.
Check the cumulative values
The cumulative value for the metric in the current data range will be automatically calculated. When the y-axis is showing the average, the cumulative value will be its accumulated mean value. If the y-axis is showing the count, then the cumulative value will be the total sum.
If you are using a dimension, the cumulative values will be shown for each value in the dimension.
You can deeply understand the target data by combining these features.
For example, the aggregated results grouped by weather in Dimension above does not tell clear characteristics of the temperature data. By combining filters, you can see its characteristics. As shown in the figure below, you can visually perceive the tendency that the average temperature of cloudy days (light blue) is higher than that of rainy days (green) by showing aggregated results only from rainy and cloudy days in Tokyo.
You can get the detailed analysis results by using the Kii Cloud SDK and the REST API.
The obtained results can be displayed on your mobile and web apps with your preferred method.