Hãy thử máy chủ MCP cho Google Analytics. Cài đặt từ
GitHub và xem
thông báo để biết thêm thông tin chi tiết.
REST Resource: properties.customMetrics
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Tài nguyên: CustomMetric
Định nghĩa cho chỉ số tuỳ chỉnh.
Biểu diễn dưới dạng JSON |
{
"name": string,
"parameterName": string,
"displayName": string,
"description": string,
"measurementUnit": enum (MeasurementUnit ),
"scope": enum (MetricScope ),
"restrictedMetricType": [
enum (RestrictedMetricType )
]
} |
Trường |
name |
string
Chỉ có đầu ra. Tên tài nguyên của tài nguyên CustomMetric này. Định dạng: thuộc tính/{property}/customMetrics/{customMetric}
|
parameterName |
string
Bắt buộc. Bất biến. Tên gắn thẻ cho chỉ số tuỳ chỉnh này. Nếu đây là chỉ số ở phạm vi sự kiện, thì đây là tên thông số sự kiện. Chỉ được chứa các ký tự chữ-số và dấu gạch dưới, bắt đầu bằng một chữ cái. Độ dài tối đa là 40 ký tự cho các chỉ số ở phạm vi sự kiện.
|
displayName |
string
Bắt buộc. Tên hiển thị cho chỉ số tuỳ chỉnh này như được hiển thị trong giao diện người dùng Analytics. Độ dài tối đa là 82 ký tự, gồm cả chữ và số, cộng với dấu cách và dấu gạch dưới bắt đầu bằng một chữ cái. Tên hiển thị cũ do hệ thống tạo có thể chứa dấu ngoặc vuông, nhưng nội dung cập nhật cho trường này sẽ không bao giờ cho phép sử dụng dấu ngoặc vuông.
|
description |
string
Không bắt buộc. Nội dung mô tả cho phương diện tuỳ chỉnh này. Độ dài tối đa 150 ký tự.
|
measurementUnit |
enum (MeasurementUnit )
Bắt buộc. Loại cho giá trị của chỉ số tuỳ chỉnh.
|
scope |
enum (MetricScope )
Bắt buộc. Bất biến. Phạm vi của chỉ số tuỳ chỉnh này.
|
restrictedMetricType[] |
enum (RestrictedMetricType )
Không bắt buộc. Các loại dữ liệu bị hạn chế có trong chỉ số này. Bắt buộc đối với những chỉ số có đơn vị đo lường CURRENCY. Phải để trống đối với những chỉ số có đơn vị đo lường không phải CURRENCY.
|
MeasurementUnit
Các loại có thể biểu thị giá trị của chỉ số tùy chỉnh.
Nội dung trình bày về đơn vị tiền tệ có thể thay đổi trong tương lai, đòi hỏi phải có sự thay đổi về API có thể gây lỗi.
Enum |
MEASUREMENT_UNIT_UNSPECIFIED |
Đơn vị đo lường không được chỉ định hoặc bị thiếu. |
STANDARD |
Chỉ số này sử dụng các đơn vị mặc định. |
CURRENCY |
Chỉ số này đo lường một đơn vị tiền tệ. |
FEET |
Chỉ số này đo lường bộ. |
METERS |
Chỉ số này đo lường số mét. |
KILOMETERS |
Chỉ số này đo lường số kilômét. |
MILES |
Chỉ số này đo lường dặm. |
MILLISECONDS |
Chỉ số này đo lường bằng mili giây. |
SECONDS |
Chỉ số này đo lường số giây. |
MINUTES |
Chỉ số này đo lường số phút. |
HOURS |
Chỉ số này đo lường giờ. |
MetricScope
Enum |
METRIC_SCOPE_UNSPECIFIED |
Phạm vi không xác định hoặc chưa được chỉ định. |
EVENT |
Chỉ số trong phạm vi một sự kiện. |
RestrictedMetricType
Các nhãn đánh dấu dữ liệu trong chỉ số tuỳ chỉnh này là dữ liệu nên được giới hạn ở một số người dùng cụ thể.
Enum |
RESTRICTED_METRIC_TYPE_UNSPECIFIED |
Loại không xác định hoặc chưa được chỉ định. |
COST_DATA |
Chỉ số báo cáo dữ liệu chi phí. |
REVENUE_DATA |
Chỉ số báo cáo dữ liệu doanh thu. |
Phương thức |
|
Lưu trữ một CustomMetric trên một tài sản. |
|
Tạo một Chỉ số tuỳ chỉnh. |
|
Tìm một Chỉ số tuỳ chỉnh duy nhất. |
|
Liệt kê CustomMetrics trên một thuộc tính. |
|
Cập nhật một CustomMetric trên một tài sản. |
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[[["\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. |"]]