Resource: CalculatedMetric
A definition for a calculated metric.
JSON representation |
---|
{ "name": string, "description": string, "displayName": string, "calculatedMetricId": string, "metricUnit": enum ( |
Fields | |
---|---|
name |
Output only. Resource name for this CalculatedMetric. Format: 'properties/{property_id}/calculatedMetrics/{calculatedMetricId}' |
description |
Optional. Description for this calculated metric. Max length of 4096 characters. |
displayName |
Required. Display name for this calculated metric as shown in the Google Analytics UI. Max length 82 characters. |
calculatedMetricId |
Output only. The ID to use for the calculated metric. In the UI, this is referred to as the "API name." The calculatedMetricId is used when referencing this calculated metric from external APIs. For example, "calcMetric:{calculatedMetricId}". |
metricUnit |
Required. The type for the calculated metric's value. |
restrictedMetricType[] |
Output only. Types of restricted data that this metric contains. |
formula |
Required. The calculated metric's definition. Maximum number of unique referenced custom metrics is 5. Formulas supports the following operations: + (addition), - (subtraction), - (negative), * (multiplication), / (division), () (parenthesis). Any valid real numbers are acceptable that fit in a Long (64bit integer) or a Double (64 bit floating point number). Example formula: "( customEvent:parameterName + cartPurchaseQuantity ) / 2.0" |
invalidMetricReference |
Output only. If true, this calculated metric has a invalid metric reference. Anything using a calculated metric with invalidMetricReference set to true may fail, produce warnings, or produce unexpected results. |
MetricUnit
Possible types of representing the calculated metric's value.
Enums | |
---|---|
METRIC_UNIT_UNSPECIFIED |
MetricUnit unspecified or missing. |
STANDARD |
This metric uses default units. |
CURRENCY |
This metric measures a currency. |
FEET |
This metric measures feet. |
MILES |
This metric measures miles. |
METERS |
This metric measures meters. |
KILOMETERS |
This metric measures kilometers. |
MILLISECONDS |
This metric measures milliseconds. |
SECONDS |
This metric measures seconds. |
MINUTES |
This metric measures minutes. |
HOURS |
This metric measures hours. |
RestrictedMetricType
Labels that mark the data in calculated metric used in conjunction with user roles that restrict access to cost and/or revenue metrics.
Enums | |
---|---|
RESTRICTED_METRIC_TYPE_UNSPECIFIED |
Type unknown or unspecified. |
COST_DATA |
Metric reports cost data. |
REVENUE_DATA |
Metric reports revenue data. |
Methods |
|
---|---|
|
Creates a CalculatedMetric. |
|
Deletes a CalculatedMetric on a property. |
|
Lookup for a single CalculatedMetric. |
|
Lists CalculatedMetrics on a property. |
|
Updates a CalculatedMetric on a property. |