Data shape of the resulting report JSON.
Closed this issue · 3 comments
The shape of the resulting report JSON consists of 1 column per metric (for a set of segments if these are defined in the filters) and 1 row per dimension value (1 row per day for example).
If we intend to create a report with the same data as a Freeform table from an Adoe Analytics Dashboard, where we have M
metrics, S
segments and D
dimension values, using the /reports
endpoint this would result in a JSON report with M*S
columns and D
rows. This shape is quite different when compared to the shape of the data in the Freeform table (M
columns by S
rows)
My question, with the aim of obtaining a JSON format as close as possible as the one in the Freeform table, is if it is possible to, instead of having 1 row per Dimension value, have 1 row per Segment (from a specified list of segments), thus also resulting in only 1 column per Metric.
Example of the intended JSON:
...
"columns":{
"dimension":{
"id":"variables/daterangeday",
"type":"time"
},
"columnIds":[
"Day",
"Metric_X,
"Metric_Y",
]
},
"rows":[
{
"itemId":"121",
"value":"Segment_A",
"data":["Nov 1 2019", 65.0, 44.0]
},
{
"itemId":"122",
"value":"Segment_B",
"data":["Nov 1 2019", 31.0, 87.0]
},
{
"itemId":"123",
"value":"Segment_C",
"data":["Nov 1 2019", 21.0, 43.0]
}
],
"summaryData":{
...
Is it possible to obtain this format? Or something similar?
Hi @goncalocapelalopes, to make sure I understand the use case you're describing, do you have an example Freeform table screenshot you can share showing the shape you're trying to achieve?
Hello @saverett,
I can't share an exact screenshot but suppose we have the following Freeform table data, hope it is enough to exemplify my issue:
Segments | Metric_X | Metric_Y |
---|---|---|
Segment_A | 65 | 44 |
Segment_B | 31 | 87 |
Segment_C | 21 | 43 |
The JSON format I would like to get from the API is the one I detailed in my previous comment, but the one the API returns is something similar to the following:
...
"columns":{
"dimension":{
"id":"variables/daterangeday",
"type":"time"
},
"columnIds":[
"Metric_X, Segment_A,
"Metric_X, Segment_B,
"Metric_X, Segment_C,
"Metric_Y, Segment_A,
"Metric_Y, Segment_B,
"Metric_Y, Segment_C,
]
},
"rows":[
{
"itemId":"123",
"value":"Nov 1 2019",
"data":[65.0, 44.0, , 31.0, 87.0, 21.0, 43.0]
}
],
...
The API returns the data for different segment/metric combinations stacked in 1 row. As I show in my first comment, I'm looking for a report JSON structure that better resembles the data in the Freeform table.
@goncalocapelalopes thank you for providing those additional details.
The shape format you're asking about is not currently supported. There will be a separate columnId
in the API response for each metric/segment combination, and the Freeform table UI is built to use the indexes of the row data to show only a single column for each metric.
Here's an example request JSON for how the UI requests this type of report:
{
...
"metricContainer": {
"metrics": [{
"columnId": "METRIC_X_SEGMENT_A",
"id": "metrics/occurrences",
"filters": [
"SEGMENT_A"
]
},
{
"columnId": "METRIC_Y_SEGMENT_A",
"id": "metrics/visits",
"filters": [
"SEGMENT_A"
]
},
{
"columnId": "METRIC_X_SEGMENT_B",
"id": "metrics/occurrences",
"filters": [
"SEGMENT_B"
]
},
{
"columnId": "METRIC_Y_SEGMENT_B",
"id": "metrics/visits",
"filters": [
"SEGMENT_B"
]
},
{
"columnId": "METRIC_X_SEGMENT_C",
"id": "metrics/occurrences",
"filters": [
"SEGMENT_C"
]
},
{
"columnId": "METRIC_Y_SEGMENT_C",
"id": "metrics/visits",
"filters": [
"SEGMENT_C"
]
}
],
"metricFilters": [{
"id": "SEGMENT_A",
"type": "segment",
"segmentId": "idA"
},
{
"id": "SEGMENT_B",
"type": "segment",
"segmentId": "idB"
},
{
"id": "SEGMENT_C",
"type": "segment",
"segmentId": "idC"
}
]
}
...
}
Feel free to submit a feature feedback request for the shape you were asking about via experience.adobe.com by clicking the question mark icon in the top right of the screen and selecting the "Feedback" tab.