Reference documentation and code samples for the Google Analytics Admin V1alpha Client class CalculatedMetric.
A definition for a calculated metric.
Generated from protobuf message google.analytics.admin.v1alpha.CalculatedMetric
Namespace
Google \ Analytics \ Admin \ V1alphaMethods
__construct
Constructor.
| Parameters | |
|---|---|
| Name | Description |
data |
array
Optional. Data for populating the Message object. |
↳ name |
string
Output only. Resource name for this CalculatedMetric. Format: 'properties/{property_id}/calculatedMetrics/{calculated_metric_id}' |
↳ description |
string
Optional. Description for this calculated metric. Max length of 4096 characters. |
↳ display_name |
string
Required. Display name for this calculated metric as shown in the Google Analytics UI. Max length 82 characters. |
↳ calculated_metric_id |
string
Output only. The ID to use for the calculated metric. In the UI, this is referred to as the "API name." The calculated_metric_id is used when referencing this calculated metric from external APIs. For example, "calcMetric:{calculated_metric_id}". |
↳ metric_unit |
int
Required. The type for the calculated metric's value. |
↳ restricted_metric_type |
array
Output only. Types of restricted data that this metric contains. |
↳ formula |
string
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:parameter_name + cartPurchaseQuantity ) / 2.0" |
↳ invalid_metric_reference |
bool
Output only. If true, this calculated metric has a invalid metric reference. Anything using a calculated metric with invalid_metric_reference set to true may fail, produce warnings, or produce unexpected results. |
getName
Output only. Resource name for this CalculatedMetric.
Format: 'properties/{property_id}/calculatedMetrics/{calculated_metric_id}'
| Returns | |
|---|---|
| Type | Description |
string |
|
setName
Output only. Resource name for this CalculatedMetric.
Format: 'properties/{property_id}/calculatedMetrics/{calculated_metric_id}'
| Parameter | |
|---|---|
| Name | Description |
var |
string
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getDescription
Optional. Description for this calculated metric.
Max length of 4096 characters.
| Returns | |
|---|---|
| Type | Description |
string |
|
setDescription
Optional. Description for this calculated metric.
Max length of 4096 characters.
| Parameter | |
|---|---|
| Name | Description |
var |
string
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getDisplayName
Required. Display name for this calculated metric as shown in the Google Analytics UI. Max length 82 characters.
| Returns | |
|---|---|
| Type | Description |
string |
|
setDisplayName
Required. Display name for this calculated metric as shown in the Google Analytics UI. Max length 82 characters.
| Parameter | |
|---|---|
| Name | Description |
var |
string
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getCalculatedMetricId
Output only. The ID to use for the calculated metric. In the UI, this is referred to as the "API name." The calculated_metric_id is used when referencing this calculated metric from external APIs. For example, "calcMetric:{calculated_metric_id}".
| Returns | |
|---|---|
| Type | Description |
string |
|
setCalculatedMetricId
Output only. The ID to use for the calculated metric. In the UI, this is referred to as the "API name." The calculated_metric_id is used when referencing this calculated metric from external APIs. For example, "calcMetric:{calculated_metric_id}".
| Parameter | |
|---|---|
| Name | Description |
var |
string
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getMetricUnit
Required. The type for the calculated metric's value.
| Returns | |
|---|---|
| Type | Description |
int |
Enum of type MetricUnit. |
setMetricUnit
Required. The type for the calculated metric's value.
| Parameter | |
|---|---|
| Name | Description |
var |
int
Enum of type MetricUnit. |
| Returns | |
|---|---|
| Type | Description |
$this |
|
getRestrictedMetricType
Output only. Types of restricted data that this metric contains.
| Returns | |
|---|---|
| Type | Description |
Google\Protobuf\Internal\RepeatedField |
|
setRestrictedMetricType
Output only. Types of restricted data that this metric contains.
| Parameter | |
|---|---|
| Name | Description |
var |
int[]
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getFormula
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:parameter_name + cartPurchaseQuantity ) / 2.0"
| Returns | |
|---|---|
| Type | Description |
string |
|
setFormula
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:parameter_name + cartPurchaseQuantity ) / 2.0"
| Parameter | |
|---|---|
| Name | Description |
var |
string
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getInvalidMetricReference
Output only. If true, this calculated metric has a invalid metric reference. Anything using a calculated metric with invalid_metric_reference set to true may fail, produce warnings, or produce unexpected results.
| Returns | |
|---|---|
| Type | Description |
bool |
|
setInvalidMetricReference
Output only. If true, this calculated metric has a invalid metric reference. Anything using a calculated metric with invalid_metric_reference set to true may fail, produce warnings, or produce unexpected results.
| Parameter | |
|---|---|
| Name | Description |
var |
bool
|
| Returns | |
|---|---|
| Type | Description |
$this |
|