Google アナリティクスの MCP サーバーを試します。
GitHub からインストールし、詳細については
お知らせをご覧ください。
OrderBy
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
順序指定では、レスポンスで行を並べ替える方法を定義します。たとえば、イベント数を降順で並べ替える順序と、イベント名の文字列で並べ替える順序は異なります。
JSON 表現 |
{
"desc": boolean,
// Union field one_order_by can be only one of the following:
"metric": {
object (MetricOrderBy )
},
"dimension": {
object (DimensionOrderBy )
},
"pivot": {
object (PivotOrderBy )
}
// End of list of possible types for union field one_order_by .
} |
フィールド |
desc |
boolean
true の場合、降順で並べ替えます。
|
共用体フィールド one_order_by 。OrderBy に 1 つの並べ替え順序を指定します。one_order_by は次のいずれかになります。 |
metric |
object (MetricOrderBy )
結果を指標の値で並べ替えます。
|
dimension |
object (DimensionOrderBy )
結果をディメンションの値で並べ替えます。
|
pivot |
object (PivotOrderBy )
ピボット列グループ内で指標の値で結果を並べ替えます。
|
MetricOrderBy
JSON 表現 |
{
"metricName": string
} |
フィールド |
metricName |
string
並べ替えるリクエスト内の指標名。
|
DimensionOrderBy
JSON 表現 |
{
"dimensionName": string,
"orderType": enum (OrderType )
} |
フィールド |
dimensionName |
string
並べ替えるリクエスト内のディメンション名。
|
orderType |
enum (OrderType )
ディメンション値の並べ替えのルールを制御します。
|
OrderType
列挙型 |
ORDER_TYPE_UNSPECIFIED |
(指定なし) |
ALPHANUMERIC |
英数字は Unicode コードポイントで並べ替えられます。たとえば、「2」<「A」<「X」<「b」<「z」です。 |
CASE_INSENSITIVE_ALPHANUMERIC |
大文字と小文字を区別しない英数字の並べ替え。小文字の Unicode コードポイントで並べ替えます。たとえば、「2」<「A」<「b」<「X」<「z」です。 |
NUMERIC |
ディメンション値は、並べ替える前に数値に変換されます。たとえば、数値の並べ替えでは「25」<「100」ですが、ALPHANUMERIC の並べ替えでは「100」<「25」です。数値以外のディメンション値はすべて、すべての数値の下に同じ並べ替え値が設定されます。 |
PivotOrderBy
JSON 表現 |
{
"metricName": string,
"pivotSelections": [
{
object (PivotSelection )
}
]
} |
フィールド |
metricName |
string
並べ替えのレスポンスで、この列で行を並べ替えます。リクエストの指標名を指定する必要があります。
|
pivotSelections[] |
object (PivotSelection )
ディメンション名と値のピボットを選択するために使用されます。複数のピボット選択が指定されている場合、ピボット選択のディメンションの名前と値のペアがすべて行のディメンションの名前と値のペアと一致する行が並べ替えられます。
|
PivotSelection
ディメンション名と値のペア。このディメンション ピボット ペアを含む行は、指標の値で並べ替えられます。
たとえば、ピボット =(「ブラウザ」、「Chrome」)で、指標名 =「セッション数」の場合、行は Chrome のセッション数に基づいて並べ替えられます。
---------|----------|----------------|----------|----------------
| Chrome | Chrome | Safari | Safari
---------|----------|----------------|----------|----------------
Country | Sessions | Pages/Sessions | Sessions | Pages/Sessions
---------|----------|----------------|----------|----------------
US | 2 | 2 | 3 | 1
---------|----------|----------------|----------|----------------
Canada | 3 | 1 | 4 | 1
---------|----------|----------------|----------|----------------
JSON 表現 |
{
"dimensionName": string,
"dimensionValue": string
} |
フィールド |
dimensionName |
string
リクエストのディメンション名を指定する必要があります。
|
dimensionValue |
string
名前付きディメンションがこの値の場合にのみ、この値で並べ替えます。
|
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-26 UTC。
[null,null,["最終更新日 2025-07-26 UTC。"],[[["\u003cp\u003eOrderBys determine the sorting of rows in a response, based on metrics, dimensions, or pivots.\u003c/p\u003e\n"],["\u003cp\u003eYou can order by metrics (e.g., event count), dimensions (e.g., event name), or pivot column groups.\u003c/p\u003e\n"],["\u003cp\u003eSorting can be done in ascending or descending order, specified by the \u003ccode\u003edesc\u003c/code\u003e boolean field.\u003c/p\u003e\n"],["\u003cp\u003eDimension sorting offers alphanumeric, case-insensitive alphanumeric, and numeric order types.\u003c/p\u003e\n"],["\u003cp\u003ePivotOrderBy allows sorting within specific pivot column groups based on metric values.\u003c/p\u003e\n"]]],["This content details various methods for sorting data rows in a response, known as \"OrderBys.\" Sorting can be based on metrics (`MetricOrderBy`) or dimensions (`DimensionOrderBy`). Dimensions can be ordered alphanumerically, case-insensitively, or numerically (`OrderType`). `PivotOrderBy` allows sorting by metric values within pivot column groups, using `PivotSelection` to specify dimension-value pairs for focused sorting. `OrderBys` can also be applied in descending order, indicated by the `desc` field.\n"],null,["# OrderBy\n\n- [JSON representation](#SCHEMA_REPRESENTATION)\n- [MetricOrderBy](#MetricOrderBy)\n - [JSON representation](#MetricOrderBy.SCHEMA_REPRESENTATION)\n- [DimensionOrderBy](#DimensionOrderBy)\n - [JSON representation](#DimensionOrderBy.SCHEMA_REPRESENTATION)\n- [OrderType](#OrderType)\n- [PivotOrderBy](#PivotOrderBy)\n - [JSON representation](#PivotOrderBy.SCHEMA_REPRESENTATION)\n- [PivotSelection](#PivotSelection)\n - [JSON representation](#PivotSelection.SCHEMA_REPRESENTATION)\n\nOrder bys define how rows will be sorted in the response. For example, ordering rows by descending event count is one ordering, and ordering rows by the event name string is a different ordering.\n\n| JSON representation |\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"desc\": boolean, // Union field `one_order_by` can be only one of the following: \"metric\": { object (/analytics/devguides/reporting/data/v1/rest/v1beta/OrderBy#MetricOrderBy) }, \"dimension\": { object (/analytics/devguides/reporting/data/v1/rest/v1beta/OrderBy#DimensionOrderBy) }, \"pivot\": { object (/analytics/devguides/reporting/data/v1/rest/v1beta/OrderBy#PivotOrderBy) } // End of list of possible types for union field `one_order_by`. } ``` |\n\n| Fields ||\n|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `desc` | `boolean` If true, sorts by descending order. |\n| Union field `one_order_by`. Specify one type of order by for `OrderBy`. `one_order_by` can be only one of the following: ||\n| `metric` | `object (`[MetricOrderBy](/analytics/devguides/reporting/data/v1/rest/v1beta/OrderBy#MetricOrderBy)`)` Sorts results by a metric's values. |\n| `dimension` | `object (`[DimensionOrderBy](/analytics/devguides/reporting/data/v1/rest/v1beta/OrderBy#DimensionOrderBy)`)` Sorts results by a dimension's values. |\n| `pivot` | `object (`[PivotOrderBy](/analytics/devguides/reporting/data/v1/rest/v1beta/OrderBy#PivotOrderBy)`)` Sorts results by a metric's values within a pivot column group. |\n\nMetricOrderBy\n-------------\n\nSorts by metric values.\n\n| JSON representation |\n|----------------------------------|\n| ``` { \"metricName\": string } ``` |\n\n| Fields ||\n|----------------|----------------------------------------------------|\n| `metric``Name` | `string` A metric name in the request to order by. |\n\nDimensionOrderBy\n----------------\n\nSorts by dimension values.\n\n| JSON representation |\n|-------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"dimensionName\": string, \"orderType\": enum (/analytics/devguides/reporting/data/v1/rest/v1beta/OrderBy#OrderType) } ``` |\n\n| Fields ||\n|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------|\n| `dimension``Name` | `string` A dimension name in the request to order by. |\n| `order``Type` | `enum (`[OrderType](/analytics/devguides/reporting/data/v1/rest/v1beta/OrderBy#OrderType)`)` Controls the rule for dimension value ordering. |\n\nOrderType\n---------\n\nRule to order the string dimension values by.\n\n| Enums ||\n|---------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `ORDER_TYPE_UNSPECIFIED` | Unspecified. |\n| `ALPHANUMERIC` | Alphanumeric sort by Unicode code point. For example, \"2\" \\\u003c \"A\" \\\u003c \"X\" \\\u003c \"b\" \\\u003c \"z\". |\n| `CASE_INSENSITIVE_ALPHANUMERIC` | Case insensitive alphanumeric sort by lower case Unicode code point. For example, \"2\" \\\u003c \"A\" \\\u003c \"b\" \\\u003c \"X\" \\\u003c \"z\". |\n| `NUMERIC` | Dimension values are converted to numbers before sorting. For example in NUMERIC sort, \"25\" \\\u003c \"100\", and in `ALPHANUMERIC` sort, \"100\" \\\u003c \"25\". Non-numeric dimension values all have equal ordering value below all numeric values. |\n\nPivotOrderBy\n------------\n\nSorts by a pivot column group.\n\n| JSON representation |\n|-------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"metricName\": string, \"pivotSelections\": [ { object (/analytics/devguides/reporting/data/v1/rest/v1beta/OrderBy#PivotSelection) } ] } ``` |\n\n| Fields ||\n|-----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `metric``Name` | `string` In the response to order by, order rows by this column. Must be a metric name from the request. |\n| `pivot``Selections[]` | `object (`[PivotSelection](/analytics/devguides/reporting/data/v1/rest/v1beta/OrderBy#PivotSelection)`)` Used to select a dimension name and value pivot. If multiple pivot selections are given, the sort occurs on rows where all pivot selection dimension name and value pairs match the row's dimension name and value pair. |\n\nPivotSelection\n--------------\n\nA pair of dimension names and values. Rows with this dimension pivot pair are ordered by the metric's value.\n\nFor example if pivots = ('browser', 'Chrome') and metricName = \"Sessions\", then the rows will be sorted based on Sessions in Chrome. \n\n ---------|----------|----------------|----------|----------------\n | Chrome | Chrome | Safari | Safari\n ---------|----------|----------------|----------|----------------\n Country | Sessions | Pages/Sessions | Sessions | Pages/Sessions\n ---------|----------|----------------|----------|----------------\n US | 2 | 2 | 3 | 1\n ---------|----------|----------------|----------|----------------\n Canada | 3 | 1 | 4 | 1\n ---------|----------|----------------|----------|----------------\n\n| JSON representation |\n|---------------------------------------------------------------|\n| ``` { \"dimensionName\": string, \"dimensionValue\": string } ``` |\n\n| Fields ||\n|--------------------|----------------------------------------------------------------|\n| `dimension``Name` | `string` Must be a dimension name from the request. |\n| `dimension``Value` | `string` Order by only when the named dimension is this value. |"]]