@google-analytics/data 5.2.1 → 6.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.
package/README.md CHANGED
@@ -8,7 +8,7 @@ This library is considered to be in **preview**. This means it is still a
8
8
  work-in-progress and under active development. Any release is subject to
9
9
  backwards-incompatible changes at any time.
10
10
 
11
- [![npm version](https://img.shields.io/npm/v/@google-cloud/data.svg)](https://www.npmjs.org/package/@google-cloud/data)
11
+ [![npm version](https://img.shields.io/npm/v/@google-analytics/data.svg)](https://www.npmjs.org/package/@google-analytics/data)
12
12
 
13
13
  Google Analytics Data API client for Node.js
14
14
 
@@ -46,7 +46,7 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].
46
46
  ### Installing the client library
47
47
 
48
48
  ```bash
49
- npm install @google-cloud/data
49
+ npm install @google-analytics/data
50
50
  ```
51
51
 
52
52
  [//]: # "partials.body"
@@ -61,6 +61,7 @@ Samples are in the [`samples/`][homepage_samples] directory. Each sample's `READ
61
61
  | create recurring audience list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.create_recurring_audience_list.js) |
62
62
  | create report task | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.create_report_task.js) |
63
63
  | get audience list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.get_audience_list.js) |
64
+ | get metadata | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.get_metadata.js) |
64
65
  | get property quotas snapshot | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.get_property_quotas_snapshot.js) |
65
66
  | get recurring audience list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.get_recurring_audience_list.js) |
66
67
  | get report task | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.get_report_task.js) |
@@ -70,7 +71,7 @@ Samples are in the [`samples/`][homepage_samples] directory. Each sample's `READ
70
71
  | query audience list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.query_audience_list.js) |
71
72
  | query report task | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.query_report_task.js) |
72
73
  | run funnel report | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.run_funnel_report.js) |
73
- | sheet export audience list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.sheet_export_audience_list.js) |
74
+ | run report | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.run_report.js) |
74
75
  | analytics | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/snippet_metadata_google.analytics.data.v1alpha.json) |
75
76
  | batch run pivot reports | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1beta/beta_analytics_data.batch_run_pivot_reports.js) |
76
77
  | batch run reports | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1beta/beta_analytics_data.batch_run_reports.js) |
@@ -104,7 +105,7 @@ best-efforts basis with the following warnings:
104
105
  Client libraries targeting some end-of-life versions of Node.js are available, and
105
106
  can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag).
106
107
  The dist-tags follow the naming convention `legacy-(version)`.
107
- For example, `npm install @google-cloud/data@legacy-8` installs client libraries
108
+ For example, `npm install @google-analytics/data@legacy-8` installs client libraries
108
109
  for versions compatible with Node.js 8.
109
110
 
110
111
  ## Versioning
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Google LLC
1
+ // Copyright 2026 Google LLC
2
2
  //
3
3
  // Licensed under the Apache License, Version 2.0 (the "License");
4
4
  // you may not use this file except in compliance with the License.
