AI-generated Key Takeaways
- 
          CalculatedMetrics are created using an HTTP POST request to the specified API endpoint. 
- 
          The request requires a parentpath parameter to identify the property under which the calculated metric will be created.
- 
          A required calculatedMetricIdquery parameter must be provided to uniquely identify the new calculated metric within the property.
- 
          The request and response bodies contain instances of the CalculatedMetricresource, detailing the calculated metric's configuration.
- 
          Creating a CalculatedMetric requires authorization with the https://www.googleapis.com/auth/analytics.editOAuth scope.
- 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