Order data
Supermetrics API supports two separate parameters to order data.
Parameters
-
order_rows
string | string[]
Optional. Common order instructions for data in rows. See ordering rows.
-
order_columns
string
Optional. Order instruction for data in columns. See ordering columns.
Ordering rows
Use parameter order_rows to order returned rows. Limited to two instructions.
{"order_rows": ["[field_name] [asc|desc]", ...]}
Value can be provided either as a comma delimited string, or as a list of strings.
{"order_rows": "CampaignName asc, impressions desc"}
{"order_rows": ["CampaignName asc", "impressions desc"]}
Ordering columns
Parameter order_columns only applies when query contains at least one field that splits the data by column, like in the following example.
{
"fields": [{"id":"campaign", "split":"column"}],
"order_columns": "alphabetic"
}
Order column types
Type | Description |
met_desc | Order descending by first metric. Default. |
alphabetic | Order dimension values alphabetical order |
reverse_alphabetic | Order dimension values in reversed alphabetical order |
Last updated 2022-06-15 UTC.