試用 Google Analytics 的 MCP 伺服器。從
GitHub 安裝,詳情請參閱
公告。
REST Resource: properties.customMetrics
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
資源:CustomMetric
欄位 |
name |
string
僅供輸出。這項 CustomMetric 資源的資源名稱。格式:properties/{property}/customMetrics/{customMetric}
|
parameterName |
string
必要欄位。不可變動。這個自訂指標的標記名稱。 如果是以事件為範圍的指標,這會是事件參數名稱。 只能使用英數字元和底線字元,並以英文字母開頭。以事件為範圍的指標長度上限為 40 個半形字元。
|
displayName |
string
必要欄位。Analytics UI 中顯示的自訂指標名稱。長度上限為 82 個字元,可以使用英數字元、空格和底線,開頭須為英文字母。舊版系統產生的顯示名稱可能包含方括號,但更新這個欄位時一律不允許使用方括號。
|
description |
string
選用設定。此自訂維度的說明。長度上限為 150 個半形字元。
|
measurementUnit |
enum (MeasurementUnit )
必要欄位。自訂指標值的類型。
|
scope |
enum (MetricScope )
必要欄位。不可變動。這個自訂指標的範圍。
|
restrictedMetricType[] |
enum (RestrictedMetricType )
選用設定。這項指標可能包含的受限資料類型。使用 CURRENCY 測量單位的指標為必要項目。使用非 CURRENCY 測量單位的指標必須留空。
|
MeasurementUnit
代表自訂指標值的可能類型。
貨幣表示方式日後可能會變更,需要進行破壞性 API 變更。
列舉 |
MEASUREMENT_UNIT_UNSPECIFIED |
未指定或 MeasurementUnit。 |
STANDARD |
這項指標使用預設單位。 |
CURRENCY |
這項指標是用於計算貨幣。 |
FEET |
這項指標測量的是英尺。 |
METERS |
這項指標測量的是公尺。 |
KILOMETERS |
這項指標會測量公里數。 |
MILES |
這項指標是用於測量英里數。 |
MILLISECONDS |
這項指標測量的是毫秒數。 |
SECONDS |
這項指標會測量秒數。 |
MINUTES |
這項指標測量的是分鐘數。 |
HOURS |
這項指標可評估小時。 |
MetricScope
列舉 |
METRIC_SCOPE_UNSPECIFIED |
範圍未知或未指定。 |
EVENT |
將指標範圍限定為事件。 |
RestrictedMetricType
將這項自訂指標中的資料標示為應僅限特定使用者使用的資料。
列舉 |
RESTRICTED_METRIC_TYPE_UNSPECIFIED |
類型不明或未指定。 |
COST_DATA |
指標報表費用資料。 |
REVENUE_DATA |
指標表示收益資料。 |
方法 |
|
封存資源的自訂指標。 |
|
建立自訂指標。 |
|
查詢單一自訂指標。 |
|
列出資源的 CustomMetrics。 |
|
更新資源的自訂指標。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間:2025-07-26 (世界標準時間)。"],[[["\u003cp\u003e\u003ccode\u003eCustomMetric\u003c/code\u003e resource allows you to define custom metrics with specific parameters, display names, descriptions, measurement units, and scopes within Google Analytics.\u003c/p\u003e\n"],["\u003cp\u003eThese custom metrics can have various measurement units like \u003ccode\u003eSTANDARD\u003c/code\u003e, \u003ccode\u003eCURRENCY\u003c/code\u003e, \u003ccode\u003eFEET\u003c/code\u003e, \u003ccode\u003eMETERS\u003c/code\u003e, and more, alongside scopes such as \u003ccode\u003eEVENT\u003c/code\u003e to tailor data collection to specific events.\u003c/p\u003e\n"],["\u003cp\u003eYou can manage your custom metrics with dedicated methods, including \u003ccode\u003earchive\u003c/code\u003e, \u003ccode\u003ecreate\u003c/code\u003e, \u003ccode\u003eget\u003c/code\u003e, \u003ccode\u003elist\u003c/code\u003e, and \u003ccode\u003epatch\u003c/code\u003e to control their lifecycle and properties directly through the API.\u003c/p\u003e\n"],["\u003cp\u003eRestricted data like cost and revenue can be tracked by labeling the metric with specific \u003ccode\u003eRestrictedMetricType\u003c/code\u003e values, ensuring appropriate access controls.\u003c/p\u003e\n"]]],["CustomMetrics are defined by `name`, `parameterName`, `displayName`, `description`, `measurementUnit`, `scope`, and `restrictedMetricType`. `MeasurementUnit` options include standard, currency, and various distance/time units. `MetricScope` can be event-based. `RestrictedMetricType` marks data like cost or revenue. Methods allow creating, retrieving, listing, updating, and archiving custom metrics. These metrics are structured with specific field requirements, such as length and character restrictions.\n"],null,["# REST Resource: properties.customMetrics\n\n- [Resource: CustomMetric](#CustomMetric)\n - [JSON representation](#CustomMetric.SCHEMA_REPRESENTATION)\n- [MeasurementUnit](#MeasurementUnit)\n- [MetricScope](#MetricScope)\n- [RestrictedMetricType](#RestrictedMetricType)\n- [Methods](#METHODS_SUMMARY)\n\nResource: CustomMetric\n----------------------\n\nA definition for a custom metric.\n\n| JSON representation |\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"name\": string, \"parameterName\": string, \"displayName\": string, \"description\": string, \"measurementUnit\": enum (/analytics/devguides/config/admin/v1/rest/v1beta/properties.customMetrics#MeasurementUnit), \"scope\": enum (/analytics/devguides/config/admin/v1/rest/v1beta/properties.customMetrics#MetricScope), \"restrictedMetricType\": [ enum (/analytics/devguides/config/admin/v1/rest/v1beta/properties.customMetrics#RestrictedMetricType) ] } ``` |\n\n| Fields ||\n|--------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `name` | `string` Output only. Resource name for this CustomMetric resource. Format: properties/{property}/customMetrics/{customMetric} |\n| `parameterName` | `string` Required. Immutable. Tagging name for this custom metric. If this is an event-scoped metric, then this is the event parameter name. May only contain alphanumeric and underscore charactes, starting with a letter. Max length of 40 characters for event-scoped metrics. |\n| `displayName` | `string` Required. Display name for this custom metric as shown in the Analytics UI. Max length of 82 characters, alphanumeric plus space and underscore starting with a letter. Legacy system-generated display names may contain square brackets, but updates to this field will never permit square brackets. |\n| `description` | `string` Optional. Description for this custom dimension. Max length of 150 characters. |\n| `measurementUnit` | `enum (`[MeasurementUnit](/analytics/devguides/config/admin/v1/rest/v1beta/properties.customMetrics#MeasurementUnit)`)` Required. The type for the custom metric's value. |\n| `scope` | `enum (`[MetricScope](/analytics/devguides/config/admin/v1/rest/v1beta/properties.customMetrics#MetricScope)`)` Required. Immutable. The scope of this custom metric. |\n| `restrictedMetricType[]` | `enum (`[RestrictedMetricType](/analytics/devguides/config/admin/v1/rest/v1beta/properties.customMetrics#RestrictedMetricType)`)` Optional. Types of restricted data that this metric may contain. Required for metrics with CURRENCY measurement unit. Must be empty for metrics with a non-CURRENCY measurement unit. |\n\nMeasurementUnit\n---------------\n\nPossible types of representing the custom metric's value.\n\nCurrency representation may change in the future, requiring a breaking API change.\n\n| Enums ||\n|--------------------------------|-----------------------------------------|\n| `MEASUREMENT_UNIT_UNSPECIFIED` | MeasurementUnit unspecified or missing. |\n| `STANDARD` | This metric uses default units. |\n| `CURRENCY` | This metric measures a currency. |\n| `FEET` | This metric measures feet. |\n| `METERS` | This metric measures meters. |\n| `KILOMETERS` | This metric measures kilometers. |\n| `MILES` | This metric measures miles. |\n| `MILLISECONDS` | This metric measures milliseconds. |\n| `SECONDS` | This metric measures seconds. |\n| `MINUTES` | This metric measures minutes. |\n| `HOURS` | This metric measures hours. |\n\nMetricScope\n-----------\n\nThe scope of this metric.\n\n| Enums ||\n|----------------------------|---------------------------------|\n| `METRIC_SCOPE_UNSPECIFIED` | Scope unknown or not specified. |\n| `EVENT` | Metric scoped to an event. |\n\nRestrictedMetricType\n--------------------\n\nLabels that mark the data in this custom metric as data that should be restricted to specific users.\n\n| Enums ||\n|--------------------------------------|------------------------------|\n| `RESTRICTED_METRIC_TYPE_UNSPECIFIED` | Type unknown or unspecified. |\n| `COST_DATA` | Metric reports cost data. |\n| `REVENUE_DATA` | Metric reports revenue data. |\n\n| Methods ------- ||\n|--------------------------------------------------------------------------------------------------|----------------------------------------|\n| ### [archive](/analytics/devguides/config/admin/v1/rest/v1beta/properties.customMetrics/archive) | Archives a CustomMetric on a property. |\n| ### [create](/analytics/devguides/config/admin/v1/rest/v1beta/properties.customMetrics/create) | Creates a CustomMetric. |\n| ### [get](/analytics/devguides/config/admin/v1/rest/v1beta/properties.customMetrics/get) | Lookup for a single CustomMetric. |\n| ### [list](/analytics/devguides/config/admin/v1/rest/v1beta/properties.customMetrics/list) | Lists CustomMetrics on a property. |\n| ### [patch](/analytics/devguides/config/admin/v1/rest/v1beta/properties.customMetrics/patch) | Updates a CustomMetric on a property. |"]]