Skip to content

Commit 3c414af

Browse files
Google APIscopybara-github
authored andcommitted
feat: add CheckCompatibility method to the API
feat: add `DimensionCompatibility`, `MetricCompatibility`, `Compatibility` types to the API feat: add `category` field to `DimensionMetadata`, `MetricMetadata` types PiperOrigin-RevId: 394292123
1 parent 1c01db6 commit 3c414af

2 files changed

Lines changed: 116 additions & 4 deletions

File tree

google/analytics/data/v1beta/analytics_data_api.proto

Lines changed: 70 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,71 @@ service BetaAnalyticsData {
104104
body: "*"
105105
};
106106
}
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;
107172
}
108173

109174
// The dimensions and metrics currently accepted in reporting methods.
@@ -148,13 +213,14 @@ message RunReportRequest {
148213
// must be unspecified.
149214
repeated DateRange date_ranges = 4;
150215

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.
153220
FilterExpression dimension_filter = 5;
154221

155222
// 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.
158224
FilterExpression metric_filter = 6;
159225

160226
// The row count of the start row. The first row is counted as row 0.

google/analytics/data/v1beta/data.proto

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,10 @@ message DimensionMetadata {
736736

737737
// True if the dimension is a custom dimension for this property.
738738
bool custom_definition = 5;
739+
740+
// The display name of the category that this dimension belongs to. Similar
741+
// dimensions and metrics are categorized together.
742+
string category = 7;
739743
}
740744

741745
// Explains a metric.
@@ -767,6 +771,34 @@ message MetricMetadata {
767771

768772
// True if the metric is a custom metric for this property.
769773
bool custom_definition = 7;
774+
775+
// The display name of the category that this metrics belongs to. Similar
776+
// dimensions and metrics are categorized together.
777+
string category = 10;
778+
}
779+
780+
// The compatibility for a single dimension.
781+
message DimensionCompatibility {
782+
// The dimension metadata contains the API name for this compatibility
783+
// information. The dimension metadata also contains other helpful information
784+
// like the UI name and description.
785+
optional DimensionMetadata dimension_metadata = 1;
786+
787+
// The compatibility of this dimension. If the compatibility is COMPATIBLE,
788+
// this dimension can be successfully added to the report.
789+
optional Compatibility compatibility = 2;
790+
}
791+
792+
// The compatibility for a single metric.
793+
message MetricCompatibility {
794+
// The metric metadata contains the API name for this compatibility
795+
// information. The metric metadata also contains other helpful information
796+
// like the UI name and description.
797+
optional MetricMetadata metric_metadata = 1;
798+
799+
// The compatibility of this metric. If the compatibility is COMPATIBLE,
800+
// this metric can be successfully added to the report.
801+
optional Compatibility compatibility = 2;
770802
}
771803

772804
// Represents aggregation of metrics.
@@ -828,3 +860,17 @@ enum MetricType {
828860
// A length in kilometers; a special floating point type.
829861
TYPE_KILOMETERS = 13;
830862
}
863+
864+
// The compatibility types for a single dimension or metric.
865+
enum Compatibility {
866+
// Unspecified compatibility.
867+
COMPATIBILITY_UNSPECIFIED = 0;
868+
869+
// The dimension or metric is compatible. This dimension or metric can be
870+
// successfully added to a report.
871+
COMPATIBLE = 1;
872+
873+
// The dimension or metric is incompatible. This dimension or metric cannot be
874+
// successfully added to a report.
875+
INCOMPATIBLE = 2;
876+
}

0 commit comments

Comments
 (0)