# Google Analytics Data API . properties

## Instance Methods

Close httplib2 connections.

Returns metadata for dimensions and metrics available in reporting methods. Used to explore the dimensions and metrics. In this method, a Google Analytics GA4 Property Identifier is specified in the request, and the metadata response includes Custom dimensions and metrics as well as Universal metadata. For example if a custom metric with parameter name `levels_unlocked` is registered to a property, the Metadata response will contain `customEvent:levels_unlocked`. Universal metadata are dimensions and metrics applicable to any property such as `country` and `totalUsers`.

The Google Analytics Realtime API returns a customized report of realtime event data for your property. These reports show events and usage from the last 30 minutes.

### Method Details

`close()`

    Close httplib2 connections.

`getMetadata(name, x__xgafv=None)`

    Returns metadata for dimensions and metrics available in reporting methods. Used to explore the dimensions and metrics. In this method, a Google Analytics GA4 Property Identifier is specified in the request, and the metadata response includes Custom dimensions and metrics as well as Universal metadata. For example if a custom metric with parameter name `levels_unlocked` is registered to a property, the Metadata response will contain `customEvent:levels_unlocked`. Universal metadata are dimensions and metrics applicable to any property such as `country` and `totalUsers`.

    Args:
      name: string, Required. The resource name of the metadata to retrieve. This name field is specified in the URL path and not URL parameters. Property is a numeric Google Analytics GA4 Property identifier. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). Example: properties/1234/metadata Set the Property ID to 0 for dimensions and metrics common to all properties. In this special mode, this method will not return custom dimensions and metrics. (required)
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # The dimensions and metrics currently accepted in reporting methods.
      "dimensions": [ # The dimension descriptions.
        { # Explains a dimension.
          "apiName": "A String", # This dimension's name. Useable in [Dimension](#Dimension)'s `name`. For example, `eventName`.
          "customDefinition": True or False, # True if the dimension is a custom dimension for this property.
          "deprecatedApiNames": [ # Still usable but deprecated names for this dimension. If populated, this dimension is available by either `apiName` or one of `deprecatedApiNames` for a period of time. After the deprecation period, the dimension will be available only by `apiName`.
            "A String",
          ],
          "description": "A String", # Description of how this dimension is used and calculated.
          "uiName": "A String", # This dimension's name within the Google Analytics user interface. For example, `Event name`.
        },
      ],
      "metrics": [ # The metric descriptions.
        { # Explains a metric.
          "apiName": "A String", # A metric name. Useable in [Metric](#Metric)'s `name`. For example, `eventCount`.
          "customDefinition": True or False, # True if the metric is a custom metric for this property.
          "deprecatedApiNames": [ # Still usable but deprecated names for this metric. If populated, this metric is available by either `apiName` or one of `deprecatedApiNames` for a period of time. After the deprecation period, the metric will be available only by `apiName`.
            "A String",
          ],
          "description": "A String", # Description of how this metric is used and calculated.
          "expression": "A String", # The mathematical expression for this derived metric. Can be used in [Metric](#Metric)'s `expression` field for equivalent reports. Most metrics are not expressions, and for non-expressions, this field is empty.
          "type": "A String", # The type of this metric.
          "uiName": "A String", # This metric's name within the Google Analytics user interface. For example, `Event count`.
        },
      ],
      "name": "A String", # Resource name of this metadata.
    }

