AI-generated Key Takeaways
-
Creates a new CalculatedMetric within a specified Google Analytics 4 property using an HTTP POST request.
-
Requires providing a unique
calculatedMetricId
and theproperty_id
as path and query parameters, respectively. -
The request body should contain the CalculatedMetric definition, and a successful response will return the newly created CalculatedMetric instance.
-
Users need to have the
analytics.edit
OAuth scope to authorize this operation.
- HTTP request
- Path parameters
- Query parameters
- Request body
- Response body
- Authorization scopes
- Try it!
Creates a CalculatedMetric.
HTTP request
POST https://analyticsadmin.googleapis.com/v1alpha/{parent=properties/*}/calculatedMetrics
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters | |
---|---|
parent |
Required. Format: properties/{property_id} Example: properties/1234 |
Query parameters
Parameters | |
---|---|
calculatedMetricId |
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}". |
Request body
The request body contains an instance of CalculatedMetric
.
Response body
If successful, the response body contains a newly created instance of CalculatedMetric
.
Authorization scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/analytics.edit