@@ -38,10 +38,7 @@ service AlphaAnalyticsData {
38
38
  option (google.api.default_host) = "analyticsdata.googleapis.com";
39
39
  option (google.api.oauth_scopes) =
40
40
  "https://www.googleapis.com/auth/analytics,"
41
- "https://www.googleapis.com/auth/analytics.readonly,"
42
- "https://www.googleapis.com/auth/drive,"
43
- "https://www.googleapis.com/auth/drive.file,"
44
- "https://www.googleapis.com/auth/spreadsheets";
41
+ "https://www.googleapis.com/auth/analytics.readonly";
45
42
 
46
43
  // Returns a customized funnel report of your Google Analytics event data. The
47
44
  // data returned from the API is as a table with columns for the requested
@@ -131,34 +128,6 @@ service AlphaAnalyticsData {
131
128
  option (google.api.method_signature) = "name";
132
129
  }
133
130
 
134
- // Exports an audience list of users to a Google Sheet. After creating an
135
- // audience, the users are not immediately available for listing. First, a
136
- // request to `CreateAudienceList` is necessary to create an audience list of
137
- // users, and then second, this method is used to export those users in the
138
- // audience list to a Google Sheet.
139
- //
140
- // See [Creating an Audience
141
- // List](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-basics)
142
- // for an introduction to Audience Lists with examples.
143
- //
144
- // Audiences in Google Analytics 4 allow you to segment your users in the ways
145
- // that are important to your business. To learn more, see
146
- // https://support.google.com/analytics/answer/9267572.
147
- //
148
- // This method is introduced at alpha stability with the intention of
149
- // gathering feedback on syntax and capabilities before entering beta. To give
150
- // your feedback on this API, complete the
151
- // [Google Analytics Audience Export API
152
- // Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
153
- rpc SheetExportAudienceList(SheetExportAudienceListRequest)
154
- returns (SheetExportAudienceListResponse) {
155
- option (google.api.http) = {
156
- post: "/v1alpha/{name=properties/*/audienceLists/*}:exportSheet"
157
- body: "*"
158
- };
159
- option (google.api.method_signature) = "name";
160
- }
161
-
162
131
  // Gets configuration metadata about a specific audience list. This method
163
132
  // can be used to understand an audience list after it has been created.
164
133
  //
@@ -331,6 +300,37 @@ service AlphaAnalyticsData {
331
300
  };
332
301
  option (google.api.method_signature) = "parent";
333
302
  }
303
+
304
+ // Returns a customized report of your Google Analytics event data. Reports
305
+ // contain statistics derived from data collected by the Google Analytics
306
+ // tracking code. The data returned from the API is as a table with columns
307
+ // for the requested dimensions and metrics. Metrics are individual
308
+ // measurements of user activity on your property, such as active users or
309
+ // event count. Dimensions break down metrics across some common criteria,
310
+ // such as country or event name.
311
+ rpc RunReport(RunReportRequest) returns (RunReportResponse) {
312
+ option (google.api.http) = {
313
+ post: "/v1alpha/{property=properties/*}:runReport"
314
+ body: "*"
315
+ };
316
+ }
317
+
318
+ // Returns metadata for dimensions and metrics available in reporting methods.
319
+ // Used to explore the dimensions and metrics. In this method, a Google
320
+ // Analytics property identifier is specified in the request, and
321
+ // the metadata response includes Custom dimensions and metrics as well as
322
+ // Universal metadata.
323
+ //
324
+ // For example if a custom metric with parameter name `levels_unlocked` is
325
+ // registered to a property, the Metadata response will contain
326
+ // `customEvent:levels_unlocked`. Universal metadata are dimensions and
327
+ // metrics applicable to any property such as `country` and `totalUsers`.
328
+ rpc GetMetadata(GetMetadataRequest) returns (Metadata) {
329
+ option (google.api.http) = {
330
+ get: "/v1alpha/{name=properties/*/metadata}"
331
+ };
332
+ option (google.api.method_signature) = "name";
333
+ }
334
334
  }
335
335
 
336
336
  // A request to create a new recurring audience list.
@@ -789,69 +789,6 @@ message QueryAudienceListResponse {
789
789
  optional int32 row_count = 3;
790
790
  }
791
791
 