`runRealtimeReport(property, body=None, x__xgafv=None)`

    The Google Analytics Realtime API returns a customized report of realtime event data for your property. These reports show events and usage from the last 30 minutes.

    Args:
      property: string, A Google Analytics GA4 property identifier whose events are tracked. Specified in the URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). Example: properties/1234 (required)
      body: object, The request body.
        The object takes the form of:

    { # The request to generate a realtime report.
      "dimensionFilter": { # To express dimension or metric filters. The fields in the same FilterExpression need to be either all dimensions or all metrics. # The filter clause of dimensions. Dimensions must be requested to be used in this filter. Metrics cannot be used in this filter.
        "andGroup": { # A list of filter expressions. # The FilterExpressions in and_group have an AND relationship.
          "expressions": [ # A list of filter expressions.
            # Object with schema name: FilterExpression
          ],
        },
        "filter": { # An expression to filter dimension or metric values. # A primitive filter. All fields in filter in same FilterExpression needs to be either all dimensions or metrics.
          "betweenFilter": { # To express that the result needs to be between two numbers (inclusive). # A filter for two values.
            "fromValue": { # To represent a number. # Begins with this number.
              "doubleValue": 3.14, # Double value
              "int64Value": "A String", # Integer value
            },
            "toValue": { # To represent a number. # Ends with this number.
              "doubleValue": 3.14, # Double value
              "int64Value": "A String", # Integer value
            },
          },
          "fieldName": "A String", # The dimension name or metric name. Must be a name defined in dimensions or metrics.
          "inListFilter": { # The result needs to be in a list of string values. # A filter for in list values.
            "caseSensitive": True or False, # If true, the string value is case sensitive.
            "values": [ # The list of string values. Must be non-empty.
              "A String",
            ],
          },
          "numericFilter": { # Filters for numeric or date values. # A filter for numeric or date values.
            "operation": "A String", # The operation type for this filter.
            "value": { # To represent a number. # A numeric value or a date value.
              "doubleValue": 3.14, # Double value
              "int64Value": "A String", # Integer value
            },
          },
          "stringFilter": { # The filter for string # Strings related filter.
            "caseSensitive": True or False, # If true, the string value is case sensitive.
            "matchType": "A String", # The match type for this filter.
            "value": "A String", # The string value used for the matching.
          },
        },
        "notExpression": # Object with schema name: FilterExpression # The FilterExpression is NOT of not_expression.
        "orGroup": { # A list of filter expressions. # The FilterExpressions in or_group have an OR relationship.
          "expressions": [ # A list of filter expressions.
            # Object with schema name: FilterExpression
          ],
        },
      },
      "dimensions": [ # The dimensions requested and displayed.
        { # Dimensions are attributes of your data. For example, the dimension city indicates the city from which an event originates. Dimension values in report responses are strings; for example, city could be "Paris" or "New York". Requests are allowed up to 8 dimensions.
          "dimensionExpression": { # Used to express a dimension which is the result of a formula of multiple dimensions. Example usages: 1) lower_case(dimension) 2) concatenate(dimension1, symbol, dimension2). # One dimension can be the result of an expression of multiple dimensions. For example, dimension "country, city": concatenate(country, ", ", city).
            "concatenate": { # Used to combine dimension values to a single dimension. # Used to combine dimension values to a single dimension. For example, dimension "country, city": concatenate(country, ", ", city).
              "delimiter": "A String", # The delimiter placed between dimension names. Delimiters are often single characters such as "|" or "," but can be longer strings. If a dimension value contains the delimiter, both will be present in response with no distinction. For example if dimension 1 value = "US,FR", dimension 2 value = "JP", and delimiter = ",", then the response will contain "US,FR,JP".
              "dimensionNames": [ # Names of dimensions. The names must refer back to names in the dimensions field of the request.
                "A String",
              ],
            },
            "lowerCase": { # Used to convert a dimension value to a single case. # Used to convert a dimension value to lower case.
              "dimensionName": "A String", # Name of a dimension. The name must refer back to a name in dimensions field of the request.
            },
            "upperCase": { # Used to convert a dimension value to a single case. # Used to convert a dimension value to upper case.
              "dimensionName": "A String", # Name of a dimension. The name must refer back to a name in dimensions field of the request.
            },
          },
          "name": "A String", # The name of the dimension. See the [API Dimensions](https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema#dimensions) for the list of dimension names. If `dimensionExpression` is specified, `name` can be any string that you would like. For example if a `dimensionExpression` concatenates `country` and `city`, you could call that dimension `countryAndCity`. Dimensions are referenced by `name` in `dimensionFilter`, `orderBys`, `dimensionExpression`, and `pivots`.
        },
      ],
      "limit": "A String", # The number of rows to return. If the `limit` parameter is unspecified, 10,000 rows are returned. The API returns a maximum of 100,000 rows per request, no matter how many you ask for.
      "metricAggregations": [ # Aggregation of metrics. Aggregated metric values will be shown in rows where the dimension_values are set to "RESERVED_(MetricAggregation)".
        "A String",
      ],
      "metricFilter": { # To express dimension or metric filters. The fields in the same FilterExpression need to be either all dimensions or all metrics. # The filter clause of metrics. Applied at post aggregation phase, similar to SQL having-clause. Metrics must be requested to be used in this filter. Dimensions cannot be used in this filter.
        "andGroup": { # A list of filter expressions. # The FilterExpressions in and_group have an AND relationship.
          "expressions": [ # A list of filter expressions.
            # Object with schema name: FilterExpression
          ],
        },
        "filter": { # An expression to filter dimension or metric values. # A primitive filter. All fields in filter in same FilterExpression needs to be either all dimensions or metrics.
          "betweenFilter": { # To express that the result needs to be between two numbers (inclusive). # A filter for two values.
            "fromValue": { # To represent a number. # Begins with this number.
              "doubleValue": 3.14, # Double value
              "int64Value": "A String", # Integer value
            },
            "toValue": { # To represent a number. # Ends with this number.
              "doubleValue": 3.14, # Double value
              "int64Value": "A String", # Integer value
            },
          },
          "fieldName": "A String", # The dimension name or metric name. Must be a name defined in dimensions or metrics.
          "inListFilter": { # The result needs to be in a list of string values. # A filter for in list values.
            "caseSensitive": True or False, # If true, the string value is case sensitive.
            "values": [ # The list of string values. Must be non-empty.
              "A String",
            ],
          },
          "numericFilter": { # Filters for numeric or date values. # A filter for numeric or date values.
            "operation": "A String", # The operation type for this filter.
            "value": { # To represent a number. # A numeric value or a date value.
              "doubleValue": 3.14, # Double value
              "int64Value": "A String", # Integer value
            },
          },
          "stringFilter": { # The filter for string # Strings related filter.
            "caseSensitive": True or False, # If true, the string value is case sensitive.
            "matchType": "A String", # The match type for this filter.
            "value": "A String", # The string value used for the matching.
          },
        },
        "notExpression": # Object with schema name: FilterExpression # The FilterExpression is NOT of not_expression.
        "orGroup": { # A list of filter expressions. # The FilterExpressions in or_group have an OR relationship.
          "expressions": [ # A list of filter expressions.
            # Object with schema name: FilterExpression
          ],
        },
      },
      "metrics": [ # The metrics requested and displayed.
        { # The quantitative measurements of a report. For example, the metric `eventCount` is the total number of events. Requests are allowed up to 10 metrics.
          "expression": "A String", # A mathematical expression for derived metrics. For example, the metric Event count per user is `eventCount/totalUsers`.
          "invisible": True or False, # Indicates if a metric is invisible in the report response. If a metric is invisible, the metric will not produce a column in the response, but can be used in `metricFilter`, `orderBys`, or a metric `expression`.
          "name": "A String", # The name of the metric. See the [API Metrics](https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema#metrics) for the list of metric names. If `expression` is specified, `name` can be any string that you would like. For example if `expression` is `screenPageViews/sessions`, you could call that metric's name = `viewsPerSession`. Metrics are referenced by `name` in `metricFilter`, `orderBys`, and metric `expression`.
        },
      ],
      "orderBys": [ # Specifies how rows are ordered in the response.
        { # The sort options.
          "desc": True or False, # If true, sorts by descending order.
          "dimension": { # Sorts by dimension values. # Sorts results by a dimension's values.
            "dimensionName": "A String", # A dimension name in the request to order by.
            "orderType": "A String", # Controls the rule for dimension value ordering.
          },
          "metric": { # Sorts by metric values. # Sorts results by a metric's values.
            "metricName": "A String", # A metric name in the request to order by.
          },
          "pivot": { # Sorts by a pivot column group. # Sorts results by a metric's values within a pivot column group.
            "metricName": "A String", # In the response to order by, order rows by this column. Must be a metric name from the request.
            "pivotSelections": [ # Used to select a dimension name and value pivot. If multiple pivot selections are given, the sort occurs on rows where all pivot selection dimension name and value pairs match the row's dimension name and value pair.
              { # A pair of dimension names and values. Rows with this dimension pivot pair are ordered by the metric's value. For example if pivots = {{"browser", "Chrome"}} and metric_name = "Sessions", then the rows will be sorted based on Sessions in Chrome. ---------|----------|----------------|----------|---------------- | Chrome | Chrome | Safari | Safari ---------|----------|----------------|----------|---------------- Country | Sessions | Pages/Sessions | Sessions | Pages/Sessions ---------|----------|----------------|----------|---------------- US | 2 | 2 | 3 | 1 ---------|----------|----------------|----------|---------------- Canada | 3 | 1 | 4 | 1 ---------|----------|----------------|----------|----------------
                "dimensionName": "A String", # Must be a dimension name from the request.
                "dimensionValue": "A String", # Order by only when the named dimension is this value.
              },
            ],
          },
        },
      ],
      "returnPropertyQuota": True or False, # Toggles whether to return the current state of this Analytics Property's Realtime quota. Quota is returned in [PropertyQuota](#PropertyQuota).
    }

      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # The response realtime report table corresponding to a request.
      "dimensionHeaders": [ # Describes dimension columns. The number of DimensionHeaders and ordering of DimensionHeaders matches the dimensions present in rows.
        { # Describes a dimension column in the report. Dimensions requested in a report produce column entries within rows and DimensionHeaders. However, dimensions used exclusively within filters or expressions do not produce columns in a report; correspondingly, those dimensions do not produce headers.
          "name": "A String", # The dimension's name.
        },
      ],
      "maximums": [ # If requested, the maximum values of metrics.
        { # Report data for each row. For example if RunReportRequest contains: ```none "dimensions": [ { "name": "eventName" }, { "name": "countryId" } ], "metrics": [ { "name": "eventCount" } ] ``` One row with 'in_app_purchase' as the eventName, 'JP' as the countryId, and 15 as the eventCount, would be: ```none "dimensionValues": [ { "value": "in_app_purchase" }, { "value": "JP" } ], "metricValues": [ { "value": "15" } ] ```
          "dimensionValues": [ # List of requested dimension values. In a PivotReport, dimension_values are only listed for dimensions included in a pivot.
            { # The value of a dimension.
              "value": "A String", # Value as a string if the dimension type is a string.
            },
          ],
          "metricValues": [ # List of requested visible metric values.
            { # The value of a metric.
              "value": "A String", # Measurement value. See MetricHeader for type.
            },
          ],
        },
      ],
      "metricHeaders": [ # Describes metric columns. The number of MetricHeaders and ordering of MetricHeaders matches the metrics present in rows.
        { # Describes a metric column in the report. Visible metrics requested in a report produce column entries within rows and MetricHeaders. However, metrics used exclusively within filters or expressions do not produce columns in a report; correspondingly, those metrics do not produce headers.
          "name": "A String", # The metric's name.
          "type": "A String", # The metric's data type.
        },
      ],
      "minimums": [ # If requested, the minimum values of metrics.
        { # Report data for each row. For example if RunReportRequest contains: ```none "dimensions": [ { "name": "eventName" }, { "name": "countryId" } ], "metrics": [ { "name": "eventCount" } ] ``` One row with 'in_app_purchase' as the eventName, 'JP' as the countryId, and 15 as the eventCount, would be: ```none "dimensionValues": [ { "value": "in_app_purchase" }, { "value": "JP" } ], "metricValues": [ { "value": "15" } ] ```
          "dimensionValues": [ # List of requested dimension values. In a PivotReport, dimension_values are only listed for dimensions included in a pivot.
            { # The value of a dimension.
              "value": "A String", # Value as a string if the dimension type is a string.
            },
          ],
          "metricValues": [ # List of requested visible metric values.
            { # The value of a metric.
              "value": "A String", # Measurement value. See MetricHeader for type.
            },
          ],
        },
      ],
      "propertyQuota": { # Current state of all quotas for this Analytics Property. If any quota for a property is exhausted, all requests to that property will return Resource Exhausted errors. # This Analytics Property's Realtime quota state including this request.
        "concurrentRequests": { # Current state for a particular quota group. # Standard Analytics Properties can send up to 10 concurrent requests; Analytics 360 Properties can use up to 50 concurrent requests.
          "consumed": 42, # Quota consumed by this request.
          "remaining": 42, # Quota remaining after this request.
        },
        "serverErrorsPerProjectPerHour": { # Current state for a particular quota group. # Standard Analytics Properties and cloud project pairs can have up to 10 server errors per hour; Analytics 360 Properties and cloud project pairs can have up to 50 server errors per hour.
          "consumed": 42, # Quota consumed by this request.
          "remaining": 42, # Quota remaining after this request.
        },
        "tokensPerDay": { # Current state for a particular quota group. # Standard Analytics Properties can use up to 25,000 tokens per day; Analytics 360 Properties can use 250,000 tokens per day. Most requests consume fewer than 10 tokens.
          "consumed": 42, # Quota consumed by this request.
          "remaining": 42, # Quota remaining after this request.
        },
        "tokensPerHour": { # Current state for a particular quota group. # Standard Analytics Properties can use up to 5,000 tokens per hour; Analytics 360 Properties can use 50,000 tokens per hour. An API request consumes a single number of tokens, and that number is deducted from both the hourly and daily quotas.
          "consumed": 42, # Quota consumed by this request.
          "remaining": 42, # Quota remaining after this request.
        },
      },
      "rowCount": 42, # The total number of rows in the query result, regardless of the number of rows returned in the response. For example if a query returns 175 rows and includes limit = 50 in the API request, the response will contain row_count = 175 but only 50 rows.
      "rows": [ # Rows of dimension value combinations and metric values in the report.
        { # Report data for each row. For example if RunReportRequest contains: ```none "dimensions": [ { "name": "eventName" }, { "name": "countryId" } ], "metrics": [ { "name": "eventCount" } ] ``` One row with 'in_app_purchase' as the eventName, 'JP' as the countryId, and 15 as the eventCount, would be: ```none "dimensionValues": [ { "value": "in_app_purchase" }, { "value": "JP" } ], "metricValues": [ { "value": "15" } ] ```
          "dimensionValues": [ # List of requested dimension values. In a PivotReport, dimension_values are only listed for dimensions included in a pivot.
            { # The value of a dimension.
              "value": "A String", # Value as a string if the dimension type is a string.
            },
          ],
          "metricValues": [ # List of requested visible metric values.
            { # The value of a metric.
              "value": "A String", # Measurement value. See MetricHeader for type.
            },
          ],
        },
      ],
      "totals": [ # If requested, the totaled values of metrics.
        { # Report data for each row. For example if RunReportRequest contains: ```none "dimensions": [ { "name": "eventName" }, { "name": "countryId" } ], "metrics": [ { "name": "eventCount" } ] ``` One row with 'in_app_purchase' as the eventName, 'JP' as the countryId, and 15 as the eventCount, would be: ```none "dimensionValues": [ { "value": "in_app_purchase" }, { "value": "JP" } ], "metricValues": [ { "value": "15" } ] ```
          "dimensionValues": [ # List of requested dimension values. In a PivotReport, dimension_values are only listed for dimensions included in a pivot.
            { # The value of a dimension.
              "value": "A String", # Value as a string if the dimension type is a string.
            },
          ],
          "metricValues": [ # List of requested visible metric values.
            { # The value of a metric.
              "value": "A String", # Measurement value. See MetricHeader for type.
            },
          ],
        },
      ],
    }