试用 Google Analytics 的 MCP 服务器。从
GitHub 安装,并参阅
公告了解详情。
Method: properties.fetchConnectedGa4Property
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
在给定指定的 UA 媒体资源的情况下,查找与其关联的 GA4 媒体资源。注意:此 ID 不能用于 GA4 媒体资源。
HTTP 请求
GET https://analyticsadmin.googleapis.com/v1alpha/properties:fetchConnectedGa4Property
网址采用 gRPC 转码语法。
查询参数
参数 |
property |
string
必需。要为其查找关联的 GA4 媒体资源的 UA 媒体资源。请注意,此请求使用的是内部媒体资源 ID,而不是 UA-XXXXXX-YY 形式的跟踪 ID。格式:property/{internal_web_property_id} 示例:property/1234
|
响应正文
对查找与 UA 媒体资源相关联的 GA4 媒体资源的响应。
如果成功,响应正文将包含结构如下的数据:
JSON 表示法 |
{
"property": string
} |
字段 |
property |
string
与 UA 媒体资源相关联的 GA4 媒体资源。如果没有已关联的 GA4 媒体资源,系统会返回空字符串。格式:property/{property_id} 示例:property/1234
|
授权范围
需要以下 OAuth 范围之一:
https://www.googleapis.com/auth/analytics.readonly
https://www.googleapis.com/auth/analytics.edit
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eThis document details how to look up the connected Google Analytics 4 (GA4) property for a given Universal Analytics (UA) property using the Google Analytics Admin API.\u003c/p\u003e\n"],["\u003cp\u003eThe API request requires the internal UA property ID and returns the connected GA4 property ID, if any.\u003c/p\u003e\n"],["\u003cp\u003eAuthentication requires specific OAuth scopes for either read-only or edit access to Analytics data.\u003c/p\u003e\n"],["\u003cp\u003eIt is important to note that this functionality cannot be used with GA4 properties and requires an empty request body.\u003c/p\u003e\n"]]],["This document details how to find a connected GA4 property using its associated UA property. A `GET` request to `https://analyticsadmin.googleapis.com/v1alpha/properties:fetchConnectedGa4Property` is made. The request requires a `property` query parameter, which is the UA property's internal ID, formatted as `properties/{internal_web_property_id}`. The request body must be empty. The response body returns a JSON structure containing a `property` field with the GA4 property ID or an empty string if none exists. The request needs authorization with specific OAuth scopes.\n"],null,["# Method: properties.fetchConnectedGa4Property\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n - [JSON representation](#body.FetchConnectedGa4PropertyResponse.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nGiven a specified UA property, looks up the GA4 property connected to it. Note: this cannot be used with GA4 properties.\n\n### HTTP request\n\n`GET https://analyticsadmin.googleapis.com/v1alpha/properties:fetchConnectedGa4Property`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Query parameters\n\n| Parameters ||\n|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `property` | `string` Required. The UA property for which to look up the connected GA4 property. Note this request uses the internal property ID, not the tracking ID of the form UA-XXXXXX-YY. Format: properties/{internal_web_property_id} Example: properties/1234 |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nResponse for looking up GA4 property connected to a UA property.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|--------------------------------|\n| ``` { \"property\": string } ``` |\n\n| Fields ||\n|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `property` | `string` The GA4 property connected to the UA property. An empty string is returned when there is no connected GA4 property. Format: properties/{property_id} Example: properties/1234 |\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.edit`"]]