792
- // A request to export users in an audience list to a Google Sheet.
793
- message SheetExportAudienceListRequest {
794
- // Required. The name of the audience list to retrieve users from.
795
- // Format: `properties/{property}/audienceLists/{audience_list}`
796
- string name = 1 [
797
- (google.api.field_behavior) = REQUIRED,
798
- (google.api.resource_reference) = {
799
- type: "analyticsdata.googleapis.com/AudienceList"
800
- }
801
- ];
802
-
803
- // Optional. The row count of the start row. The first row is counted as row
804
- // 0.
805
- //
806
- // When paging, the first request does not specify offset; or equivalently,
807
- // sets offset to 0; the first request returns the first `limit` of rows. The
808
- // second request sets offset to the `limit` of the first request; the second
809
- // request returns the second `limit` of rows.
810
- //
811
- // To learn more about this pagination parameter, see
812
- // [Pagination](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
813
- int64 offset = 2 [(google.api.field_behavior) = OPTIONAL];
814
-
815
- // Optional. The number of rows to return. If unspecified, 10,000 rows are
816
- // returned. The API returns a maximum of 250,000 rows per request, no matter
817
- // how many you ask for. `limit` must be positive.
818
- //
819
- // The API can also return fewer rows than the requested `limit`, if there
820
- // aren't as many dimension values as the `limit`.
821
- //
822
- // To learn more about this pagination parameter, see
823
- // [Pagination](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
824
- int64 limit = 3 [(google.api.field_behavior) = OPTIONAL];
825
- }
826
-
827
- // The created Google Sheet with the list of users in an audience list.
828
- message SheetExportAudienceListResponse {
829
- // A uri for you to visit in your browser to view the Google Sheet.
830
- optional string spreadsheet_uri = 1;
831
-
832
- // An ID that identifies the created Google Sheet resource.
833
- optional string spreadsheet_id = 2;
834
-
835
- // The total number of rows in the AudienceList result. `rowCount` is
836
- // independent of the number of rows returned in the response, the `limit`
837
- // request parameter, and the `offset` request parameter. For example if a
838
- // query returns 175 rows and includes `limit` of 50 in the API request, the
839
- // response will contain `rowCount` of 175 but only 50 rows.
840
- //
841
- // To learn more about this pagination parameter, see
842
- // [Pagination](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
843
- optional int32 row_count = 3;
844
-
845
- // Configuration data about AudienceList being exported. Returned to help
846
- // interpret the AudienceList in the Google Sheet of this response.
847
- //
848
- // For example, the AudienceList may have more rows than are present in the
849
- // Google Sheet, and in that case, you may want to send an additional sheet
850
- // export request with a different `offset` value to retrieve the next page of
851
- // rows in an additional Google Sheet.
852
- optional AudienceList audience_list = 4;
853
- }
854
-
855
792
  // Dimension value attributes for the audience user row.
