MCP-Server für Google Analytics ausprobieren Installieren Sie das Tool über
GitHub. Weitere Informationen finden Sie in der
Ankündigung.
Method: properties.calculatedMetrics.create
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Erstellt einen computedMetric-Messwert.
HTTP-Anfrage
POST https://analyticsadmin.googleapis.com/v1alpha/{parent=properties/*}/calculatedMetrics
Die URL verwendet die Syntax der gRPC-Transcodierung.
Pfadparameter
Parameter |
parent |
string
Erforderlich. Format: Properties/{property_id} Beispiel: Properties/1234
|
Abfrageparameter
Parameter |
calculatedMetricId |
string
Erforderlich. Die ID, die für den berechneten Messwert verwendet werden soll. Sie wird die letzte Komponente des Ressourcennamens des berechneten Messwerts. Dieser Wert muss zwischen 1 und 80 Zeichen lang sein. Gültige Zeichen sind /[a-zA-Z0-9_]/. Leerzeichen sind nicht zulässig. Er muss für alle berechneten Messwerte in einer Property eindeutig sein. Die berechneteMesswert-ID wird verwendet, wenn von externen APIs auf diesen berechneten Messwert verwiesen wird, z. B. „calcMetric:{calculatedMetricId}“.
|
Anfragetext
Der Anfragetext enthält eine Instanz von CalculatedMetric
.
Antworttext
Bei Erfolg enthält der Antworttext eine neu erstellte Instanz von CalculatedMetric
.
Autorisierungsbereiche
Erfordert den folgenden OAuth-Bereich:
https://www.googleapis.com/auth/analytics.edit
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
Zuletzt aktualisiert: 2025-07-26 (UTC).
[null,null,["Zuletzt aktualisiert: 2025-07-26 (UTC)."],[[["\u003cp\u003eCreates a new CalculatedMetric within a specified Google Analytics 4 property using an HTTP POST request.\u003c/p\u003e\n"],["\u003cp\u003eRequires providing a unique \u003ccode\u003ecalculatedMetricId\u003c/code\u003e and the \u003ccode\u003eproperty_id\u003c/code\u003e as path and query parameters, respectively.\u003c/p\u003e\n"],["\u003cp\u003eThe request body should contain the CalculatedMetric definition, and a successful response will return the newly created CalculatedMetric instance.\u003c/p\u003e\n"],["\u003cp\u003eUsers need to have the \u003ccode\u003eanalytics.edit\u003c/code\u003e OAuth scope to authorize this operation.\u003c/p\u003e\n"]]],["This documentation details how to create a CalculatedMetric via a `POST` request to the specified URL, including required components such as path and query parameters, the request body and the response body. The path parameter `parent` defines the property ID. The query parameter `calculatedMetricId` is a unique identifier. The request and response bodies are `CalculatedMetric` instances. This action requires authorization scope: `https://www.googleapis.com/auth/analytics.edit`.\n"],null,["# Method: properties.calculatedMetrics.create\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nCreates a CalculatedMetric.\n\n### HTTP request\n\n`POST https://analyticsadmin.googleapis.com/v1alpha/{parent=properties/*}/calculatedMetrics`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------|------------------------------------------------------------------------------|\n| `parent` | `string` Required. Format: properties/{property_id} Example: properties/1234 |\n\n### Query parameters\n\n| Parameters ||\n|----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `calculatedMetricId` | `string` Required. The ID to use for the calculated metric which will become the final component of the calculated metric's resource name. This value should be 1-80 characters and valid characters are /\\[a-zA-Z0-9_\\]/, no spaces allowed. calculatedMetricId must be unique between all calculated metrics under a property. The calculatedMetricId is used when referencing this calculated metric from external APIs, for example, \"calcMetric:{calculatedMetricId}\". |\n\n### Request body\n\nThe request body contains an instance of [CalculatedMetric](/analytics/devguides/config/admin/v1/rest/v1alpha/properties.calculatedMetrics#CalculatedMetric).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [CalculatedMetric](/analytics/devguides/config/admin/v1/rest/v1alpha/properties.calculatedMetrics#CalculatedMetric).\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/analytics.edit`"]]