Defining a Metric
Follow the steps below to define the metrics in the developer portal.
Select the application in the developer portal.
Click on the "Analytics" icon (the icon with bar graphs).
Press either the "+Add" button or "Create a Rule".
This will bring up the "Aggregation Rules" screen.
Enter the rule name and select "App Data".
Press "+Add" button and define how Kii Cloud interprets the application data (i.e., the conversion rule). Fill the following information:
- Name: The name of the conversion rule.
- Bucket Name and Scope: The name and scope of the source bucket in which the app data to be analyzed is stored.
- Column, Source and Type: The data fields to be analyzed. Define the following information:
- Column: The name assigned to the field.
- Source: The actual field name.
- Type: The type of field value (int, string, float, or boolean).
You can add more columns by clicking the "+" button. Click the "-" button to delete a column.
Currently, we do not support multi-byte characters. If you specify a field having either a multi-byte field name or field value, you will not get the expected results.
The following example illustrates how to set the conversion rule for our sample scenario.
- The conversion rule name is set as "High Score Tracking".
- The data source (the target bucket) is set as the application-scope bucket "score".
- The following three columns are set:
- The column "UserScope" for the data field "Score" with the data type "int".
- The column "UserLevel" for the data field "Level" with the data type "string".
- The column "AppVersion" for the data field "AppVersion" with the data type "int".
Click on "Save" when done.
Next, you will configure the rest of the aggregation rule.
- Fact: The field to be aggregated as a fact.
- Aggregate: The function used for aggregating the fact.
The available functions are: Count, Avg, Sum, Min, and Max.
- Count: Count up the number of data with the valid values in the fact field.
- Avg: Calculate the average of the values in the fact field.
- Sum: Sum up the values in the fact field.
- Min: Determine the minimum value in the fact field.
- Max: Determine the maximum value in the fact field.
- Dimensions: The column(s) to be used for slicing and dicing the aggregates.
For example, check the following snapshot to see how to configure the rule for Metric #1 (Average of "Score", sliced by "Level" and "AppVersion") of our sample scenario:
Now let's see how to set up Metric #2 (Total count of data (i.e. total score data uploaded), sliced by "Score", "Level" and "AppVersion") of our sample scenario:
Click on "Save" when done.
The new aggregation rule now appears in the list.
Let us now activate the rule. Open the rule by clicking it and click on the "Activate" button to turn the rule on.
The aggregation rule will be now active. Note that the aggregation rule ID is now assigned (#15 in this case). We will use this ID when getting the analysis results from the client SDK.
You can edit the existing metrics. When you edit the existing metrics, however, all previous results will be discarded. It is recommended not to adjust your metrics in operation but to define them carefully before you roll out them.