試用 Google Analytics 的 MCP 伺服器。從
GitHub 安裝,詳情請參閱
公告。
Dimension
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
維度是資料的屬性。舉例來說,「城市」維度會指出事件的來源城市。報表回應中的維度值為字串,例如城市名稱可能為「巴黎」或「紐約」。要求最多可包含 9 個維度。
欄位 |
name |
string
維度的名稱。如要查看核心報表方法 (例如 runReport 和 batchRunReports ) 支援的維度名稱清單,請參閱「API 維度」。如需 runRealtimeReport 方法支援的維度名稱清單,請參閱「即時維度」。如要查看 runFunnelReport 方法支援的維度名稱清單,請參閱「漏斗維度」。 如果指定 dimensionExpression ,name 可以是您在允許的字元集內使用的任何字串。舉例來說,如果 dimensionExpression 連結 country 和 city ,您可以將該維度命名為 countryAndCity 。您選擇的維度名稱必須符合規則運算式 ^[a-zA-Z0-9_]$ 。 dimensionFilter 、orderBys 、dimensionExpression 和 pivots 中的 name 會參照維度。
|
dimensionExpression |
object (DimensionExpression )
一個維度可以是多個維度的表達式結果。舉例來說,如果維度為「國家/地區、城市」:concatenate(country, ", ", city)。
|
DimensionExpression
用於表示維度,也就是多個維度的公式結果。使用範例:1) lowerCase(dimension) 2) concatenate(dimension1, symbol, dimension2)。
JSON 表示法 |
{
// Union field one_expression can be only one of the following:
"lowerCase": {
object (CaseExpression )
},
"upperCase": {
object (CaseExpression )
},
"concatenate": {
object (ConcatenateExpression )
}
// End of list of possible types for union field one_expression .
} |
欄位 |
聯集欄位 one_expression 。為 DimensionExpression 指定一種維度運算式。one_expression 只能是下列其中一項: |
lowerCase |
object (CaseExpression )
用於將維度值轉換為小寫。
|
upperCase |
object (CaseExpression )
用於將維度值轉換為大寫。
|
concatenate |
object (ConcatenateExpression )
用於將維度值合併為單一維度。舉例來說,如果維度為「國家/地區、城市」:concatenate(country, ", ", city)。
|
CaseExpression
JSON 表示法 |
{
"dimensionName": string
} |
欄位 |
dimensionName |
string
維度的名稱。名稱必須參照要求的維度欄位中的名稱。
|
ConcatenateExpression
JSON 表示法 |
{
"dimensionNames": [
string
],
"delimiter": string
} |
欄位 |
dimensionNames[] |
string
維度的名稱。名稱必須參照要求中維度欄位的名稱。
|
delimiter |
string
維度名稱之間的分隔符號。 分隔符通常是單一字元,例如「|」或「,」,但也可以是較長的字串。如果維度值包含分隔符,回應中會同時顯示這兩個值,且沒有任何區別。舉例來說,如果維度 1 的值 =「US,FR」,維度 2 的值 =「JP」,分隔符 =「,」,則回應會包含「US,FR,JP」。
|
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間:2025-07-26 (世界標準時間)。"],[[["\u003cp\u003eDimensions represent data attributes, like city or country, and are limited to 9 per request.\u003c/p\u003e\n"],["\u003cp\u003eYou can create custom dimensions using expressions that manipulate existing dimensions (e.g., lowercase, concatenate).\u003c/p\u003e\n"],["\u003cp\u003eDimension expressions can combine multiple dimensions with delimiters, such as joining country and city with a comma.\u003c/p\u003e\n"],["\u003cp\u003eDimension names in expressions should refer to existing dimension names defined in the request.\u003c/p\u003e\n"],["\u003cp\u003eWhen using delimiters, ensure they don't clash with values within your dimension data to avoid ambiguity.\u003c/p\u003e\n"]]],["This document outlines the structure and usage of dimensions in data reporting, focusing on creating custom dimensions. Dimensions are data attributes, like \"city.\" You can define a `dimension` with a `name` and an optional `dimensionExpression`. `DimensionExpression` allows combining or modifying existing dimensions using `lowerCase`, `upperCase`, or `concatenate` functions. `CaseExpression` changes dimension cases. `ConcatenateExpression` merges dimension values with a specified `delimiter`. Each dimension name is a string with allowed characters.\n"],null,[]]