ลองใช้เซิร์ฟเวอร์ MCP สำหรับ Google Analytics ติดตั้งจาก
GitHub และดูรายละเอียดเพิ่มเติมได้ที่
ประกาศ
REST Resource: properties.customMetrics
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
แหล่งข้อมูล: CustomMetric
คำจำกัดความของเมตริกที่กำหนดเอง
การแสดง JSON |
{
"name": string,
"parameterName": string,
"displayName": string,
"description": string,
"measurementUnit": enum (MeasurementUnit ),
"scope": enum (MetricScope ),
"restrictedMetricType": [
enum (RestrictedMetricType )
]
} |
ช่อง |
name |
string
เอาต์พุตเท่านั้น ชื่อทรัพยากรสำหรับทรัพยากร CustomMetric นี้ รูปแบบ: พร็อพเพอร์ตี้/{property}/customMetrics/{customMetric}
|
parameterName |
string
ต้องระบุ เปลี่ยนแปลงไม่ได้ ชื่อการติดแท็กสำหรับเมตริกที่กำหนดเองนี้ หากเป็นเมตริกที่กําหนดขอบเขตระดับเหตุการณ์ พารามิเตอร์นี้จะเป็นชื่อพารามิเตอร์เหตุการณ์ ใช้ได้เฉพาะอักขระที่เป็นตัวอักษรและตัวเลขคละกันและขีดล่างโดยขึ้นต้นด้วยตัวอักษร ความยาวสูงสุด 40 อักขระสําหรับเมตริกที่กําหนดขอบเขตระดับเหตุการณ์
|
displayName |
string
ต้องระบุ ชื่อที่แสดงของเมตริกที่กำหนดเองนี้ตามที่แสดงใน UI ของ Analytics ความยาวสูงสุด 82 อักขระ ได้แก่ ตัวอักษรและตัวเลขคละกัน รวมถึงช่องว่าง และขีดล่างเริ่มต้นด้วยตัวอักษร ชื่อที่แสดงซึ่งระบบสร้างขึ้นแบบเดิมอาจมีวงเล็บเหลี่ยม แต่การอัปเดตฟิลด์นี้จะไม่อนุญาตให้ใช้เครื่องหมายวงเล็บเหลี่ยม
|
description |
string
ไม่บังคับ คำอธิบายสำหรับมิติข้อมูลที่กำหนดเองนี้ ความยาวสูงสุด 150 อักขระ
|
measurementUnit |
enum (MeasurementUnit )
ต้องระบุ ประเภทสำหรับค่าของเมตริกที่กำหนดเอง
|
scope |
enum (MetricScope )
ต้องระบุ เปลี่ยนแปลงไม่ได้ ขอบเขตของเมตริกที่กำหนดเองนี้
|
restrictedMetricType[] |
enum (RestrictedMetricType )
ไม่บังคับ ประเภทข้อมูลที่ถูกจำกัดซึ่งมีเมตริกนี้อยู่ ต้องระบุสำหรับเมตริกที่มีหน่วยวัด CURRENCY ต้องเว้นว่างไว้สำหรับเมตริกที่มีหน่วยวัดที่ไม่ใช่ CURRENCY
|
MeasurementUnit
ประเภทที่เป็นไปได้ของการแสดงค่าของเมตริกที่กำหนดเอง
การแสดงสกุลเงินอาจเปลี่ยนแปลงในอนาคต ทำให้ต้องมีการเปลี่ยนแปลง API ที่ส่งผลกับส่วนอื่นในระบบ
Enum |
MEASUREMENT_UNIT_UNSPECIFIED |
ไม่ได้ระบุหรือไม่ได้ระบุ MeasurementUnit |
STANDARD |
เมตริกนี้ใช้หน่วยเริ่มต้น |
CURRENCY |
เมตริกนี้จะวัดสกุลเงิน |
FEET |
เมตริกนี้วัดฟุต |
METERS |
เมตริกนี้วัดเมตร |
KILOMETERS |
เมตริกนี้วัดกิโลเมตร |
MILES |
เมตริกนี้วัดไมล์ |
MILLISECONDS |
เมตริกนี้จะวัดมิลลิวินาที |
SECONDS |
เมตริกนี้จะวัดจำนวนวินาที |
MINUTES |
เมตริกนี้จะวัดนาที |
HOURS |
เมตริกนี้วัดชั่วโมง |
MetricScope
Enum |
METRIC_SCOPE_UNSPECIFIED |
ไม่รู้จักหรือไม่ได้ระบุขอบเขต |
EVENT |
เมตริกที่กําหนดขอบเขตเฉพาะเหตุการณ์ |
RestrictedMetricType
ป้ายกำกับที่ทำเครื่องหมายข้อมูลในเมตริกที่กำหนดเองนี้เป็นข้อมูลที่ควรจำกัดไว้เฉพาะผู้ใช้บางราย
Enum |
RESTRICTED_METRIC_TYPE_UNSPECIFIED |
ประเภทที่ไม่รู้จักหรือไม่ได้ระบุ |
COST_DATA |
เมตริกจะรายงานข้อมูลค่าใช้จ่าย |
REVENUE_DATA |
เมตริกจะรายงานข้อมูลรายได้ |
เมธอด |
|
เก็บ CustomMetric ในพร็อพเพอร์ตี้ |
|
สร้างเมตริกที่กำหนดเอง |
|
ค้นหา CustomMetric เดียว |
|
แสดงรายการเมตริกที่กำหนดเองในพร็อพเพอร์ตี้ |
|
อัปเดต CustomMetric ในพร็อพเพอร์ตี้ |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 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. |"]]