@google-analytics/data 2.6.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -104,6 +104,71 @@ service BetaAnalyticsData {
104
104
  body: "*"
105
105
  };
106
106
  }
107
+
108
+ // This compatibility method lists dimensions and metrics that can be added to
109
+ // a report request and maintain compatibility. This method fails if the
110
+ // request's dimensions and metrics are incompatible.
111
+ //
112
+ // In Google Analytics, reports fail if they request incompatible dimensions
113
+ // and/or metrics; in that case, you will need to remove dimensions and/or
114
+ // metrics from the incompatible report until the report is compatible.
115
+ //
116
+ // The Realtime and Core reports have different compatibility rules. This
117
+ // method checks compatibility for Core reports.
118
+ rpc CheckCompatibility(CheckCompatibilityRequest) returns (CheckCompatibilityResponse) {
119
+ option (google.api.http) = {
120
+ post: "/v1beta/{property=properties/*}:checkCompatibility"
121
+ body: "*"
122
+ };
123
+ }
124
+ }
125
+
126
+ // The request for compatibility information for a report's dimensions and
127
+ // metrics. Check compatibility provides a preview of the compatibility of a
128
+ // report; fields shared with the `runReport` request should be the same values
129
+ // as in your `runReport` request.
130
+ message CheckCompatibilityRequest {
131
+ // A Google Analytics GA4 property identifier whose events are tracked. To
132
+ // learn more, see [where to find your Property
133
+ // ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
134
+ // `property` should be the same value as in your `runReport` request.
135
+ //
136
+ // Example: properties/1234
137
+ //
138
+ // Set the Property ID to 0 for compatibility checking on dimensions and
139
+ // metrics common to all properties. In this special mode, this method will
140
+ // not return custom dimensions and metrics.
141
+ string property = 1;
142
+
143
+ // The dimensions in this report. `dimensions` should be the same value as in
144
+ // your `runReport` request.
145
+ repeated Dimension dimensions = 2;
146
+
147
+ // The metrics in this report. `metrics` should be the same value as in your
148
+ // `runReport` request.
149
+ repeated Metric metrics = 3;
150
+
151
+ // The filter clause of dimensions. `dimensionFilter` should be the same value
152
+ // as in your `runReport` request.
153
+ FilterExpression dimension_filter = 4;
154
+
155
+ // The filter clause of metrics. `metricFilter` should be the same value as in
156
+ // your `runReport` request
157
+ FilterExpression metric_filter = 5;
158
+
159
+ // Filters the dimensions and metrics in the response to just this
160
+ // compatibility. Commonly used as `”compatibilityFilter”: “COMPATIBLE”`
161
+ // to only return compatible dimensions & metrics.
162
+ Compatibility compatibility_filter = 6;
163
+ }
164
+
165
+ // The compatibility response with the compatibility of each dimension & metric.
166
+ message CheckCompatibilityResponse {
167
+ // The compatibility of each dimension.
168
+ repeated DimensionCompatibility dimension_compatibilities = 1;
169
+
170
+ // The compatibility of each metric.
171
+ repeated MetricCompatibility metric_compatibilities = 2;
107
172
  }
108
173
 
109
174
  // The dimensions and metrics currently accepted in reporting methods.
