This API allows to compare aggregated data across multiple filters. The API is somewhat similar to /traffic/compare, and the main difference is that this API allows to compare up to 100 defined populations instead of two, but aggregates only one group at a time and does not support historyFields. A typical use case for this API is to create a table or a heat map such as the one that can be found under Comparison/Dimensions in the Insight UI.
The user must be authenticated and have read permissions to the specified sites.
The time, field and filter selection restrictions are the same as for each particular type. See for example /traffic/event, /traffic/keyword or /traffic/custom.
Request
The request object has the following fields:
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
|
Integer or String |
No |
The start time of the aggregation period specified according to Traffic time specification . The default value is one hour ago. |
|
|
Integer or String |
No |
The stop time of the aggregation period specified according to Traffic time specification . The default value is right now. |
|
|
String |
No |
The site to aggregate over. A more convenient alternative to |
|
|
Array of String |
No |
The set of sites to aggregate over. |
|
|
String |
No |
The site group to aggregate over. A more convenient alternative to |
|
|
Array of String |
No |
The set of site groups to aggregate over. |
|
|
Array of Object |
No |
Traffic filters ) to be applied for all data. Conjunctive semantics ( |
|
|
Array of Object |
No |
The filters to be applied for each result column. Filter syntax is documented here . For multiple predicates in each column AND must be declared explicitly. The maximum number of columns is 20. |
|
|
String |
Yes |
The type of data, if not specified the data to be returned includes only the summary. The supported types are:'traffic', 'event', 'custom', 'keyword', 'user-keyword', 'user-external', 'intent', 'dmp', 'dmp-event', 'dmp-custom'. |
|
|
Array of String |
No |
The group names for the specified data type, must be specified for types other than 'traffic' and 'dmp'. Use describe of the specified type (e.g., /traffic/event/describe for event) to list the available groups. Only one group can be specified per call, array is used to keep the API consistent with the other APIs. |
|
|
Integer |
No |
The maximum number of items (rows). The default value is |
|
|
Array of String |
No |
The metrics to aggregate. The available field names are listed here . See the API corresponding to the specified type (e.g., /traffic/keyword for keyword) for a list of supported fields. |
Alternatively to 'columnFilters', columns can be specified using 'columnType', 'columnGroup' and 'columnCount':
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
|
String |
Yes |
The type of data, if not specified the data to be returned includes only the summary. The supported types are: 'traffic', 'event', 'custom', 'keyword', 'user-keyword', 'user-external', 'intent', 'dmp', 'dmp-event', 'dmp-custom'. |
|
|
String |
Yes |
The group name for the specified data type, must be specified for types other than 'traffic' and 'dmp'. Use describe of the particular type, for example /traffic/event/describe , to list available groups. |
|
|
Integer |
No |
The maximum number of items (rows). The default value is |
The latter approach is equivalent to finding top items for the given type, group and count and creating column filters using these. For practical reasons, the response in this case includes the names and when requested/possible titles of the extracted top-items.
Response
The response object has the following fields:
|
Name |
Type |
Description |
|---|---|---|
|
|
Integer |
The start time of the aggregation period in seconds, measured in Unix time . |
|
|
Integer |
The stop time of the aggregation period in seconds, measured in Unix time . |
|
columnItems |
Array of Object |
Returned when the columns are specified using ' |
|
|
Object |
Contains the data summary aggregated according to ' |
|
|
Object |
Contains the data aggregated according to ' |
|
|
Array of Object |
Contains the data summary for each group aggregated according to ' |
The groups array is either empty or contains a single group object with following fields:
|
Name |
Type |
Description |
|---|---|---|
|
|
String |
The name of the group. |
|
|
Object |
Returned only for the keyword-based types. Contains the group summary aggregated according to ' |
|
|
Object |
Returned only for the keyword-based types. Contains the group summary aggregated according to ' |
|
|
Array of Object |
The top-items according to ' |
Each item object contains three fields:
|
Name |
Type |
Description |
|---|---|---|
|
|
String |
The name of the item. |
|
|
Object |
Contains the data aggregated according to ' |
|
|
Object |
Contains the data aggregated according to ' |
Examples
$ cx.py /traffic/table '{"siteId":"9222302702321341959", "start":"-1d", "type":"event", "groups":["resolution"], "columnType":"event", "columnGroup":"deviceType"}'
{
"columnItems": [
{
"item": "Mobile"
},
{
"item": "Desktop"
},
{
"item": "Tablet"
}
],
"stop": 1433772892,
"start": 1433686492,
"columnData": {
"events": [
17295,
6268,
3121
]
},
"groups": [
{
"items": [
{
"columnData": {
"events": [
2223,
773,
395
]
},
"item": "1280x768",
"data": {
"events": 3391
}
},
{
"columnData": {
"events": [
2215,
767,
396
]
},
"item": "1280x1024",
"data": {
"events": 3378
}
},
{
"columnData": {
"events": [
2188,
788,
389
]
},
"item": "1920x1200",
"data": {
"events": 3365
}
},
{
"columnData": {
"events": [
2110,
821,
403
]
},
"item": "1024x768",
"data": {
"events": 3334
}
},
{
"columnData": {
"events": [
2121,
794,
401
]
},
"item": "2560x1080",
"data": {
"events": 3316
}
},
{
"columnData": {
"events": [
2156,
779,
367
]
},
"item": "2560x1600",
"data": {
"events": 3302
}
},
{
"columnData": {
"events": [
2170,
761,
371
]
},
"item": "800x600",
"data": {
"events": 3302
}
},
{
"columnData": {
"events": [
2111,
765,
399
]
},
"item": "480x640",
"data": {
"events": 3276
}
},
{
"columnData": {
"events": [
0,
18,
0
]
},
"item": "2560x1440",
"data": {
"events": 18
}
},
{
"columnData": {
"events": [
0,
2,
0
]
},
"item": "1920x1080",
"data": {
"events": 2
}
}
],
"group": "resolution"
}
],
"data": {
"events": 26684
}
}