试用 Google Analytics 的 MCP 服务器。从
GitHub 安装,并参阅
公告了解详情。
Method: properties.getMetadata
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eReturns metadata for dimensions, metrics, and comparisons available in reporting methods for a specified Google Analytics GA4 Property.\u003c/p\u003e\n"],["\u003cp\u003eIncludes both custom and Universal metadata, allowing exploration of available data points.\u003c/p\u003e\n"],["\u003cp\u003eAccepts a Google Analytics GA4 Property Identifier in the request to retrieve property-specific metadata.\u003c/p\u003e\n"],["\u003cp\u003eRequires authorization with specific OAuth scopes for accessing the data.\u003c/p\u003e\n"],["\u003cp\u003eProvides details about dimensions, metrics, and comparisons through comprehensive metadata descriptions.\u003c/p\u003e\n"]]],["This method retrieves metadata for dimensions, metrics, and comparisons used in Google Analytics reporting. It utilizes a `GET` HTTP request with a required property ID in the URL path (`name`) to specify the target property. An empty request body is required. The response contains a JSON structure with descriptions of available dimensions, metrics, and comparisons, including universal and custom ones. Setting the property ID to '0' will only return universal data. Two authorization scopes are required to utilize this method.\n"],null,["# Method: properties.getMetadata\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n - [JSON representation](#body.Metadata.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [ComparisonMetadata](#ComparisonMetadata)\n - [JSON representation](#ComparisonMetadata.SCHEMA_REPRESENTATION)\n- [Try it!](#try-it)\n\nReturns metadata for dimensions and metrics available in reporting methods. Used to explore the dimensions and metrics. In this method, a Google Analytics property identifier is specified in the request, and the metadata response includes Custom dimensions and metrics as well as Universal metadata.\n\nFor example if a custom metric with parameter name `levels_unlocked` is registered to a property, the Metadata response will contain `customEvent:levels_unlocked`. Universal metadata are dimensions and metrics applicable to any property such as `country` and `totalUsers`.\n\n### HTTP request\n\n`GET https://analyticsdata.googleapis.com/v1beta/{name=properties/*/metadata}`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `name` | `string` Required. The resource name of the metadata to retrieve. This name field is specified in the URL path and not URL parameters. Property is a numeric Google Analytics property identifier. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). Example: properties/1234/metadata Set the Property ID to 0 for dimensions and metrics common to all properties. In this special mode, this method will not return custom dimensions and metrics. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nThe dimensions, metrics and comparisons currently accepted in reporting methods.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"name\": string, \"dimensions\": [ { object (/analytics/devguides/reporting/data/v1/rest/v1beta/DimensionMetadata) } ], \"metrics\": [ { object (/analytics/devguides/reporting/data/v1/rest/v1beta/MetricMetadata) } ], \"comparisons\": [ { object (/analytics/devguides/reporting/data/v1/rest/v1beta/properties/getMetadata#ComparisonMetadata) } ] } ``` |\n\n| Fields ||\n|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `name` | `string` Resource name of this metadata. |\n| `dimensions[]` | `object (`[DimensionMetadata](/analytics/devguides/reporting/data/v1/rest/v1beta/DimensionMetadata)`)` The dimension descriptions. |\n| `metrics[]` | `object (`[MetricMetadata](/analytics/devguides/reporting/data/v1/rest/v1beta/MetricMetadata)`)` The metric descriptions. |\n| `comparisons[]` | `object (`[ComparisonMetadata](/analytics/devguides/reporting/data/v1/rest/v1beta/properties/getMetadata#ComparisonMetadata)`)` The comparison descriptions. |\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/analytics.readonly`\n- `https://www.googleapis.com/auth/analytics`\n\nComparisonMetadata\n------------------\n\nThe metadata for a single comparison.\n\n| JSON representation |\n|------------------------------------------------------------------------|\n| ``` { \"apiName\": string, \"uiName\": string, \"description\": string } ``` |\n\n| Fields ||\n|---------------|---------------------------------------------------------------------------------------------------------------------------------------|\n| `api``Name` | `string` This comparison's resource name. Useable in [Comparison](#Comparison)'s `comparison` field. For example, 'comparisons/1234'. |\n| `ui``Name` | `string` This comparison's name within the Google Analytics user interface. |\n| `description` | `string` This comparison's description. |"]]