KPI and Sparkline (Report element)
- 6 Minutes to read
- Print
- DarkLight
KPI and Sparkline (Report element)
- 6 Minutes to read
- Print
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
Metrics and Formulas can be shown in a report as "Single KPI" or "Sparkline." "Single KPI" shows the total number, while "Sparkline" shows the daily development.
Creation and copying of the configuration
Add a KPI/Sparkline to a report. Learn more about it in the training chapter.
Finish the configuration.
In the report edit mode, click “Copy JSON configuration”.
Example Call
{
"resultType": "DATA_ONLY",
"queryObject": {
"type": "KPI",
"metricName": "pages_pageImpressions",
"dimensionName": "time_days",
"predefinedContainer": {
"filters": [
{
"name": "time_range",
"connector": "AND",
"filterPredicate": "BETWEEN",
"value1": "2020-10-14 00:00:00",
"value2": "2020-11-11 00:00:00",
"context": "NONE",
"caseSensitive": false
}
],
"containers": []
}
}
}
KPI Response
Sample KPI response
{
"calculationDataType": "RAW_DATA",
"rows": [
[
"0000000000", //
1306 // -> page Impressions
]
],
"rowCount": 1,
"rowCountTotal": 1,
"headers": [
{
"alias": "time_id_categories_t_year_month_day|0",
"arrangeType": "time_id_categories_t_year_month_day",
"sumPositions": [
0
],
"name": "time_days",
"metric": false,
"dimension": true
},
{
"alias": "page_impressions|0",
"arrangeType": "page_impressions",
"name": "pages_pageImpressions",
"metric": true,
"dimension": false,
"sortIndex": 1,
"sortDirection": "DESCENDING"
}
],
"columnCount": 2,
"warnings": [],
"information": [],
"timerange": [
"2020-10-14 00:00:00",
"2020-11-11 00:00:00"
],
"timestamp": "2022-10-18T15:35:45.404+0200"
}
KPI Comparison Call
KPI Comparison Call
{
"resultType": "DATA_ONLY",
"queryObject": {
"type": "KPI",
"metricName": "pages_pageImpressions",
"dimensionName": "time_days",
"predefinedContainer": {
"filters": [
{
"name": "time_range",
"connector": "AND",
"filterPredicate": "BETWEEN",
"value1": "2020-10-14 00:00:00",
"value2": "2020-11-11 00:00:00",
"context": "NONE",
"caseSensitive": false
}
],
"containers": []
},
"comparison": {
"type": "PERIOD",
"filter": {
"name": "time_range",
"value1": "2022-03-02 00:00:00",
"value2": "2022-03-06 00:00:00",
"filterPredicate": "BETWEEN",
"connector": "AND",
"context": "NONE",
"caseSensitive": false
}
}
}
}
KPI Comparison Response
Sample KPI Comparison Response
{
"calculationDataType": "RAW_DATA",
"rows": [
[
"000000000" // -> Total row indication
1306, // -> Page Impressions KPI time range
1502 // -> Page Impressions comparison time range
]
],
"rowCount": 1,
"rowCountTotal": 1,
"headers": [
{
"alias": "time_id_categories_t_year_month_day|0", // -> Dimension Column for position of TOTAL (footer)
"arrangeType": "time_id_categories_t_year_month_day",
"sumPositions": [
0
],
"name": "time_days",
"metric": false,
"dimension": true
},
{
"alias": "page_impressions|0", // -> Page Impressions KPI time range
"arrangeType": "page_impressions",
"name": "pages_pageImpressions",
"metric": true,
"dimension": false,
"sortIndex": 1,
"sortDirection": "DESCENDING"
},
{
"alias": "page_impressions|1", // -> Page Impressions comparison time range
"arrangeType": "page_impressions",
"name": "pages_pageImpressions",
"metric": true,
"dimension": false
}
],
"columnCount": 3,
"warnings": [],
"information": [],
"timerange": [
"2020-10-14T00:00:00.000+0200",
"2020-11-11T00:00:00.000+0100"
],
"timestamp": "2022-10-19T10:03:21.351+0200"
}
Sparkline Call
Sparkline Call
{
"resultType": "DATA_ONLY",
"queryObject": {
"type": "SPARKLINE",
"metricName": "pages_pageImpressions",
"dimensionName": "time_days",
"predefinedContainer": {
"filters": [
{
"name": "time_range",
"connector": "AND",
"filterPredicate": "BETWEEN",
"value1": "2020-10-14 00:00:00",
"value2": "2020-11-11 00:00:00",
"context": "NONE",
"caseSensitive": false
}
],
"containers": []
}
}
}
Sparkline Response
Sample Sparkline Response
{
"calculationDataType": "RAW_DATA",
"rows": [ // -> Sparkline Data Points
[
"20201014",
408
],
[
"20201015",
148
],
...
[
"0000000000",
1306
]
],
"rowCount": 29,
"rowCountTotal": 28,
"headers": [
{
"alias": "time_id_categories_t_year_month_day|0",
"arrangeType": "time_id_categories_t_year_month_day",
"sumPositions": [
28
],
"name": "time_days",
"metric": false,
"dimension": true,
"sortIndex": 1,
"sortDirection": "ASCENDING"
},
{
"alias": "page_impressions|0",
"arrangeType": "page_impressions",
"name": "pages_pageImpressions",
"metric": true,
"dimension": false
}
],
"columnCount": 2,
"information": [],
"warnings": [],
"timerange": [
"2020-10-14 00:00:00",
"2020-11-11 00:00:00"
],
"timestamp": "2022-10-18T15:31:31.871+0200"
}
Was this article helpful?