1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
|
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.analytics.data.v1alpha;
import "google/protobuf/duration.proto";
option go_package = "google.golang.org/genproto/googleapis/analytics/data/v1alpha;data";
option java_multiple_files = true;
option java_outer_classname = "ReportingApiProto";
option java_package = "com.google.analytics.data.v1alpha";
// A contiguous set of days: startDate, startDate + 1, ..., endDate. Requests
// are allowed up to 4 date ranges.
message DateRange {
// The inclusive start date for the query in the format `YYYY-MM-DD`. Cannot
// be after `end_date`. The format `NdaysAgo`, `yesterday`, or `today` is also
// accepted, and in that case, the date is inferred based on the property's
// reporting time zone.
string start_date = 1;
// The inclusive end date for the query in the format `YYYY-MM-DD`. Cannot
// be before `start_date`. The format `NdaysAgo`, `yesterday`, or `today` is
// also accepted, and in that case, the date is inferred based on the
// property's reporting time zone.
string end_date = 2;
// Assigns a name to this date range. The dimension `dateRange` is valued to
// this name in a report response. If set, cannot begin with `date_range_` or
// `RESERVED_`. If not set, date ranges are named by their zero based index in
// the request: `date_range_0`, `date_range_1`, etc.
string name = 3;
}
// 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, the city could be "Paris" or "New York".
message Dimension {
// 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 within the allowed character set. For example if a
// `dimensionExpression` concatenates `country` and `city`, you could call
// that dimension `countryAndCity`. Dimension names that you choose must match
// the regular expression `^[a-zA-Z0-9_]$`.
//
// Dimensions are referenced by `name` in `dimensionFilter`, `orderBys`,
// `dimensionExpression`, and `pivots`.
string name = 1;
// One dimension can be the result of an expression of multiple dimensions.
// For example, dimension "country, city": concatenate(country, ", ", city).
DimensionExpression dimension_expression = 2;
}
// 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).
message DimensionExpression {
// Used to convert a dimension value to a single case.
message CaseExpression {
// Name of a dimension. The name must refer back to a name in dimensions
// field of the request.
string dimension_name = 1;
}
// Used to combine dimension values to a single dimension.
message ConcatenateExpression {
// Names of dimensions. The names must refer back to names in the dimensions
// field of the request.
repeated string dimension_names = 1;
// 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".
string delimiter = 2;
}
// Specify one type of dimension expression for `DimensionExpression`.
oneof one_expression {
// Used to convert a dimension value to lower case.
CaseExpression lower_case = 4;
// Used to convert a dimension value to upper case.
CaseExpression upper_case = 5;
// Used to combine dimension values to a single dimension.
// For example, dimension "country, city": concatenate(country, ", ", city).
ConcatenateExpression concatenate = 6;
}
}
// To express dimension or metric filters. The fields in the same
// FilterExpression need to be either all dimensions or all metrics.
message FilterExpression {
// Specify one type of filter expression for `FilterExpression`.
oneof expr {
// The FilterExpressions in and_group have an AND relationship.
FilterExpressionList and_group = 1;
// The FilterExpressions in or_group have an OR relationship.
FilterExpressionList or_group = 2;
// The FilterExpression is NOT of not_expression.
FilterExpression not_expression = 3;
// A primitive filter. In the same FilterExpression, all of the filter's
// field names need to be either all dimensions or all metrics.
Filter filter = 4;
}
}
// A list of filter expressions.
message FilterExpressionList {
// A list of filter expressions.
repeated FilterExpression expressions = 1;
}
// An expression to filter dimension or metric values.
message Filter {
// The dimension name or metric name. Must be a name defined in dimensions
// or metrics.
string field_name = 1;
// Specify one type of filter for `Filter`.
oneof one_filter {
// Strings related filter.
StringFilter string_filter = 2;
// A filter for in list values.
InListFilter in_list_filter = 3;
// A filter for numeric or date values.
NumericFilter numeric_filter = 4;
// A filter for between two values.
BetweenFilter between_filter = 5;
}
}
// The filter for string
message StringFilter {
// The match type of a string filter
enum MatchType {
// Unspecified
MATCH_TYPE_UNSPECIFIED = 0;
// Exact match of the string value.
EXACT = 1;
// Begins with the string value.
BEGINS_WITH = 2;
// Ends with the string value.
ENDS_WITH = 3;
// Contains the string value.
CONTAINS = 4;
// Full match for the regular expression with the string value.
FULL_REGEXP = 5;
// Partial match for the regular expression with the string value.
PARTIAL_REGEXP = 6;
}
// The match type for this filter.
MatchType match_type = 1;
// The string value used for the matching.
string value = 2;
// If true, the string value is case sensitive.
bool case_sensitive = 3;
}
// The result needs to be in a list of string values.
message InListFilter {
// The list of string values.
// Must be non-empty.
repeated string values = 1;
// If true, the string value is case sensitive.
bool case_sensitive = 2;
}
// Filters for numeric or date values.
message NumericFilter {
// The operation applied to a numeric filter
enum Operation {
// Unspecified.
OPERATION_UNSPECIFIED = 0;
// Equal
EQUAL = 1;
// Less than
LESS_THAN = 2;
// Less than or equal
LESS_THAN_OR_EQUAL = 3;
// Greater than
GREATER_THAN = 4;
// Greater than or equal
GREATER_THAN_OR_EQUAL = 5;
}
// The operation type for this filter.
Operation operation = 1;
// A numeric value or a date value.
NumericValue value = 2;
}
// To express that the result needs to be between two numbers (inclusive).
message BetweenFilter {
// Begins with this number.
NumericValue from_value = 1;
// Ends with this number.
NumericValue to_value = 2;
}
// To represent a number.
message NumericValue {
// One of a numeric value
oneof one_value {
// Integer value
int64 int64_value = 1;
// Double value
double double_value = 2;
}
}
// 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.
message DimensionHeader {
// The dimension's name.
string name = 1;
}
// 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.
message MetricHeader {
// The metric's name.
string name = 1;
// The metric's data type.
MetricType type = 2;
}
// 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"
// }
// ]
// ```
message Row {
// List of requested dimension values. In a PivotReport, dimension_values
// are only listed for dimensions included in a pivot.
repeated DimensionValue dimension_values = 1;
// List of requested visible metric values.
repeated MetricValue metric_values = 2;
}
// The value of a dimension.
message DimensionValue {
// One kind of dimension value
oneof one_value {
// Value as a string if the dimension type is a string.
string value = 1;
}
}
// The value of a metric.
message MetricValue {
// One of metric value
oneof one_value {
// Measurement value. See MetricHeader for type.
string value = 4;
}
}
// 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.
message PropertyQuota {
// 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.
QuotaStatus tokens_per_day = 1;
// 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.
QuotaStatus tokens_per_hour = 2;
// Standard Analytics Properties can send up to 10 concurrent requests;
// Analytics 360 Properties can use up to 50 concurrent requests.
QuotaStatus concurrent_requests = 3;
// 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.
QuotaStatus server_errors_per_project_per_hour = 4;
// Analytics Properties can send up to 120 requests with potentially
// thresholded dimensions per hour. In a batch request, each report request
// is individually counted for this quota if the request contains potentially
// thresholded dimensions.
QuotaStatus potentially_thresholded_requests_per_hour = 5;
}
// Current state for a particular quota group.
message QuotaStatus {
// Quota consumed by this request.
int32 consumed = 1;
// Quota remaining after this request.
int32 remaining = 2;
}
// Breakdowns add a dimension to the funnel table sub report response.
message FunnelBreakdown {
// The dimension column added to the funnel table sub report response. The
// breakdown dimension breaks down each funnel step. A valid
// `breakdownDimension` is required if `funnelBreakdown` is specified.
Dimension breakdown_dimension = 1;
// The maximum number of distinct values of the breakdown dimension to return
// in the response. A `limit` of `5` is used if limit is not specified. Limit
// must exceed zero and cannot exceed 15.
optional int64 limit = 2;
}
// Next actions state the value for a dimension after the user has achieved
// a step but before the same user has achieved the next step. For example if
// the `nextActionDimension` is `eventName`, then `nextActionDimension` in the
// `i`th funnel step row will return first event after the event that qualified
// the user into the `i`th funnel step but before the user achieved the `i+1`th
// funnel step.
message FunnelNextAction {
// The dimension column added to the funnel visualization sub report response.
// The next action dimension returns the next dimension value of this
// dimension after the user has attained the `i`th funnel step.
//
// `nextActionDimension` currently only supports `eventName` and most Page /
// Screen dimensions like `pageTitle` and `pagePath`. `nextActionDimension`
// cannot be a dimension expression.
Dimension next_action_dimension = 1;
// The maximum number of distinct values of the breakdown dimension to return
// in the response. A `limit` of `5` is used if limit is not specified. Limit
// must exceed zero and cannot exceed 5.
optional int64 limit = 2;
}
// Configures the funnel in a funnel report request. A funnel reports on users
// as they pass through a sequence of steps.
//
// Funnel exploration lets you visualize the steps your users take to complete a
// task and quickly see how well they are succeeding or failing at each step.
// For example, how do prospects become shoppers and then become buyers? How do
// one time buyers become repeat buyers? With this information, you can improve
// inefficient or abandoned customer journeys.
message Funnel {
// In an open funnel, users can enter the funnel in any step, and in a closed
// funnel, users must enter the funnel in the first step. Optional. If
// unspecified, a closed funnel is used.
bool is_open_funnel = 1;
// The sequential steps of this funnel.
repeated FunnelStep steps = 2;
}
// Steps define the user journey you want to measure. Steps contain one or
// more conditions that your users must meet to be included in that step of
// the funnel journey.
message FunnelStep {
// The distinctive name for this step. If unspecified, steps will be named
// by a 1 based indexed name (i.e. "0. ", "1. ", etc.). This name defines
// string value returned by the `funnelStepName` dimension. For example,
// specifying `name = Purchase` in the request's third funnel step will
// produce `3. Purchase` in the funnel report response.
string name = 1;
// If true, this step must directly follow the previous step. If false,
// there can be events between the previous step and this step. If
// unspecified, `isDirectlyFollowedBy` is treated as false.
bool is_directly_followed_by = 2;
// If specified, this step must complete within this duration of the
// completion of the prior step. `withinDurationFromPriorStep` is inclusive
// of the endpoint at the microsecond granularity. For example a duration of
// 5 seconds can be completed at 4.9 or 5.0 seconds, but not 5 seconds and 1
// microsecond.
//
// `withinDurationFromPriorStep` is optional, and if unspecified, steps may
// be separated by any time duration.
optional google.protobuf.Duration within_duration_from_prior_step = 3;
// The condition that your users must meet to be included in this step of
// the funnel journey.
FunnelFilterExpression filter_expression = 4;
}
// Funnel sub reports contain the dimension and metric data values. For example,
// 12 users reached the second step of the funnel.
message FunnelSubReport {
// Describes dimension columns. Funnel reports always include the funnel step
// dimension in sub report responses. Additional dimensions like breakdowns,
// dates, and next actions may be present in the response if requested.
repeated DimensionHeader dimension_headers = 1;
// Describes metric columns. Funnel reports always include active users in sub
// report responses. The funnel table includes additional metrics like
// completion rate, abandonments, and abandonments rate.
repeated MetricHeader metric_headers = 2;
// Rows of dimension value combinations and metric values in the report.
repeated Row rows = 3;
// Metadata for the funnel report.
FunnelResponseMetadata metadata = 4;
}
// User segments are subsets of users who engaged with your site or app. For
// example, users who have previously purchased; users who added items to their
// shopping carts, but didn’t complete a purchase.
message UserSegment {
// Defines which users are included in this segment. Optional.
UserSegmentCriteria user_inclusion_criteria = 1;
// Defines which users are excluded in this segment. Optional.
UserSegmentExclusion exclusion = 2;
}
// A user matches a criteria if the user's events meet the conditions in the
// criteria.
message UserSegmentCriteria {
// A user matches this criteria if the user matches each of these
// `andConditionGroups` and each of the `andSequenceGroups`.
// `andConditionGroups` may be empty if `andSequenceGroups` are specified.
repeated UserSegmentConditionGroup and_condition_groups = 1;
// A user matches this criteria if the user matches each of these
// `andSequenceGroups` and each of the `andConditionGroups`.
// `andSequenceGroups` may be empty if `andConditionGroups` are specified.
repeated UserSegmentSequenceGroup and_sequence_groups = 2;
}
// Scoping specifies which events are considered when evaluating if a user
// meets a criteria.
enum UserCriteriaScoping {
// Unspecified criteria scoping. Do not specify.
USER_CRITERIA_SCOPING_UNSPECIFIED = 0;
// If the criteria is satisfied within one event, the user matches the
// criteria.
USER_CRITERIA_WITHIN_SAME_EVENT = 1;
// If the criteria is satisfied within one session, the user matches the
// criteria.
USER_CRITERIA_WITHIN_SAME_SESSION = 2;
// If the criteria is satisfied by any events for the user, the user
// matches the criteria.
USER_CRITERIA_ACROSS_ALL_SESSIONS = 3;
}
// Conditions tell Analytics what data to include in or exclude from the
// segment.
message UserSegmentConditionGroup {
// Data is included or excluded from the segment based on if it matches
// the condition group. This scoping defines how many events the
// `segmentFilterExpression` is evaluated on before the condition group
// is determined to be matched or not. For example if `conditionScoping =
// USER_CRITERIA_WITHIN_SAME_SESSION`, the expression is evaluated on all
// events in a session, and then, the condition group is determined to be
// matched or not for this user. For example if `conditionScoping =
// USER_CRITERIA_WITHIN_SAME_EVENT`, the expression is evaluated on a single
// event, and then, the condition group is determined to be matched or not for
// this user.
//
// Optional. If unspecified, `conditionScoping = ACROSS_ALL_SESSIONS` is
// used.
UserCriteriaScoping condition_scoping = 1;
// Data is included or excluded from the segment based on if it matches
// this expression. Expressions express criteria on dimension, metrics,
// and/or parameters.
SegmentFilterExpression segment_filter_expression = 2;
}
// Define conditions that must occur in a specific order for the user to be
// a member of the segment.
message UserSegmentSequenceGroup {
// All sequence steps must be satisfied in the scoping for the user to
// match the sequence. For example if `sequenceScoping =
// USER_CRITERIA_WITHIN_SAME_SESSION`, all sequence steps must complete within
// one session for the user to match the sequence. `sequenceScoping =
// USER_CRITERIA_WITHIN_SAME_EVENT` is not supported.
//
// Optional. If unspecified, `conditionScoping = ACROSS_ALL_SESSIONS` is
// used.
UserCriteriaScoping sequence_scoping = 1;
// Defines the time period in which the whole sequence must occur; for
// example, 30 Minutes. `sequenceMaximumDuration` is inclusive
// of the endpoint at the microsecond granularity. For example a sequence
// with a maximum duration of 5 seconds can be completed at 4.9 or 5.0
// seconds, but not 5 seconds and 1 microsecond.
//
// `sequenceMaximumDuration` is optional, and if unspecified, sequences can
// be completed in any time duration.
google.protobuf.Duration sequence_maximum_duration = 2;
// An ordered sequence of condition steps. A user's events must complete
// each step in order for the user to match the
// `UserSegmentSequenceGroup`.
repeated UserSequenceStep user_sequence_steps = 3;
}
// A condition that must occur in the specified step order for this user
// to match the sequence.
message UserSequenceStep {
// If true, the event satisfying this step must be the very next event
// after the event satifying the last step. If false, this step indirectly
// follows the prior step; for example, there may be events between the
// prior step and this step. `isDirectlyFollowedBy` must be false for
// the first step.
bool is_directly_followed_by = 1;
// This sequence step must be satisfied in the scoping for the user to
// match the sequence. For example if `sequenceScoping =
// WITHIN_SAME_SESSION`, this sequence steps must complete within one
// session for the user to match the sequence. `stepScoping =
// ACROSS_ALL_SESSIONS` is only allowed if the `sequenceScoping =
// ACROSS_ALL_SESSIONS`.
//
// Optional. If unspecified, `stepScoping` uses the same
// `UserCriteriaScoping` as the `sequenceScoping`.
UserCriteriaScoping step_scoping = 2;
// A user matches this sequence step if their events match this
// expression. Expressions express criteria on dimension, metrics,
// and/or parameters.
SegmentFilterExpression segment_filter_expression = 3;
}
// Specifies which users are excluded in this segment.
message UserSegmentExclusion {
// Specifies how long an exclusion will last if a user matches the
// `userExclusionCriteria`.
//
// Optional. If unspecified, `userExclusionDuration` of
// `USER_EXCLUSION_TEMPORARY` is used.
UserExclusionDuration user_exclusion_duration = 1;
// If a user meets this condition, the user is excluded from membership in
// the segment for the `userExclusionDuration`.
UserSegmentCriteria user_exclusion_criteria = 2;
}
// Enumerates options for how long an exclusion will last if a user matches
// the `userExclusionCriteria`.
enum UserExclusionDuration {
// Unspecified exclusion duration. Do not specify.
USER_EXCLUSION_DURATION_UNSPECIFIED = 0;
// Temporarily exclude users from the segment during periods when the
// user meets the `userExclusionCriteria` condition.
USER_EXCLUSION_TEMPORARY = 1;
// Permanently exclude users from the segment if the user ever meets the
// `userExclusionCriteria` condition.
USER_EXCLUSION_PERMANENT = 2;
}
// Session segments are subsets of the sessions that occurred on your site or
// app: for example, all the sessions that originated from a particular
// advertising campaign.
message SessionSegment {
// Defines which sessions are included in this segment. Optional.
SessionSegmentCriteria session_inclusion_criteria = 1;
// Defines which sessions are excluded in this segment. Optional.
SessionSegmentExclusion exclusion = 2;
}
// A session matches a criteria if the session's events meet the conditions in
// the criteria.
message SessionSegmentCriteria {
// A session matches this criteria if the session matches each of these
// `andConditionGroups`.
repeated SessionSegmentConditionGroup and_condition_groups = 1;
}
// Scoping specifies which events are considered when evaluating if a
// session meets a criteria.
enum SessionCriteriaScoping {
// Unspecified criteria scoping. Do not specify.
SESSION_CRITERIA_SCOPING_UNSPECIFIED = 0;
// If the criteria is satisfied within one event, the session matches the
// criteria.
SESSION_CRITERIA_WITHIN_SAME_EVENT = 1;
// If the criteria is satisfied within one session, the session matches
// the criteria.
SESSION_CRITERIA_WITHIN_SAME_SESSION = 2;
}
// Conditions tell Analytics what data to include in or exclude from the
// segment.
message SessionSegmentConditionGroup {
// Data is included or excluded from the segment based on if it matches
// the condition group. This scoping defines how many events the
// `segmentFilterExpression` is evaluated on before the condition group
// is determined to be matched or not. For example if `conditionScoping =
// SESSION_CRITERIA_WITHIN_SAME_SESSION`, the expression is evaluated on all
// events in a session, and then, the condition group is determined to be
// matched or not for this session. For example if `conditionScoping =
// SESSION_CRITERIA_WITHIN_SAME_EVENT`, the expression is evaluated on a
// single event, and then, the condition group is determined to be matched or
// not for this session.
//
// Optional. If unspecified, a `conditionScoping` of `WITHIN_SAME_SESSION`
// is used.
SessionCriteriaScoping condition_scoping = 1;
// Data is included or excluded from the segment based on if it matches
// this expression. Expressions express criteria on dimension, metrics,
// and/or parameters.
SegmentFilterExpression segment_filter_expression = 2;
}
// Specifies which sessions are excluded in this segment.
message SessionSegmentExclusion {
// Specifies how long an exclusion will last if a session matches the
// `sessionExclusionCriteria`.
//
// Optional. If unspecified, a `sessionExclusionDuration` of
// `SESSION_EXCLUSION_TEMPORARY` is used.
SessionExclusionDuration session_exclusion_duration = 1;
// If a session meets this condition, the session is excluded from
// membership in the segment for the `sessionExclusionDuration`.
SessionSegmentCriteria session_exclusion_criteria = 2;
}
// Enumerates options for how long an exclusion will last if a session
// matches the `sessionExclusionCriteria`.
enum SessionExclusionDuration {
// Unspecified exclusion duration. Do not specify.
SESSION_EXCLUSION_DURATION_UNSPECIFIED = 0;
// Temporarily exclude sessions from the segment during periods when the
// session meets the `sessionExclusionCriteria` condition.
SESSION_EXCLUSION_TEMPORARY = 1;
// Permanently exclude sessions from the segment if the session ever meets
// the `sessionExclusionCriteria` condition.
SESSION_EXCLUSION_PERMANENT = 2;
}
// Event segments are subsets of events that were triggered on your site or app.
// for example, all purchase events made in a particular location; app_exception
// events that occurred on a specific operating system.
message EventSegment {
// Defines which events are included in this segment. Optional.
EventSegmentCriteria event_inclusion_criteria = 1;
// Defines which events are excluded in this segment. Optional.
EventSegmentExclusion exclusion = 2;
}
// An event matches a criteria if the event meet the conditions in the
// criteria.
message EventSegmentCriteria {
// An event matches this criteria if the event matches each of these
// `andConditionGroups`.
repeated EventSegmentConditionGroup and_condition_groups = 1;
}
// Scoping specifies which events are considered when evaluating if an event
// meets a criteria.
enum EventCriteriaScoping {
// Unspecified criteria scoping. Do not specify.
EVENT_CRITERIA_SCOPING_UNSPECIFIED = 0;
// If the criteria is satisfied within one event, the event matches the
// criteria.
EVENT_CRITERIA_WITHIN_SAME_EVENT = 1;
}
// Conditions tell Analytics what data to include in or exclude from the
// segment.
message EventSegmentConditionGroup {
// `conditionScoping` should always be `EVENT_CRITERIA_WITHIN_SAME_EVENT`.
//
// Optional. If unspecified, a `conditionScoping` of
// `EVENT_CRITERIA_WITHIN_SAME_EVENT` is used.
EventCriteriaScoping condition_scoping = 1;
// Data is included or excluded from the segment based on if it matches
// this expression. Expressions express criteria on dimension, metrics,
// and/or parameters.
SegmentFilterExpression segment_filter_expression = 2;
}
// Specifies which events are excluded in this segment.
message EventSegmentExclusion {
// `eventExclusionDuration` should always be `PERMANENTLY_EXCLUDE`.
//
// Optional. If unspecified, an `eventExclusionDuration` of
// `EVENT_EXCLUSION_PERMANENT` is used.
EventExclusionDuration event_exclusion_duration = 1;
// If an event meets this condition, the event is excluded from membership
// in the segment for the `eventExclusionDuration`.
EventSegmentCriteria event_exclusion_criteria = 2;
}
// Enumerates options for how long an exclusion will last if an event
// matches the `eventExclusionCriteria`.
enum EventExclusionDuration {
// Unspecified exclusion duration. Do not specify.
EVENT_EXCLUSION_DURATION_UNSPECIFIED = 0;
// Permanently exclude events from the segment if the event ever meets
// the `eventExclusionCriteria` condition.
EVENT_EXCLUSION_PERMANENT = 1;
}
// A segment is a subset of your Analytics data. For example, of your entire set
// of users, one segment might be users from a particular country or city.
// Another segment might be users who purchase a particular line of products or
// who visit a specific part of your site or trigger certain events in your app.
//
// To learn more, see [GA4 Segment
// Builder](https://support.google.com/analytics/answer/9304353).
message Segment {
// The name for this segment. If unspecified, segments are named "Segment".
// This name defines string value returned by the `segment` dimension. The
// `segment` dimension prefixes segment names by the 1-based index number of
// the segment in the request (i.e. "1. Segment", "2. Segment", etc.).
string name = 1;
// A segment is specified in one scope.
oneof one_segment_scope {
// User segments are subsets of users who engaged with your site or app.
UserSegment user_segment = 2;
// Session segments are subsets of the sessions that occurred on your site
// or app.
SessionSegment session_segment = 3;
// Event segments are subsets of events that were triggered on your site or
// app.
EventSegment event_segment = 4;
}
}
// Expresses combinations of segment filters.
message SegmentFilterExpression {
// Specify one type of filter for `SegmentFilterExpression`.
oneof expr {
// The SegmentFilterExpression in `andGroup` have an AND relationship.
SegmentFilterExpressionList and_group = 1;
// The SegmentFilterExpression in `orGroup` have an OR relationship.
SegmentFilterExpressionList or_group = 2;
// The SegmentFilterExpression is NOT of `notExpression`.
SegmentFilterExpression not_expression = 3;
// A primitive segment filter.
SegmentFilter segment_filter = 4;
// Creates a filter that matches events of a single event name. If a
// parameter filter expression is specified, only the subset of events that
// match both the single event name and the parameter filter expressions
// match this event filter.
SegmentEventFilter segment_event_filter = 5;
}
}
// A list of segment filter expressions.
message SegmentFilterExpressionList {
// The list of segment filter expressions
repeated SegmentFilterExpression expressions = 1;
}
// An expression to filter dimension or metric values.
message SegmentFilter {
// The dimension name or metric name.
string field_name = 1;
// Specify one type of filter for `Filter`.
oneof one_filter {
// Strings related filter.
StringFilter string_filter = 4;
// A filter for in list values.
InListFilter in_list_filter = 5;
// A filter for numeric or date values.
NumericFilter numeric_filter = 6;
// A filter for between two values.
BetweenFilter between_filter = 7;
}
// Specifies the scope for the filter.
SegmentFilterScoping filter_scoping = 8;
}
// Scopings specify how the dimensions & metrics of multiple events
// should be considered when evaluating a segment filter.
message SegmentFilterScoping {
// If `atAnyPointInTime` is true, this filter evaluates to true for all
// events if it evaluates to true for any event in the date range of the
// request.
//
// This `atAnyPointInTime` parameter does not extend the date range of
// events in the report. If `atAnyPointInTime` is true, only events within
// the report's date range are considered when evaluating this filter.
//
// This `atAnyPointInTime` is only able to be specified if the criteria
// scoping is `ACROSS_ALL_SESSIONS` and is not able to be specified in
// sequences.
//
// If the criteria scoping is `ACROSS_ALL_SESSIONS`, `atAnyPointInTime` =
// false is used if unspecified.
optional bool at_any_point_in_time = 1;
}
// Creates a filter that matches events of a single event name. If a parameter
// filter expression is specified, only the subset of events that match both the
// single event name and the parameter filter expressions match this event
// filter.
message SegmentEventFilter {
// This filter matches events of this single event name. Event name is
// required.
optional string event_name = 1;
// If specified, this filter matches events that match both the single event
// name and the parameter filter expressions.
//
// Inside the parameter filter expression, only parameter filters are
// available.
optional SegmentParameterFilterExpression segment_parameter_filter_expression = 2;
}
// Expresses combinations of segment filter on parameters.
message SegmentParameterFilterExpression {
// Specify one type of filter for `SegmentParameterFilterExpression`.
oneof expr {
// The SegmentParameterFilterExpression in `andGroup` have an AND
// relationship.
SegmentParameterFilterExpressionList and_group = 1;
// The SegmentParameterFilterExpression in `orGroup` have an OR
// relationship.
SegmentParameterFilterExpressionList or_group = 2;
// The SegmentParameterFilterExpression is NOT of `notExpression`.
SegmentParameterFilterExpression not_expression = 3;
// A primitive segment parameter filter.
SegmentParameterFilter segment_parameter_filter = 4;
}
}
// A list of segment parameter filter expressions.
message SegmentParameterFilterExpressionList {
// The list of segment parameter filter expressions.
repeated SegmentParameterFilterExpression expressions = 1;
}
// An expression to filter parameter values in a segment.
message SegmentParameterFilter {
// The field that is being filtered.
oneof one_parameter {
// This filter will be evaluated on the specified event parameter. Event
// parameters are logged as parameters of the event. Event parameters
// include fields like "firebase_screen" & "currency".
//
// Event parameters can only be used in segments & funnels and can only be
// used in a descendent filter from an EventFilter. In a descendent filter
// from an EventFilter either event or item parameters should be used.
string event_parameter_name = 1;
// This filter will be evaluated on the specified item parameter. Item
// parameters are logged as parameters in the item array. Item parameters
// include fields like "item_name" & "item_category".
//
// Item parameters can only be used in segments & funnels and can only be
// used in a descendent filter from an EventFilter. In a descendent filter
// from an EventFilter either event or item parameters should be used.
//
// Item parameters are only available in ecommerce events. To learn more
// about ecommerce events, see the [Measure ecommerce]
// (https://developers.google.com/analytics/devguides/collection/ga4/ecommerce)
// guide.
string item_parameter_name = 2;
}
// Specify one type of filter.
oneof one_filter {
// Strings related filter.
StringFilter string_filter = 4;
// A filter for in list values.
InListFilter in_list_filter = 5;
// A filter for numeric or date values.
NumericFilter numeric_filter = 6;
// A filter for between two values.
BetweenFilter between_filter = 7;
}
// Specifies the scope for the filter.
SegmentParameterFilterScoping filter_scoping = 8;
}
// Scopings specify how multiple events should be considered when evaluating a
// segment parameter filter.
message SegmentParameterFilterScoping {
// Accumulates the parameter over the specified period of days before
// applying the filter. Only supported if criteria scoping is
// `ACROSS_ALL_SESSIONS` or `WITHIN_SAME_SESSION`. Only supported if the
// parameter is `event_count`.
//
// For example if `inAnyNDayPeriod` is 3, the event_name is "purchase",
// the event parameter is "event_count", and the Filter's criteria is
// greater than 5, this filter will accumulate the event count of purchase
// events over every 3 consecutive day period in the report's date range; a
// user will pass this Filter's criteria to be included in this segment if
// their count of purchase events exceeds 5 in any 3 consecutive day period.
// For example, the periods 2021-11-01 to 2021-11-03, 2021-11-02 to
// 2021-11-04, 2021-11-03 to 2021-11-05, and etc. will be considered.
//
// The date range is not extended for the purpose of having a full N day
// window near the start of the date range. For example if a report is for
// 2021-11-01 to 2021-11-10 and `inAnyNDayPeriod` = 3, the first two day
// period will be effectively shortened because no event data outside the
// report's date range will be read. For example, the first four periods
// will effectively be: 2021-11-01 to 2021-11-01, 2021-11-01 to 2021-11-02,
// 2021-11-01 to 2021-11-03, and 2021-11-02 to 2021-11-04.
//
// `inAnyNDayPeriod` is optional. If not specified, the
// `segmentParameterFilter` is applied to each event individually.
optional int64 in_any_n_day_period = 1;
}
// Expresses combinations of funnel filters.
message FunnelFilterExpression {
// Specify one type of filter for `FunnelFilterExpression`.
oneof expr {
// The FunnelFilterExpression in `andGroup` have an AND relationship.
FunnelFilterExpressionList and_group = 1;
// The FunnelFilterExpression in `orGroup` have an OR relationship.
FunnelFilterExpressionList or_group = 2;
// The FunnelFilterExpression is NOT of `notExpression`.
FunnelFilterExpression not_expression = 3;
// A funnel filter for a dimension or metric.
FunnelFieldFilter funnel_field_filter = 4;
// Creates a filter that matches events of a single event name. If a
// parameter filter expression is specified, only the subset of events that
// match both the single event name and the parameter filter expressions
// match this event filter.
FunnelEventFilter funnel_event_filter = 5;
}
}
// A list of funnel filter expressions.
message FunnelFilterExpressionList {
// The list of funnel filter expressions.
repeated FunnelFilterExpression expressions = 1;
}
// An expression to filter dimension or metric values.
message FunnelFieldFilter {
// The dimension name or metric name.
string field_name = 1;
// Specify one type of filter.
oneof one_filter {
// Strings related filter.
StringFilter string_filter = 4;
// A filter for in list values.
InListFilter in_list_filter = 5;
// A filter for numeric or date values.
NumericFilter numeric_filter = 6;
// A filter for between two values.
BetweenFilter between_filter = 7;
}
}
// Creates a filter that matches events of a single event name. If a parameter
// filter expression is specified, only the subset of events that match both the
// single event name and the parameter filter expressions match this event
// filter.
message FunnelEventFilter {
// This filter matches events of this single event name. Event name is
// required.
optional string event_name = 1;
// If specified, this filter matches events that match both the single event
// name and the parameter filter expressions.
//
// Inside the parameter filter expression, only parameter filters are
// available.
optional FunnelParameterFilterExpression funnel_parameter_filter_expression = 2;
}
// Expresses combinations of funnel filters on parameters.
message FunnelParameterFilterExpression {
// Specify one type of filter for `FunnelParameterFilterExpression`.
oneof expr {
// The FunnelParameterFilterExpression in `andGroup` have an AND
// relationship.
FunnelParameterFilterExpressionList and_group = 1;
// The FunnelParameterFilterExpression in `orGroup` have an OR
// relationship.
FunnelParameterFilterExpressionList or_group = 2;
// The FunnelParameterFilterExpression is NOT of `notExpression`.
FunnelParameterFilterExpression not_expression = 3;
// A primitive funnel parameter filter.
FunnelParameterFilter funnel_parameter_filter = 4;
}
}
// A list of funnel parameter filter expressions.
message FunnelParameterFilterExpressionList {
// The list of funnel parameter filter expressions.
repeated FunnelParameterFilterExpression expressions = 1;
}
// An expression to filter parameter values in a funnel.
message FunnelParameterFilter {
// The field that is being filtered.
oneof one_parameter {
// This filter will be evaluated on the specified event parameter. Event
// parameters are logged as parameters of the event. Event parameters
// include fields like "firebase_screen" & "currency".
//
// Event parameters can only be used in segments & funnels and can only be
// used in a descendent filter from an EventFilter. In a descendent filter
// from an EventFilter either event or item parameters should be used.
string event_parameter_name = 1;
// This filter will be evaluated on the specified item parameter. Item
// parameters are logged as parameters in the item array. Item parameters
// include fields like "item_name" & "item_category".
//
// Item parameters can only be used in segments & funnels and can only be
// used in a descendent filter from an EventFilter. In a descendent filter
// from an EventFilter either event or item parameters should be used.
//
// Item parameters are only available in ecommerce events. To learn more
// about ecommerce events, see the [Measure ecommerce]
// (https://developers.google.com/analytics/devguides/collection/ga4/ecommerce)
// guide.
string item_parameter_name = 2;
}
// Specify one type of filter.
oneof one_filter {
// Strings related filter.
StringFilter string_filter = 4;
// A filter for in list values.
InListFilter in_list_filter = 5;
// A filter for numeric or date values.
NumericFilter numeric_filter = 6;
// A filter for between two values.
BetweenFilter between_filter = 7;
}
}
// The funnel report's response metadata carries additional information about
// the funnel report.
message FunnelResponseMetadata {
// If funnel report results are
// [sampled](https://support.google.com/analytics/answer/2637192), this
// describes what percentage of events were used in this funnel report. One
// `samplingMetadatas` is populated for each date range. Each
// `samplingMetadatas` corresponds to a date range in order that date ranges
// were specified in the request.
//
// However if the results are not sampled, this field will not be defined.
repeated SamplingMetadata sampling_metadatas = 1;
}
// If funnel report results are
// [sampled](https://support.google.com/analytics/answer/2637192), this
// metadata describes what percentage of events were used in this funnel
// report for a date range. Sampling is the practice of analyzing a subset of
// all data in order to uncover the meaningful information in the larger data
// set.
message SamplingMetadata {
// The total number of events read in this sampled report for a date range.
// This is the size of the subset this property's data that was analyzed in
// this funnel report.
int64 samples_read_count = 1;
// The total number of events present in this property's data that could
// have been analyzed in this funnel report for a date range. Sampling
// uncovers the meaningful information about the larger data set, and this
// is the size of the larger data set.
//
// To calculate the percentage of available data that was used in this
// funnel report, compute `samplesReadCount/samplingSpaceSize`.
int64 sampling_space_size = 2;
}
// A metric's value type.
enum MetricType {
// Unspecified type.
METRIC_TYPE_UNSPECIFIED = 0;
// Integer type.
TYPE_INTEGER = 1;
// Floating point type.
TYPE_FLOAT = 2;
// A duration of seconds; a special floating point type.
TYPE_SECONDS = 4;
// A duration in milliseconds; a special floating point type.
TYPE_MILLISECONDS = 5;
// A duration in minutes; a special floating point type.
TYPE_MINUTES = 6;
// A duration in hours; a special floating point type.
TYPE_HOURS = 7;
// A custom metric of standard type; a special floating point type.
TYPE_STANDARD = 8;
// An amount of money; a special floating point type.
TYPE_CURRENCY = 9;
// A length in feet; a special floating point type.
TYPE_FEET = 10;
// A length in miles; a special floating point type.
TYPE_MILES = 11;
// A length in meters; a special floating point type.
TYPE_METERS = 12;
// A length in kilometers; a special floating point type.
TYPE_KILOMETERS = 13;
}
|