@@ -148,13 +213,14 @@ message RunReportRequest {
148
213
  // must be unspecified.
149
214
  repeated DateRange date_ranges = 4;
150
215
 
151
- // The filter clause of dimensions. Dimensions must be requested to be used in
152
- // this filter. Metrics cannot be used in this filter.
216
+ // Dimension filters allow you to ask for only specific dimension values in
217
+ // the report. To learn more, see [Fundamentals of Dimension
218
+ // Filters](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#dimension_filters)
219
+ // for examples. Metrics cannot be used in this filter.
153
220
  FilterExpression dimension_filter = 5;
154
221
 
155
222
  // The filter clause of metrics. Applied at post aggregation phase, similar to
156
- // SQL having-clause. Metrics must be requested to be used in this filter.
157
- // Dimensions cannot be used in this filter.
223
+ // SQL having-clause. Dimensions cannot be used in this filter.
158
224
  FilterExpression metric_filter = 6;
159
225
 
160
226
  // The row count of the start row. The first row is counted as row 0.
@@ -52,8 +52,8 @@ message MinuteRange {
52
52
  //
53
53
  // If unspecified, `startMinutesAgo` is defaulted to 29. Standard Analytics
54
54
  // properties can request up to the last 30 minutes of event data
55
- // (`startMinutesAgo <= 29`), and 360 Analytics properties can request up to
56
- // the last 60 minutes of event data (`startMinutesAgo <= 59`).
55
+ // (`startMinutesAgo <= 29`), and Google Analytics 360 properties can request
56
+ // up to the last 60 minutes of event data (`startMinutesAgo <= 59`).
57
57
  optional int32 start_minutes_ago = 1;
58
58
 
59
59
  // The inclusive end minute for the query as a number of minutes before now.
@@ -63,8 +63,8 @@ message MinuteRange {
63
63
  //
64
64
  // If unspecified, `endMinutesAgo` is defaulted to 0. Standard Analytics
65
65
  // properties can request any minute in the last 30 minutes of event data
66
- // (`endMinutesAgo <= 29`), and 360 Analytics properties can request any
67
- // minute in the last 60 minutes of event data (`endMinutesAgo <= 59`).
66
+ // (`endMinutesAgo <= 29`), and Google Analytics 360 properties can request
67
+ // any minute in the last 60 minutes of event data (`endMinutesAgo <= 59`).
68
68
  optional int32 end_minutes_ago = 2;
69
69
 
70
70
  // Assigns a name to this minute range. The dimension `dateRange` is valued to
@@ -87,7 +87,7 @@ message Dimension {
87
87
  // would like within the allowed character set. For example if a
88
88
  // `dimensionExpression` concatenates `country` and `city`, you could call
89
89
  // that dimension `countryAndCity`. Dimension names that you choose must match
90
- // the regular expression "^[a-zA-Z0-9_]$".
90
+ // the regular expression `^[a-zA-Z0-9_]$`.
91
91
  //
92
92
  // Dimensions are referenced by `name` in `dimensionFilter`, `orderBys`,
93
93
  // `dimensionExpression`, and `pivots`.
@@ -152,7 +152,7 @@ message Metric {
152
152
  // within the allowed character set. For example if `expression` is
153
153
  // `screenPageViews/sessions`, you could call that metric's name =
154
154
  // `viewsPerSession`. Metric names that you choose must match the regular
155
- // expression "^[a-zA-Z0-9_]$".
155
+ // expression `^[a-zA-Z0-9_]$`.
156
156
  //
157
157
  // Metrics are referenced by `name` in `metricFilter`, `orderBys`, and metric
158
158
  // `expression`.
@@ -555,9 +555,55 @@ message CohortReportSettings {
555
555
 
556
556
  // Response's metadata carrying additional information about the report content.
557
557
  message ResponseMetaData {
558
+ // The schema restrictions actively enforced in creating this report. To learn
559
+ // more, see [Access and data-restriction
560
+ // management](https://support.google.com/analytics/answer/10851388).
561
+ message SchemaRestrictionResponse {
562
+ // A metric actively restricted in creating the report.
563
+ message ActiveMetricRestriction {
564
+ // The name of the restricted metric.
565
+ optional string metric_name = 1;
566
+
567
+ // The reason for this metric's restriction.
568
+ repeated RestrictedMetricType restricted_metric_types = 2;
569
+ }
570
+
571
+ // All restrictions actively enforced in creating the report. For example,
572
+ // `purchaseRevenue` always has the restriction type `REVENUE_DATA`.
573
+ // However, this active response restriction is only populated if the user's
574
+ // custom role disallows access to `REVENUE_DATA`.
575
+ repeated ActiveMetricRestriction active_metric_restrictions = 1;
576
+ }
577
+
558
578
  // If true, indicates some buckets of dimension combinations are rolled into
559
579
  // "(other)" row. This can happen for high cardinality reports.
560
580
  bool data_loss_from_other_row = 3;
581
+
582
+ // Describes the schema restrictions actively enforced in creating this
583
+ // report. To learn more, see [Access and data-restriction
584
+ // management](https://support.google.com/analytics/answer/10851388).
585
+ optional SchemaRestrictionResponse schema_restriction_response = 4;
586
+
587
+ // The currency code used in this report. Intended to be used in formatting
588
+ // currency metrics like `purchaseRevenue` for visualization. If currency_code
589
+ // was specified in the request, this response parameter will echo the request
590
+ // parameter; otherwise, this response parameter is the property's current
591
+ // currency_code.
592
+ //
593
+ // Currency codes are string encodings of currency types from the ISO 4217
594
+ // standard (https://en.wikipedia.org/wiki/ISO_4217); for example "USD",
595
+ // "EUR", "JPY". To learn more, see
596
+ // https://support.google.com/analytics/answer/9796179.
597
+ optional string currency_code = 5;
598
+
599
+ // The property's current timezone. Intended to be used to interpret
600
+ // time-based dimensions like `hour` and `minute`. Formatted as strings from
601
+ // the IANA Time Zone database (https://www.iana.org/time-zones); for example
602
+ // "America/New_York" or "Asia/Tokyo".
603
+ optional string time_zone = 6;
604
+
605
+ // If empty reason is specified, the report is empty for this reason.
606
+ optional string empty_reason = 7;
561
607
  }
562
608
 
563
609
  // Describes a dimension column in the report. Dimensions requested in a report
@@ -736,10 +782,28 @@ message DimensionMetadata {
736
782
 
737
783
  // True if the dimension is a custom dimension for this property.
738
784
  bool custom_definition = 5;
785
+
786
+ // The display name of the category that this dimension belongs to. Similar
787
+ // dimensions and metrics are categorized together.
788
+ string category = 7;
739
789
  }
740
790
 
741
791
  // Explains a metric.
742
792
  message MetricMetadata {
793
+ // Justifications for why this metric is blocked.
794
+ enum BlockedReason {
795
+ // Will never be specified in API response.
796
+ BLOCKED_REASON_UNSPECIFIED = 0;
797
+
798
+ // If present, your access is blocked to revenue related metrics for this
799
+ // property, and this metric is revenue related.
800
+ NO_REVENUE_METRICS = 1;
801
+
802
+ // If present, your access is blocked to cost related metrics for this
803
+ // property, and this metric is cost related.
804
+ NO_COST_METRICS = 2;
805
+ }
806
+
743
807
  // A metric name. Useable in [Metric](#Metric)'s `name`. For example,
744
808
  // `eventCount`.
745
809
  string api_name = 1;
@@ -767,6 +831,44 @@ message MetricMetadata {
767
831
 
768
832
  // True if the metric is a custom metric for this property.
769
833
  bool custom_definition = 7;
834
+
835
+ // If reasons are specified, your access is blocked to this metric for this
836
+ // property. API requests from you to this property for this metric will
837
+ // succeed; however, the report will contain only zeros for this metric. API
838
+ // requests with metric filters on blocked metrics will fail. If reasons are
839
+ // empty, you have access to this metric.
840
+ //
841
+ // To learn more, see [Access and data-restriction
842
+ // management](https://support.google.com/analytics/answer/10851388).
843
+ repeated BlockedReason blocked_reasons = 8;
844
+
845
+ // The display name of the category that this metrics belongs to. Similar
846
+ // dimensions and metrics are categorized together.
847
+ string category = 10;
848
+ }
849
+
850
+ // The compatibility for a single dimension.
851
+ message DimensionCompatibility {
852
+ // The dimension metadata contains the API name for this compatibility
853
+ // information. The dimension metadata also contains other helpful information
854
+ // like the UI name and description.
855
+ optional DimensionMetadata dimension_metadata = 1;
856
+
857
+ // The compatibility of this dimension. If the compatibility is COMPATIBLE,
858
+ // this dimension can be successfully added to the report.
859
+ optional Compatibility compatibility = 2;
860
+ }
861
+
862
+ // The compatibility for a single metric.
863
+ message MetricCompatibility {
864
+ // The metric metadata contains the API name for this compatibility
865
+ // information. The metric metadata also contains other helpful information
866
+ // like the UI name and description.
867
+ optional MetricMetadata metric_metadata = 1;
868
+
869
+ // The compatibility of this metric. If the compatibility is COMPATIBLE,
870
+ // this metric can be successfully added to the report.
871
+ optional Compatibility compatibility = 2;
770
872
  }
771
873
 
772
874
  // Represents aggregation of metrics.
@@ -828,3 +930,30 @@ enum MetricType {
828
930
  // A length in kilometers; a special floating point type.
829
931
  TYPE_KILOMETERS = 13;
830
932
  }
933
+
934
+ // Categories of data that you may be restricted from viewing on certain GA4
935
+ // properties.
936
+ enum RestrictedMetricType {
937
+ // Unspecified type.
938
+ RESTRICTED_METRIC_TYPE_UNSPECIFIED = 0;
939
+
940
+ // Cost metrics such as `adCost`.
941
+ COST_DATA = 1;
942
+
943
+ // Revenue metrics such as `purchaseRevenue`.
944
+ REVENUE_DATA = 2;
945
+ }
946
+
947
+ // The compatibility types for a single dimension or metric.
948
+ enum Compatibility {
949
+ // Unspecified compatibility.
950
+ COMPATIBILITY_UNSPECIFIED = 0;
951
+
952
+ // The dimension or metric is compatible. This dimension or metric can be
953
+ // successfully added to a report.
954
+ COMPATIBLE = 1;
955
+
956
+ // The dimension or metric is incompatible. This dimension or metric cannot be
957
+ // successfully added to a report.
958
+ INCOMPATIBLE = 2;
959
+ }