856
793
  message AudienceRow {
857
794
  // Each dimension value attribute for an audience user. One dimension value
@@ -1302,3 +1239,206 @@ message ListReportTasksResponse {
1302
1239
  // If this field is omitted, there are no subsequent pages.
1303
1240
  optional string next_page_token = 2;
1304
1241
  }
1242
+
1243
+ // The request to generate a report.
1244
+ message RunReportRequest {
1245
+ // Required. A Google Analytics property identifier whose events are tracked.
1246
+ // Specified in the URL path and not the body. To learn more, see [where to
1247
+ // find your Property
1248
+ // ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
1249
+ // Within a batch request, this property should either be unspecified or
1250
+ // consistent with the batch-level property.
1251
+ //
1252
+ // Example: properties/1234
1253
+ string property = 1 [(google.api.field_behavior) = REQUIRED];
1254
+
1255
+ // Optional. The dimensions requested and displayed.
1256
+ repeated Dimension dimensions = 2 [(google.api.field_behavior) = OPTIONAL];
1257
+
1258
+ // Optional. The metrics requested and displayed.
1259
+ repeated Metric metrics = 3 [(google.api.field_behavior) = OPTIONAL];
1260
+
1261
+ // Optional. Date ranges of data to read. If multiple date ranges are
1262
+ // requested, each response row will contain a zero based date range index. If
1263
+ // two date ranges overlap, the event data for the overlapping days is
1264
+ // included in the response rows for both date ranges. In a cohort request,
1265
+ // this `dateRanges` must be unspecified.
1266
+ repeated DateRange date_ranges = 4 [(google.api.field_behavior) = OPTIONAL];
1267
+
1268
+ // Optional. Dimension filters let you ask for only specific dimension values
1269
+ // in the report. To learn more, see [Fundamentals of Dimension
1270
+ // Filters](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#dimension_filters)
1271
+ // for examples. Metrics cannot be used in this filter.
1272
+ FilterExpression dimension_filter = 5
1273
+ [(google.api.field_behavior) = OPTIONAL];
1274
+
1275
+ // Optional. The filter clause of metrics. Applied after aggregating the
1276
+ // report's rows, similar to SQL having-clause. Dimensions cannot be used in
1277
+ // this filter.
1278
+ FilterExpression metric_filter = 6 [(google.api.field_behavior) = OPTIONAL];
1279
+
1280
+ // Optional. The row count of the start row. The first row is counted as row
1281
+ // 0.
1282
+ //
1283
+ // When paging, the first request does not specify offset; or equivalently,
1284
+ // sets offset to 0; the first request returns the first `limit` of rows. The
1285
+ // second request sets offset to the `limit` of the first request; the second
1286
+ // request returns the second `limit` of rows.
1287
+ //
1288
+ // To learn more about this pagination parameter, see
1289
+ // [Pagination](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
1290
+ int64 offset = 7 [(google.api.field_behavior) = OPTIONAL];
1291
+
1292
+ // Optional. The maximum number of rows to return. If unspecified, 10,000 rows
1293
+ // are returned. The API returns a maximum of 250,000 rows per request, no
1294
+ // matter how many you ask for. `limit` must be positive.
1295
+ //
1296
+ // The API can also return fewer rows than the requested `limit`, if there
1297
+ // aren't as many dimension values as the `limit`. For instance, there are
1298
+ // fewer than 300 possible values for the dimension `country`, so when
1299
+ // reporting on only `country`, you can't get more than 300 rows, even if you
1300
+ // set `limit` to a higher value.
1301
+ //
1302
+ // To learn more about this pagination parameter, see
1303
+ // [Pagination](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
1304
+ int64 limit = 8 [(google.api.field_behavior) = OPTIONAL];
1305
+
1306
+ // Optional. Aggregation of metrics. Aggregated metric values will be shown in
1307
+ // rows where the dimension_values are set to "RESERVED_(MetricAggregation)".
1308
+ // Aggregates including both comparisons and multiple date ranges will
1309
+ // be aggregated based on the date ranges.
1310
+ repeated MetricAggregation metric_aggregations = 9
1311
+ [(google.api.field_behavior) = OPTIONAL];
1312
+
1313
+ // Optional. Specifies how rows are ordered in the response.
1314
+ // Requests including both comparisons and multiple date ranges will
1315
+ // have order bys applied on the comparisons.
1316
+ repeated OrderBy order_bys = 10 [(google.api.field_behavior) = OPTIONAL];
1317
+
1318
+ // Optional. A currency code in ISO4217 format, such as "AED", "USD", "JPY".
1319
+ // If the field is empty, the report uses the property's default currency.
1320
+ string currency_code = 11 [(google.api.field_behavior) = OPTIONAL];
1321
+
1322
+ // Optional. Cohort group associated with this request. If there is a cohort
1323
+ // group in the request the 'cohort' dimension must be present.
1324
+ CohortSpec cohort_spec = 12 [(google.api.field_behavior) = OPTIONAL];
1325
+
1326
+ // Optional. If false or unspecified, each row with all metrics equal to 0
1327
+ // will not be returned. If true, these rows will be returned if they are not
1328
+ // separately removed by a filter.
1329
+ //
1330
+ // Regardless of this `keep_empty_rows` setting, only data recorded by the
1331
+ // Google Analytics property can be displayed in a report.
1332
+ //
1333
+ // For example if a property never logs a `purchase` event, then a query for
1334
+ // the `eventName` dimension and `eventCount` metric will not have a row
1335
+ // eventName: "purchase" and eventCount: 0.
1336
+ bool keep_empty_rows = 13 [(google.api.field_behavior) = OPTIONAL];
1337
+
1338
+ // Optional. Toggles whether to return the current state of this Google
1339
+ // Analytics property's quota. Quota is returned in
1340
+ // [PropertyQuota](#PropertyQuota).
1341
+ bool return_property_quota = 14 [(google.api.field_behavior) = OPTIONAL];
1342
+
1343
+ // Optional. The configuration of comparisons requested and displayed. The
1344
+ // request only requires a comparisons field in order to receive a comparison
1345
+ // column in the response.
1346
+ repeated Comparison comparisons = 15 [(google.api.field_behavior) = OPTIONAL];
1347
+
1348
+ // Optional. Controls conversion reporting. This field is optional. If this
1349
+ // field is set or any conversion metrics are requested, the report will be a
1350
+ // conversion report.
1351
+ ConversionSpec conversion_spec = 16 [(google.api.field_behavior) = OPTIONAL];
1352
+ }
1353
+
1354
+ // The response report table corresponding to a request.
1355
+ message RunReportResponse {
1356
+ // Describes dimension columns. The number of DimensionHeaders and ordering of
1357
+ // DimensionHeaders matches the dimensions present in rows.
1358
+ repeated DimensionHeader dimension_headers = 1;
1359
+
1360
+ // Describes metric columns. The number of MetricHeaders and ordering of
1361
+ // MetricHeaders matches the metrics present in rows.
1362
+ repeated MetricHeader metric_headers = 2;
1363
+
1364
+ // Rows of dimension value combinations and metric values in the report.
1365
+ repeated Row rows = 3;
1366
+
1367
+ // If requested, the totaled values of metrics.
1368
+ repeated Row totals = 4;
1369
+
1370
+ // If requested, the maximum values of metrics.
1371
+ repeated Row maximums = 5;
1372
+
1373
+ // If requested, the minimum values of metrics.
1374
+ repeated Row minimums = 6;
1375
+
1376
+ // The total number of rows in the query result, regardless of the number of
1377
+ // rows returned in the response. For example if a query returns 175 rows and
1378
+ // includes limit = 50 in the API request, the response will contain row_count
1379
+ // = 175 but only 50 rows.
1380
+ //
1381
+ // To learn more about this pagination parameter, see
1382
+ // [Pagination](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
1383
+ int32 row_count = 7;
1384
+
1385
+ // Metadata for the report.
1386
+ ResponseMetaData metadata = 8;
1387
+
1388
+ // This Analytics Property's quota state including this request.
1389
+ PropertyQuota property_quota = 9;
1390
+
1391
+ // Identifies what kind of resource this message is. This `kind` is always the
1392
+ // fixed string "analyticsData#runReport". Useful to distinguish between
1393
+ // response types in JSON.
1394
+ string kind = 10;
1395
+
1396
+ // A token, which can be sent as `page_token` to retrieve the next page.
1397
+ // If this field is omitted, there are no subsequent pages.
1398
+ optional string next_page_token = 11;
1399
+ }
1400
+
1401
+ // Request for a property's dimension and metric metadata.
1402
+ message GetMetadataRequest {
1403
+ // Required. The resource name of the metadata to retrieve. This name field is
1404
+ // specified in the URL path and not URL parameters. Property is a numeric
1405
+ // Google Analytics property identifier. To learn more, see [where to find
1406
+ // your Property
1407
+ // ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
1408
+ //
1409
+ // Example: properties/1234/metadata
1410
+ //
1411
+ // Set the Property ID to 0 for dimensions and metrics common to all
1412
+ // properties. In this special mode, this method will not return custom
1413
+ // dimensions and metrics.
1414
+ string name = 1 [
1415
+ (google.api.field_behavior) = REQUIRED,
1416
+ (google.api.resource_reference) = {
1417
+ type: "analyticsdata.googleapis.com/Metadata"
1418
+ }
1419
+ ];
1420
+ }
1421
+
1422
+ // The dimensions, metrics and comparisons currently accepted in reporting
1423
+ // methods.
1424
+ message Metadata {
1425
+ option (google.api.resource) = {
1426
+ type: "analyticsdata.googleapis.com/Metadata"
1427
+ pattern: "properties/{property}/metadata"
1428
+ };
1429
+
1430
+ // Resource name of this metadata.
1431
+ string name = 3;
1432
+
1433
+ // The dimension descriptions.
1434
+ repeated DimensionMetadata dimensions = 1;
1435
+
1436
+ // The metric descriptions.
1437
+ repeated MetricMetadata metrics = 2;
1438
+
1439
+ // The comparison descriptions.
1440
+ repeated ComparisonMetadata comparisons = 4;
1441
+
1442
+ // The conversion descriptions.
1443
+ repeated ConversionMetadata conversions = 5;
1444
+ }
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Google LLC
1
+ // Copyright 2026 Google LLC
2
2
  //
3
3
  // Licensed under the Apache License, Version 2.0 (the "License");
4
4
  // you may not use this file except in compliance with the License.
@@ -156,6 +156,24 @@ message Metric {
156
156
  bool invisible = 3;
157
157
  }
158
158
 
159
+ // Defines an individual comparison. Most requests will include multiple
160
+ // comparisons so that the report compares between the comparisons.
161
+ message Comparison {
162
+ // Each comparison produces separate rows in the response. In the response,
163
+ // this comparison is identified by this name. If name is unspecified, we will
164
+ // use the saved comparisons display name.
165
+ optional string name = 1;
166
+
167
+ oneof one_comparison {
168
+ // A basic comparison.
169
+ FilterExpression dimension_filter = 2;
170
+
171
+ // A saved comparison identified by the comparison's resource name.
172
+ // For example, 'comparisons/1234'.
173
+ string comparison = 3;
174
+ }
175
+ }
176
+
159
177
  // To express dimension or metric filters. The fields in the same
160
178
  // FilterExpression need to be either all dimensions or all metrics.
161
179
  message FilterExpression {
@@ -487,6 +505,25 @@ message CohortReportSettings {
487
505
  bool accumulate = 1;
488
506
  }
489
507
 
508
+ // Identifies if the report data is from the standard report data or
509
+ // conversion data
510
+ enum Section {
511
+ // Should never be specified.
512
+ SECTION_UNSPECIFIED = 0;
513
+
514
+ // The report data is from the standard report data. Google Analytics reports
515
+ // include acquisition, engagement, and user behavior reports. Reports use
516
+ // dimensions like session source & landing page; reports use metrics like
517
+ // sessions, views, and engagement time.
518
+ SECTION_REPORT = 1;
519
+
520
+ // The report data is from the conversion data. The Google Analytics
521
+ // Advertising section reports on conversion performance. Advertising reports
522
+ // use dimensions like source & medium; advertising reports use metrics like
523
+ // all conversions and ads cost.
524
+ SECTION_ADVERTISING = 2;
525
+ }
526
+
490
527
  // Response's metadata carrying additional information about the report content.
491
528
  message ResponseMetaData {
492
529
  // The schema restrictions actively enforced in creating this report. To learn
@@ -561,15 +598,18 @@ message ResponseMetaData {
561
598
  // Interests](https://support.google.com/analytics/answer/2799357).
562
599
  optional bool subject_to_thresholding = 8;
563
600
 
564
- // If this report's results are
601
+ // If this report results is
565
602
  // [sampled](https://support.google.com/analytics/answer/13331292), this
566
603
  // describes the percentage of events used in this report. One
567
604
  // `samplingMetadatas` is populated for each date range. Each
568
- // `samplingMetadatas` corresponds to a date range in the order that date
569
- // ranges were specified in the request.
605
+ // `samplingMetadatas` corresponds to a date range in order that date ranges
606
+ // were specified in the request.
570
607
  //
571
608
  // However if the results are not sampled, this field will not be defined.
572
609
  repeated SamplingMetadata sampling_metadatas = 9;
610
+
611
+ // Identifies the type of data in the report.
612
+ Section section = 10;
573
613
  }
574
614
 
575
615
  // Describes a dimension column in the report. Dimensions requested in a report
@@ -1488,8 +1528,8 @@ message FunnelResponseMetadata {
1488
1528
  // [sampled](https://support.google.com/analytics/answer/13331292), this
1489
1529
  // describes what percentage of events were used in this funnel report. One
1490
1530
  // `samplingMetadatas` is populated for each date range. Each
1491
- // `samplingMetadatas` corresponds to a date range in the order that date
1492
- // ranges were specified in the request.
1531
+ // `samplingMetadatas` corresponds to a date range in order that date ranges
1532
+ // were specified in the request.
1493
1533
  //
1494
1534
  // However if the results are not sampled, this field will not be defined.
1495
1535
  repeated SamplingMetadata sampling_metadatas = 1;
@@ -1609,3 +1649,166 @@ enum SamplingLevel {
1609
1649
  // https://support.google.com/analytics/answer/10896953.
1610
1650
  UNSAMPLED = 3;
1611
1651
  }
1652
+
1653
+ // Controls conversion reporting.
1654
+ //
1655
+ // <aside class="caution">
1656
+ // This feature may not be available to your Google Analytics property. The
1657
+ // Google Analytics team is actively working to expand this feature to more
1658
+ // properties. Please reach out to your
1659
+ // <a href="https://support.google.com/analytics/gethelp">support team</a> if
1660
+ // you have questions about the eligibility of your property.
1661
+ // </aside>
1662
+ message ConversionSpec {
1663
+ // Attribution model to use in the Conversion Report
1664
+ enum AttributionModel {
1665
+ // Unspecified attribution model.
1666
+ ATTRIBUTION_MODEL_UNSPECIFIED = 0;
1667
+
1668
+ // Attribution was based on the paid and organic data driven model
1669
+ DATA_DRIVEN = 1;
1670
+
1671
+ // Attribution was based on the paid and organic last click model
1672
+ LAST_CLICK = 2;
1673
+ }
1674
+
1675
+ // The conversion action IDs to include in the report. If empty, all
1676
+ // conversions are included. Valid conversion action IDs can be retrieved from
1677
+ // the `conversion_action` field within the `conversions` list in the
1678
+ // response of the `GetMetadata` method. For example,
1679
+ // 'conversionActions/1234'.
1680
+ repeated string conversion_actions = 1;
1681
+
1682
+ // The attribution model to use in the Conversion Report. If unspecified,
1683
+ // `DATA_DRIVEN` is used.
1684
+ AttributionModel attribution_model = 2;
1685
+ }
1686
+
1687
+ // Explains a dimension.
1688
+ message DimensionMetadata {
1689
+ // This dimension's name. Usable in [Dimension](#Dimension)'s `name`. For
1690
+ // example, `eventName`.
1691
+ string api_name = 1;
1692
+
1693
+ // This dimension's name within the Google Analytics user interface. For
1694
+ // example, `Event name`.
1695
+ string ui_name = 2;
1696
+
1697
+ // Description of how this dimension is used and calculated.
1698
+ string description = 3;
1699
+
1700
+ // Still usable but deprecated names for this dimension. If populated, this
1701
+ // dimension is available by either `apiName` or one of `deprecatedApiNames`
1702
+ // for a period of time. After the deprecation period, the dimension will be
1703
+ // available only by `apiName`.
1704
+ repeated string deprecated_api_names = 4;
1705
+
1706
+ // True if the dimension is custom to this property. This includes user,
1707
+ // event, & item scoped custom dimensions; to learn more about custom
1708
+ // dimensions, see https://support.google.com/analytics/answer/14240153. This
1709
+ // also include custom channel groups; to learn more about custom channel
1710
+ // groups, see https://support.google.com/analytics/answer/13051316.
1711
+ bool custom_definition = 5;
1712
+
1713
+ // The display name of the category that this dimension belongs to. Similar
1714
+ // dimensions and metrics are categorized together.
1715
+ string category = 6;
1716
+
1717
+ // Specifies the Google Analytics sections this dimension applies to.
1718
+ repeated Section sections = 7;
1719
+ }
1720
+
1721
+ // Explains a metric.
1722
+ message MetricMetadata {
1723
+ // Justifications for why this metric is blocked.
1724
+ enum BlockedReason {
1725
+ // Will never be specified in API response.
1726
+ BLOCKED_REASON_UNSPECIFIED = 0;
1727
+
1728
+ // If present, your access is blocked to revenue related metrics for this
1729
+ // property, and this metric is revenue related.
1730
+ NO_REVENUE_METRICS = 1;
1731
+
1732
+ // If present, your access is blocked to cost related metrics for this
1733
+ // property, and this metric is cost related.
1734
+ NO_COST_METRICS = 2;
1735
+ }
1736
+
1737
+ // A metric name. Usable in [Metric](#Metric)'s `name`. For example,
1738
+ // `eventCount`.
1739
+ string api_name = 1;
1740
+
1741
+ // This metric's name within the Google Analytics user interface. For example,
1742
+ // `Event count`.
1743
+ string ui_name = 2;
1744
+
1745
+ // Description of how this metric is used and calculated.
1746
+ string description = 3;
1747
+
1748
+ // Still usable but deprecated names for this metric. If populated, this
1749
+ // metric is available by either `apiName` or one of `deprecatedApiNames`
1750
+ // for a period of time. After the deprecation period, the metric will be
1751
+ // available only by `apiName`.
1752
+ repeated string deprecated_api_names = 4;
1753
+
1754
+ // The type of this metric.
1755
+ MetricType type = 5;
1756
+
1757
+ // The mathematical expression for this derived metric. Can be used in
1758
+ // [Metric](#Metric)'s `expression` field for equivalent reports. Most metrics
1759
+ // are not expressions, and for non-expressions, this field is empty.
1760
+ string expression = 6;
1761
+
1762
+ // True if the metric is a custom metric for this property.
1763
+ bool custom_definition = 7;
1764
+
1765
+ // If reasons are specified, your access is blocked to this metric for this
1766
+ // property. API requests from you to this property for this metric will
1767
+ // succeed; however, the report will contain only zeros for this metric. API
1768
+ // requests with metric filters on blocked metrics will fail. If reasons are
1769
+ // empty, you have access to this metric.
1770
+ //
1771
+ // To learn more, see [Access and data-restriction
1772
+ // management](https://support.google.com/analytics/answer/10851388).
1773
+ repeated BlockedReason blocked_reasons = 8;
1774
+
1775
+ // The display name of the category that this metrics belongs to. Similar
1776
+ // dimensions and metrics are categorized together.
1777
+ string category = 9;
1778
+
1779
+ // Specifies the Google Analytics sections this metric applies to.
1780
+ repeated Section sections = 10;
1781
+ }
1782
+
1783
+ // The metadata for a single comparison.
1784
+ message ComparisonMetadata {
1785
+ // This comparison's resource name. Usable in [Comparison](#Comparison)'s
1786
+ // `comparison` field. For example, 'comparisons/1234'.
1787
+ string api_name = 1;
1788
+
1789
+ // This comparison's name within the Google Analytics user interface.
1790
+ string ui_name = 2;
1791
+
1792
+ // This comparison's description.
1793
+ string description = 3;
1794
+ }
1795
+
1796
+ // The metadata for a single conversion.
1797
+ //
1798
+ // <aside class="caution">
1799
+ // This feature may not be available to your Google Analytics property. The
1800
+ // Google Analytics team is actively working to expand this feature to more
1801
+ // properties. Please reach out to your
1802
+ // <a href="https://support.google.com/analytics/gethelp">support team</a> if
1803
+ // you have questions about the eligibility of your property.
1804
+ // </aside>
1805
+ message ConversionMetadata {
1806
+ // The unique identifier of the conversion action. This ID is used to specify
1807
+ // which conversions to include in a report by populating the
1808
+ // `conversion_actions` field in the `ConversionsSpec` of a report request.
1809
+ // For example, 'conversionActions/1234'.
1810
+ string conversion_action = 1;
1811
+
1812
+ // This conversion's name within the Google Analytics user interface.
1813
+ string display_name = 2;
1814
+ }