Edit in GitHubLog an issue

Breakdown dimensions

Breakdowns in the reporting API are useful when you want to see the cross-product of values from two different dimensions. When requesting a breakdown report, use the metricsFilters and dimension parameters to request the additional dimension.

The following example requests a breakdown report containing a list of the top five "Internal Search Terms" used by visitors who saw campaign 10. Within the metricsFilters parameter, the type is set to breakdown (line 21), and evar1 is the marketing campaign (line 22). Within the dimensions parameter, evar2 is the "Internal Search Terms" (line 27).

Copied to your clipboard
{
"rsid":"examplersid",
"globalFilters":[
{
"type":"dateRange",
"dateRange":"YYYY-12-31T00:00:00.000/YYYY-01-06T23:59:59.999"
}
],
"metricContainer":{
"metrics":[
{
"columnId":"0",
"id":"metrics/pageviews",
"filters":[
"0"
]
}
],
"metricFilters":[
{
"id":"0",
"type":"breakdown",
"dimension":"evar1",
"itemId":"743855946"
}
]
},
"dimension":"variables/evar2",
"settings":{
"dimensionSort":"asc",
"limit":5
}
}

Multi-level breakdowns

Multiple level breakdowns with the Reports API is helpful for visualizing the cross-product of values from three or more dimensions.

For example, if you create an interactive map to explore product sales by campaigns and regions, the Reports API can dynamically update the map as new data becomes available. This allows team members to select different map locations from which they can view the current campaigns and product sales for the region.

In the following example, these levels are used:

  1. Top level: Visualize the Day dimension filtered by the Page Views and Visits metrics.
  2. Second level: Visualize the previous level of data after a specifying a Date and applying the Page dimension.
  3. Third level: Visualize the previous two levels of data after applying the Cities dimension to a specified page.

For each level of the breakdown report below, a sample JSON request and response is provided.

Top level report

The top level report in the following example shows the dimension Day and includes the metrics Page Views and Visits. The date range is set to the week of November 18, 2018.

multiple_breakdowns_example_1

Top level request

The JSON message request body for this report request follows:

Copied to your clipboard
{
"rsid": "examplersid",
"globalFilters": [
{
"type": "dateRange",
"dateRange": "YYYY-11-18T00:00:00.000/YYYY-11-25T00:00:00.000"
}
],
"metricContainer": {
"metrics": [
{
"columnId": "0",
"id": "metrics/pageviews"
},
{
"columnId": "1",
"id": "metrics/visits"
}
]
},
"dimension": "variables/daterangeday",
"settings": {
"countRepeatInstances": true,
"limit": 400,
"page": 0,
"dimensionSort": "asc"
}
}

Second level breakdown

For the second level, you can break down a specific date by the Page dimension. In order to do this, note the previous JSON response for the Nov 19, 2018 date:

Copied to your clipboard
"itemId": "1181019",
"value": "Nov 19, 2018",
"data": [
73,
37
]

The response shows itemId 1181019, so we will use that in our report request below.

multiple_breakdowns_example_2

Second level request

The JSON message request body for this report request looks like the following. Note that the metricFilters attribute in the request contains a metric filter that corresponds to a metric in the metrics attribute of the request. Each metric has a filters array that applies metric filters to the metric column. In this example, we are applying metric filter 0 to the Page Views metric column and metric filter 1 to the Visits metric column.

Copied to your clipboard
{
"rsid": "examplersid",
"globalFilters": [
{
"type": "dateRange",
"dateRange": "YYYY-11-18T00:00:00.000/YYYY-11-25T00:00:00.000"
}
],
"metricContainer": {
"metrics": [
{
"columnId": "0",
"id": "metrics/pageviews",
"filters": [
"0"
]
},
{
"columnId": "1",
"id": "metrics/visits",
"filters": [
"1"
]
}
],
"metricFilters": [
{
"id": "0",
"type": "breakdown",
"dimension": "variables/daterangeday",
"itemId": "1181019"
},
{
"id": "1",
"type": "breakdown",
"dimension": "variables/daterangeday",
"itemId": "1181019"
}
]
},
"dimension": "variables/page",
"settings": {
"countRepeatInstances": true,
"limit": 5,
"page": 0
}
}

Third level breakdown

The third level of the example shows how to further break down the report by applying the Cities dimension to the page videoPage3. To do this, we use the itemId of the row containing VideoPage3 in the second level response, which is 364325780. Note the value in the request below:

multiple_breakdowns_example_3

Note that there are now 4 metric filters in the metricFilters array of the request. Filters 0 and 2 are applied to the Page Views metric column, and filters 1 and 3 are applied to the Visits metric column.

Copied to your clipboard
{
"rsid": "examplersid",
"globalFilters": [
{
"type": "dateRange",
"dateRange": "YYYY-11-18T00:00:00.000/YYYY-11-25T00:00:00.000"
}
],
"metricContainer": {
"metrics": [
{
"columnId": "0",
"id": "metrics/pageviews",
"filters": [
"0",
"2"
]
},
{
"columnId": "1",
"id": "metrics/visits",
"filters": [
"1",
"3"
]
}
],
"metricFilters": [
{
"id": "0",
"type": "breakdown",
"dimension": "variables/daterangeday",
"itemId": "1181019"
},
{
"id": "1",
"type": "breakdown",
"dimension": "variables/daterangeday",
"itemId": "1181019"
},
{
"id": "2",
"type": "breakdown",
"dimension": "variables/page",
"itemId": "364325780"
},
{
"id": "3",
"type": "breakdown",
"dimension": "variables/page",
"itemId": "364325780"
}
]
},
"dimension": "variables/geocity",
"settings": {
"countRepeatInstances": true,
"limit": 5,
"page": 0
}
}
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.