google-analytics-data-v1beta 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +201 -0
- data/README.md +139 -0
- data/lib/google-analytics-data-v1beta.rb +21 -0
- data/lib/google/analytics/data/v1beta.rb +38 -0
- data/lib/google/analytics/data/v1beta/analytics_data.rb +49 -0
- data/lib/google/analytics/data/v1beta/analytics_data/client.rb +957 -0
- data/lib/google/analytics/data/v1beta/analytics_data/credentials.rb +52 -0
- data/lib/google/analytics/data/v1beta/analytics_data/paths.rb +47 -0
- data/lib/google/analytics/data/v1beta/analytics_data_api_pb.rb +132 -0
- data/lib/google/analytics/data/v1beta/analytics_data_api_services_pb.rb +78 -0
- data/lib/google/analytics/data/v1beta/data_pb.rb +288 -0
- data/lib/google/analytics/data/v1beta/version.rb +28 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/analytics/data/v1beta/analytics_data_api.rb +492 -0
- data/proto_docs/google/analytics/data/v1beta/data.rb +890 -0
- data/proto_docs/google/api/field_behavior.rb +65 -0
- data/proto_docs/google/api/resource.rb +283 -0
- metadata +211 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
# This gem does not autoload during Bundler.require. To load this gem,
|
20
|
+
# issue explicit require statements for the packages desired, e.g.:
|
21
|
+
# require "google/analytics/data/v1beta"
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/analytics/data/v1beta/analytics_data"
|
20
|
+
require "google/analytics/data/v1beta/version"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Analytics
|
24
|
+
module Data
|
25
|
+
##
|
26
|
+
# To load this package, including all its services, and instantiate a client:
|
27
|
+
#
|
28
|
+
# require "google/analytics/data/v1beta"
|
29
|
+
# client = ::Google::Analytics::Data::V1beta::AnalyticsData::Client.new
|
30
|
+
#
|
31
|
+
module V1beta
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
helper_path = ::File.join __dir__, "v1beta", "_helpers.rb"
|
38
|
+
require "google/analytics/data/v1beta/_helpers" if ::File.file? helper_path
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "gapic/common"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/analytics/data/v1beta/version"
|
24
|
+
|
25
|
+
require "google/analytics/data/v1beta/analytics_data/credentials"
|
26
|
+
require "google/analytics/data/v1beta/analytics_data/paths"
|
27
|
+
require "google/analytics/data/v1beta/analytics_data/client"
|
28
|
+
|
29
|
+
module Google
|
30
|
+
module Analytics
|
31
|
+
module Data
|
32
|
+
module V1beta
|
33
|
+
##
|
34
|
+
# Google Analytics reporting data service.
|
35
|
+
#
|
36
|
+
# To load this service and instantiate a client:
|
37
|
+
#
|
38
|
+
# require "google/analytics/data/v1beta/analytics_data"
|
39
|
+
# client = ::Google::Analytics::Data::V1beta::AnalyticsData::Client.new
|
40
|
+
#
|
41
|
+
module AnalyticsData
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
helper_path = ::File.join __dir__, "analytics_data", "helpers.rb"
|
49
|
+
require "google/analytics/data/v1beta/analytics_data/helpers" if ::File.file? helper_path
|
@@ -0,0 +1,957 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/analytics/data/v1beta/analytics_data_api_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Analytics
|
24
|
+
module Data
|
25
|
+
module V1beta
|
26
|
+
module AnalyticsData
|
27
|
+
##
|
28
|
+
# Client for the AnalyticsData service.
|
29
|
+
#
|
30
|
+
# Google Analytics reporting data service.
|
31
|
+
#
|
32
|
+
class Client
|
33
|
+
include Paths
|
34
|
+
|
35
|
+
# @private
|
36
|
+
attr_reader :analytics_data_stub
|
37
|
+
|
38
|
+
##
|
39
|
+
# Configure the AnalyticsData Client class.
|
40
|
+
#
|
41
|
+
# See {::Google::Analytics::Data::V1beta::AnalyticsData::Client::Configuration}
|
42
|
+
# for a description of the configuration fields.
|
43
|
+
#
|
44
|
+
# ## Example
|
45
|
+
#
|
46
|
+
# To modify the configuration for all AnalyticsData clients:
|
47
|
+
#
|
48
|
+
# ::Google::Analytics::Data::V1beta::AnalyticsData::Client.configure do |config|
|
49
|
+
# config.timeout = 10.0
|
50
|
+
# end
|
51
|
+
#
|
52
|
+
# @yield [config] Configure the Client client.
|
53
|
+
# @yieldparam config [Client::Configuration]
|
54
|
+
#
|
55
|
+
# @return [Client::Configuration]
|
56
|
+
#
|
57
|
+
def self.configure
|
58
|
+
@configure ||= begin
|
59
|
+
namespace = ["Google", "Analytics", "Data", "V1beta"]
|
60
|
+
parent_config = while namespace.any?
|
61
|
+
parent_name = namespace.join "::"
|
62
|
+
parent_const = const_get parent_name
|
63
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
64
|
+
namespace.pop
|
65
|
+
end
|
66
|
+
default_config = Client::Configuration.new parent_config
|
67
|
+
|
68
|
+
default_config.timeout = 60.0
|
69
|
+
default_config.retry_policy = {
|
70
|
+
initial_delay: 1.0,
|
71
|
+
max_delay: 60.0,
|
72
|
+
multiplier: 1.3,
|
73
|
+
retry_codes: [2]
|
74
|
+
}
|
75
|
+
|
76
|
+
default_config.rpcs.run_report.timeout = 60.0
|
77
|
+
|
78
|
+
default_config.rpcs.run_pivot_report.timeout = 60.0
|
79
|
+
|
80
|
+
default_config.rpcs.batch_run_reports.timeout = 60.0
|
81
|
+
|
82
|
+
default_config.rpcs.batch_run_pivot_reports.timeout = 60.0
|
83
|
+
|
84
|
+
default_config.rpcs.run_realtime_report.timeout = 60.0
|
85
|
+
|
86
|
+
default_config
|
87
|
+
end
|
88
|
+
yield @configure if block_given?
|
89
|
+
@configure
|
90
|
+
end
|
91
|
+
|
92
|
+
##
|
93
|
+
# Configure the AnalyticsData Client instance.
|
94
|
+
#
|
95
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
96
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
97
|
+
# should be made on {Client.configure}.
|
98
|
+
#
|
99
|
+
# See {::Google::Analytics::Data::V1beta::AnalyticsData::Client::Configuration}
|
100
|
+
# for a description of the configuration fields.
|
101
|
+
#
|
102
|
+
# @yield [config] Configure the Client client.
|
103
|
+
# @yieldparam config [Client::Configuration]
|
104
|
+
#
|
105
|
+
# @return [Client::Configuration]
|
106
|
+
#
|
107
|
+
def configure
|
108
|
+
yield @config if block_given?
|
109
|
+
@config
|
110
|
+
end
|
111
|
+
|
112
|
+
##
|
113
|
+
# Create a new AnalyticsData client object.
|
114
|
+
#
|
115
|
+
# ## Examples
|
116
|
+
#
|
117
|
+
# To create a new AnalyticsData client with the default
|
118
|
+
# configuration:
|
119
|
+
#
|
120
|
+
# client = ::Google::Analytics::Data::V1beta::AnalyticsData::Client.new
|
121
|
+
#
|
122
|
+
# To create a new AnalyticsData client with a custom
|
123
|
+
# configuration:
|
124
|
+
#
|
125
|
+
# client = ::Google::Analytics::Data::V1beta::AnalyticsData::Client.new do |config|
|
126
|
+
# config.timeout = 10.0
|
127
|
+
# end
|
128
|
+
#
|
129
|
+
# @yield [config] Configure the AnalyticsData client.
|
130
|
+
# @yieldparam config [Client::Configuration]
|
131
|
+
#
|
132
|
+
def initialize
|
133
|
+
# These require statements are intentionally placed here to initialize
|
134
|
+
# the gRPC module only when it's required.
|
135
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
136
|
+
require "gapic/grpc"
|
137
|
+
require "google/analytics/data/v1beta/analytics_data_api_services_pb"
|
138
|
+
|
139
|
+
# Create the configuration object
|
140
|
+
@config = Configuration.new Client.configure
|
141
|
+
|
142
|
+
# Yield the configuration if needed
|
143
|
+
yield @config if block_given?
|
144
|
+
|
145
|
+
# Create credentials
|
146
|
+
credentials = @config.credentials
|
147
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
148
|
+
# but only if the default endpoint does not have a region prefix.
|
149
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
150
|
+
@config.endpoint == Client.configure.endpoint &&
|
151
|
+
!@config.endpoint.split(".").first.include?("-")
|
152
|
+
credentials ||= Credentials.default scope: @config.scope,
|
153
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
154
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
155
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
156
|
+
end
|
157
|
+
@quota_project_id = @config.quota_project
|
158
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
159
|
+
|
160
|
+
@analytics_data_stub = ::Gapic::ServiceStub.new(
|
161
|
+
::Google::Analytics::Data::V1beta::BetaAnalyticsData::Stub,
|
162
|
+
credentials: credentials,
|
163
|
+
endpoint: @config.endpoint,
|
164
|
+
channel_args: @config.channel_args,
|
165
|
+
interceptors: @config.interceptors
|
166
|
+
)
|
167
|
+
end
|
168
|
+
|
169
|
+
# Service calls
|
170
|
+
|
171
|
+
##
|
172
|
+
# Returns a customized report of your Google Analytics event data. Reports
|
173
|
+
# contain statistics derived from data collected by the Google Analytics
|
174
|
+
# tracking code. The data returned from the API is as a table with columns
|
175
|
+
# for the requested dimensions and metrics. Metrics are individual
|
176
|
+
# measurements of user activity on your property, such as active users or
|
177
|
+
# event count. Dimensions break down metrics across some common criteria,
|
178
|
+
# such as country or event name.
|
179
|
+
#
|
180
|
+
# @overload run_report(request, options = nil)
|
181
|
+
# Pass arguments to `run_report` via a request object, either of type
|
182
|
+
# {::Google::Analytics::Data::V1beta::RunReportRequest} or an equivalent Hash.
|
183
|
+
#
|
184
|
+
# @param request [::Google::Analytics::Data::V1beta::RunReportRequest, ::Hash]
|
185
|
+
# A request object representing the call parameters. Required. To specify no
|
186
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
187
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
188
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
189
|
+
#
|
190
|
+
# @overload run_report(property: nil, dimensions: nil, metrics: nil, date_ranges: nil, dimension_filter: nil, metric_filter: nil, offset: nil, limit: nil, metric_aggregations: nil, order_bys: nil, currency_code: nil, cohort_spec: nil, keep_empty_rows: nil, return_property_quota: nil)
|
191
|
+
# Pass arguments to `run_report` via keyword arguments. Note that at
|
192
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
193
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
194
|
+
#
|
195
|
+
# @param property [::String]
|
196
|
+
# A Google Analytics GA4 property identifier whose events are tracked.
|
197
|
+
# Specified in the URL path and not the body. To learn more, see [where to
|
198
|
+
# find your Property
|
199
|
+
# ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
|
200
|
+
# Within a batch request, this property should either be unspecified or
|
201
|
+
# consistent with the batch-level property.
|
202
|
+
#
|
203
|
+
# Example: properties/1234
|
204
|
+
# @param dimensions [::Array<::Google::Analytics::Data::V1beta::Dimension, ::Hash>]
|
205
|
+
# The dimensions requested and displayed.
|
206
|
+
# @param metrics [::Array<::Google::Analytics::Data::V1beta::Metric, ::Hash>]
|
207
|
+
# The metrics requested and displayed.
|
208
|
+
# @param date_ranges [::Array<::Google::Analytics::Data::V1beta::DateRange, ::Hash>]
|
209
|
+
# Date ranges of data to read. If multiple date ranges are requested, each
|
210
|
+
# response row will contain a zero based date range index. If two date
|
211
|
+
# ranges overlap, the event data for the overlapping days is included in the
|
212
|
+
# response rows for both date ranges. In a cohort request, this `dateRanges`
|
213
|
+
# must be unspecified.
|
214
|
+
# @param dimension_filter [::Google::Analytics::Data::V1beta::FilterExpression, ::Hash]
|
215
|
+
# The filter clause of dimensions. Dimensions must be requested to be used in
|
216
|
+
# this filter. Metrics cannot be used in this filter.
|
217
|
+
# @param metric_filter [::Google::Analytics::Data::V1beta::FilterExpression, ::Hash]
|
218
|
+
# The filter clause of metrics. Applied at post aggregation phase, similar to
|
219
|
+
# SQL having-clause. Metrics must be requested to be used in this filter.
|
220
|
+
# Dimensions cannot be used in this filter.
|
221
|
+
# @param offset [::Integer]
|
222
|
+
# The row count of the start row. The first row is counted as row 0.
|
223
|
+
#
|
224
|
+
# When paging, the first request does not specify offset; or equivalently,
|
225
|
+
# sets offset to 0; the first request returns the first `limit` of rows. The
|
226
|
+
# second request sets offset to the `limit` of the first request; the second
|
227
|
+
# request returns the second `limit` of rows.
|
228
|
+
#
|
229
|
+
# To learn more about this pagination parameter, see
|
230
|
+
# [Pagination](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
|
231
|
+
# @param limit [::Integer]
|
232
|
+
# The number of rows to return. If unspecified, 10,000 rows are returned. The
|
233
|
+
# API returns a maximum of 100,000 rows per request, no matter how many you
|
234
|
+
# ask for. `limit` must be positive.
|
235
|
+
#
|
236
|
+
# The API can also return fewer rows than the requested `limit`, if there
|
237
|
+
# aren't as many dimension values as the `limit`. For instance, there are
|
238
|
+
# fewer than 300 possible values for the dimension `country`, so when
|
239
|
+
# reporting on only `country`, you can't get more than 300 rows, even if you
|
240
|
+
# set `limit` to a higher value.
|
241
|
+
#
|
242
|
+
# To learn more about this pagination parameter, see
|
243
|
+
# [Pagination](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
|
244
|
+
# @param metric_aggregations [::Array<::Google::Analytics::Data::V1beta::MetricAggregation>]
|
245
|
+
# Aggregation of metrics. Aggregated metric values will be shown in rows
|
246
|
+
# where the dimension_values are set to "RESERVED_(MetricAggregation)".
|
247
|
+
# @param order_bys [::Array<::Google::Analytics::Data::V1beta::OrderBy, ::Hash>]
|
248
|
+
# Specifies how rows are ordered in the response.
|
249
|
+
# @param currency_code [::String]
|
250
|
+
# A currency code in ISO4217 format, such as "AED", "USD", "JPY".
|
251
|
+
# If the field is empty, the report uses the property's default currency.
|
252
|
+
# @param cohort_spec [::Google::Analytics::Data::V1beta::CohortSpec, ::Hash]
|
253
|
+
# Cohort group associated with this request. If there is a cohort group
|
254
|
+
# in the request the 'cohort' dimension must be present.
|
255
|
+
# @param keep_empty_rows [::Boolean]
|
256
|
+
# If false or unspecified, each row with all metrics equal to 0 will not be
|
257
|
+
# returned. If true, these rows will be returned if they are not separately
|
258
|
+
# removed by a filter.
|
259
|
+
# @param return_property_quota [::Boolean]
|
260
|
+
# Toggles whether to return the current state of this Analytics Property's
|
261
|
+
# quota. Quota is returned in [PropertyQuota](#PropertyQuota).
|
262
|
+
#
|
263
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
264
|
+
# @yieldparam response [::Google::Analytics::Data::V1beta::RunReportResponse]
|
265
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
266
|
+
#
|
267
|
+
# @return [::Google::Analytics::Data::V1beta::RunReportResponse]
|
268
|
+
#
|
269
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
270
|
+
#
|
271
|
+
def run_report request, options = nil
|
272
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
273
|
+
|
274
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1beta::RunReportRequest
|
275
|
+
|
276
|
+
# Converts hash and nil to an options object
|
277
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
278
|
+
|
279
|
+
# Customize the options with defaults
|
280
|
+
metadata = @config.rpcs.run_report.metadata.to_h
|
281
|
+
|
282
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
283
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
284
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
285
|
+
gapic_version: ::Google::Analytics::Data::V1beta::VERSION
|
286
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
287
|
+
|
288
|
+
header_params = {
|
289
|
+
"property" => request.property
|
290
|
+
}
|
291
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
292
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
293
|
+
|
294
|
+
options.apply_defaults timeout: @config.rpcs.run_report.timeout,
|
295
|
+
metadata: metadata,
|
296
|
+
retry_policy: @config.rpcs.run_report.retry_policy
|
297
|
+
options.apply_defaults metadata: @config.metadata,
|
298
|
+
retry_policy: @config.retry_policy
|
299
|
+
|
300
|
+
@analytics_data_stub.call_rpc :run_report, request, options: options do |response, operation|
|
301
|
+
yield response, operation if block_given?
|
302
|
+
return response
|
303
|
+
end
|
304
|
+
rescue ::GRPC::BadStatus => e
|
305
|
+
raise ::Google::Cloud::Error.from_error(e)
|
306
|
+
end
|
307
|
+
|
308
|
+
##
|
309
|
+
# Returns a customized pivot report of your Google Analytics event data.
|
310
|
+
# Pivot reports are more advanced and expressive formats than regular
|
311
|
+
# reports. In a pivot report, dimensions are only visible if they are
|
312
|
+
# included in a pivot. Multiple pivots can be specified to further dissect
|
313
|
+
# your data.
|
314
|
+
#
|
315
|
+
# @overload run_pivot_report(request, options = nil)
|
316
|
+
# Pass arguments to `run_pivot_report` via a request object, either of type
|
317
|
+
# {::Google::Analytics::Data::V1beta::RunPivotReportRequest} or an equivalent Hash.
|
318
|
+
#
|
319
|
+
# @param request [::Google::Analytics::Data::V1beta::RunPivotReportRequest, ::Hash]
|
320
|
+
# A request object representing the call parameters. Required. To specify no
|
321
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
322
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
323
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
324
|
+
#
|
325
|
+
# @overload run_pivot_report(property: nil, dimensions: nil, metrics: nil, date_ranges: nil, pivots: nil, dimension_filter: nil, metric_filter: nil, currency_code: nil, cohort_spec: nil, keep_empty_rows: nil, return_property_quota: nil)
|
326
|
+
# Pass arguments to `run_pivot_report` via keyword arguments. Note that at
|
327
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
328
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
329
|
+
#
|
330
|
+
# @param property [::String]
|
331
|
+
# A Google Analytics GA4 property identifier whose events are tracked.
|
332
|
+
# Specified in the URL path and not the body. To learn more, see [where to
|
333
|
+
# find your Property
|
334
|
+
# ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
|
335
|
+
# Within a batch request, this property should either be unspecified or
|
336
|
+
# consistent with the batch-level property.
|
337
|
+
#
|
338
|
+
# Example: properties/1234
|
339
|
+
# @param dimensions [::Array<::Google::Analytics::Data::V1beta::Dimension, ::Hash>]
|
340
|
+
# The dimensions requested. All defined dimensions must be used by one of the
|
341
|
+
# following: dimension_expression, dimension_filter, pivots, order_bys.
|
342
|
+
# @param metrics [::Array<::Google::Analytics::Data::V1beta::Metric, ::Hash>]
|
343
|
+
# The metrics requested, at least one metric needs to be specified. All
|
344
|
+
# defined metrics must be used by one of the following: metric_expression,
|
345
|
+
# metric_filter, order_bys.
|
346
|
+
# @param date_ranges [::Array<::Google::Analytics::Data::V1beta::DateRange, ::Hash>]
|
347
|
+
# The date range to retrieve event data for the report. If multiple date
|
348
|
+
# ranges are specified, event data from each date range is used in the
|
349
|
+
# report. A special dimension with field name "dateRange" can be included in
|
350
|
+
# a Pivot's field names; if included, the report compares between date
|
351
|
+
# ranges. In a cohort request, this `dateRanges` must be unspecified.
|
352
|
+
# @param pivots [::Array<::Google::Analytics::Data::V1beta::Pivot, ::Hash>]
|
353
|
+
# Describes the visual format of the report's dimensions in columns or rows.
|
354
|
+
# The union of the fieldNames (dimension names) in all pivots must be a
|
355
|
+
# subset of dimension names defined in Dimensions. No two pivots can share a
|
356
|
+
# dimension. A dimension is only visible if it appears in a pivot.
|
357
|
+
# @param dimension_filter [::Google::Analytics::Data::V1beta::FilterExpression, ::Hash]
|
358
|
+
# The filter clause of dimensions. Dimensions must be requested to be used in
|
359
|
+
# this filter. Metrics cannot be used in this filter.
|
360
|
+
# @param metric_filter [::Google::Analytics::Data::V1beta::FilterExpression, ::Hash]
|
361
|
+
# The filter clause of metrics. Applied at post aggregation phase, similar to
|
362
|
+
# SQL having-clause. Metrics must be requested to be used in this filter.
|
363
|
+
# Dimensions cannot be used in this filter.
|
364
|
+
# @param currency_code [::String]
|
365
|
+
# A currency code in ISO4217 format, such as "AED", "USD", "JPY".
|
366
|
+
# If the field is empty, the report uses the property's default currency.
|
367
|
+
# @param cohort_spec [::Google::Analytics::Data::V1beta::CohortSpec, ::Hash]
|
368
|
+
# Cohort group associated with this request. If there is a cohort group
|
369
|
+
# in the request the 'cohort' dimension must be present.
|
370
|
+
# @param keep_empty_rows [::Boolean]
|
371
|
+
# If false or unspecified, each row with all metrics equal to 0 will not be
|
372
|
+
# returned. If true, these rows will be returned if they are not separately
|
373
|
+
# removed by a filter.
|
374
|
+
# @param return_property_quota [::Boolean]
|
375
|
+
# Toggles whether to return the current state of this Analytics Property's
|
376
|
+
# quota. Quota is returned in [PropertyQuota](#PropertyQuota).
|
377
|
+
#
|
378
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
379
|
+
# @yieldparam response [::Google::Analytics::Data::V1beta::RunPivotReportResponse]
|
380
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
381
|
+
#
|
382
|
+
# @return [::Google::Analytics::Data::V1beta::RunPivotReportResponse]
|
383
|
+
#
|
384
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
385
|
+
#
|
386
|
+
def run_pivot_report request, options = nil
|
387
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
388
|
+
|
389
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1beta::RunPivotReportRequest
|
390
|
+
|
391
|
+
# Converts hash and nil to an options object
|
392
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
393
|
+
|
394
|
+
# Customize the options with defaults
|
395
|
+
metadata = @config.rpcs.run_pivot_report.metadata.to_h
|
396
|
+
|
397
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
398
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
399
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
400
|
+
gapic_version: ::Google::Analytics::Data::V1beta::VERSION
|
401
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
402
|
+
|
403
|
+
header_params = {
|
404
|
+
"property" => request.property
|
405
|
+
}
|
406
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
407
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
408
|
+
|
409
|
+
options.apply_defaults timeout: @config.rpcs.run_pivot_report.timeout,
|
410
|
+
metadata: metadata,
|
411
|
+
retry_policy: @config.rpcs.run_pivot_report.retry_policy
|
412
|
+
options.apply_defaults metadata: @config.metadata,
|
413
|
+
retry_policy: @config.retry_policy
|
414
|
+
|
415
|
+
@analytics_data_stub.call_rpc :run_pivot_report, request, options: options do |response, operation|
|
416
|
+
yield response, operation if block_given?
|
417
|
+
return response
|
418
|
+
end
|
419
|
+
rescue ::GRPC::BadStatus => e
|
420
|
+
raise ::Google::Cloud::Error.from_error(e)
|
421
|
+
end
|
422
|
+
|
423
|
+
##
|
424
|
+
# Returns multiple reports in a batch. All reports must be for the same
|
425
|
+
# GA4 Property.
|
426
|
+
#
|
427
|
+
# @overload batch_run_reports(request, options = nil)
|
428
|
+
# Pass arguments to `batch_run_reports` via a request object, either of type
|
429
|
+
# {::Google::Analytics::Data::V1beta::BatchRunReportsRequest} or an equivalent Hash.
|
430
|
+
#
|
431
|
+
# @param request [::Google::Analytics::Data::V1beta::BatchRunReportsRequest, ::Hash]
|
432
|
+
# A request object representing the call parameters. Required. To specify no
|
433
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
434
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
435
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
436
|
+
#
|
437
|
+
# @overload batch_run_reports(property: nil, requests: nil)
|
438
|
+
# Pass arguments to `batch_run_reports` via keyword arguments. Note that at
|
439
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
440
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
441
|
+
#
|
442
|
+
# @param property [::String]
|
443
|
+
# A Google Analytics GA4 property identifier whose events are tracked.
|
444
|
+
# Specified in the URL path and not the body. To learn more, see [where to
|
445
|
+
# find your Property
|
446
|
+
# ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
|
447
|
+
# This property must be specified for the batch. The property within
|
448
|
+
# RunReportRequest may either be unspecified or consistent with this
|
449
|
+
# property.
|
450
|
+
#
|
451
|
+
# Example: properties/1234
|
452
|
+
# @param requests [::Array<::Google::Analytics::Data::V1beta::RunReportRequest, ::Hash>]
|
453
|
+
# Individual requests. Each request has a separate report response. Each
|
454
|
+
# batch request is allowed up to 5 requests.
|
455
|
+
#
|
456
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
457
|
+
# @yieldparam response [::Google::Analytics::Data::V1beta::BatchRunReportsResponse]
|
458
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
459
|
+
#
|
460
|
+
# @return [::Google::Analytics::Data::V1beta::BatchRunReportsResponse]
|
461
|
+
#
|
462
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
463
|
+
#
|
464
|
+
def batch_run_reports request, options = nil
|
465
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
466
|
+
|
467
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1beta::BatchRunReportsRequest
|
468
|
+
|
469
|
+
# Converts hash and nil to an options object
|
470
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
471
|
+
|
472
|
+
# Customize the options with defaults
|
473
|
+
metadata = @config.rpcs.batch_run_reports.metadata.to_h
|
474
|
+
|
475
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
476
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
477
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
478
|
+
gapic_version: ::Google::Analytics::Data::V1beta::VERSION
|
479
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
480
|
+
|
481
|
+
header_params = {
|
482
|
+
"property" => request.property
|
483
|
+
}
|
484
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
485
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
486
|
+
|
487
|
+
options.apply_defaults timeout: @config.rpcs.batch_run_reports.timeout,
|
488
|
+
metadata: metadata,
|
489
|
+
retry_policy: @config.rpcs.batch_run_reports.retry_policy
|
490
|
+
options.apply_defaults metadata: @config.metadata,
|
491
|
+
retry_policy: @config.retry_policy
|
492
|
+
|
493
|
+
@analytics_data_stub.call_rpc :batch_run_reports, request, options: options do |response, operation|
|
494
|
+
yield response, operation if block_given?
|
495
|
+
return response
|
496
|
+
end
|
497
|
+
rescue ::GRPC::BadStatus => e
|
498
|
+
raise ::Google::Cloud::Error.from_error(e)
|
499
|
+
end
|
500
|
+
|
501
|
+
##
|
502
|
+
# Returns multiple pivot reports in a batch. All reports must be for the same
|
503
|
+
# GA4 Property.
|
504
|
+
#
|
505
|
+
# @overload batch_run_pivot_reports(request, options = nil)
|
506
|
+
# Pass arguments to `batch_run_pivot_reports` via a request object, either of type
|
507
|
+
# {::Google::Analytics::Data::V1beta::BatchRunPivotReportsRequest} or an equivalent Hash.
|
508
|
+
#
|
509
|
+
# @param request [::Google::Analytics::Data::V1beta::BatchRunPivotReportsRequest, ::Hash]
|
510
|
+
# A request object representing the call parameters. Required. To specify no
|
511
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
512
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
513
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
514
|
+
#
|
515
|
+
# @overload batch_run_pivot_reports(property: nil, requests: nil)
|
516
|
+
# Pass arguments to `batch_run_pivot_reports` via keyword arguments. Note that at
|
517
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
518
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
519
|
+
#
|
520
|
+
# @param property [::String]
|
521
|
+
# A Google Analytics GA4 property identifier whose events are tracked.
|
522
|
+
# Specified in the URL path and not the body. To learn more, see [where to
|
523
|
+
# find your Property
|
524
|
+
# ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
|
525
|
+
# This property must be specified for the batch. The property within
|
526
|
+
# RunPivotReportRequest may either be unspecified or consistent with this
|
527
|
+
# property.
|
528
|
+
#
|
529
|
+
# Example: properties/1234
|
530
|
+
# @param requests [::Array<::Google::Analytics::Data::V1beta::RunPivotReportRequest, ::Hash>]
|
531
|
+
# Individual requests. Each request has a separate pivot report response.
|
532
|
+
# Each batch request is allowed up to 5 requests.
|
533
|
+
#
|
534
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
535
|
+
# @yieldparam response [::Google::Analytics::Data::V1beta::BatchRunPivotReportsResponse]
|
536
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
537
|
+
#
|
538
|
+
# @return [::Google::Analytics::Data::V1beta::BatchRunPivotReportsResponse]
|
539
|
+
#
|
540
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
541
|
+
#
|
542
|
+
def batch_run_pivot_reports request, options = nil
|
543
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
544
|
+
|
545
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1beta::BatchRunPivotReportsRequest
|
546
|
+
|
547
|
+
# Converts hash and nil to an options object
|
548
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
549
|
+
|
550
|
+
# Customize the options with defaults
|
551
|
+
metadata = @config.rpcs.batch_run_pivot_reports.metadata.to_h
|
552
|
+
|
553
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
554
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
555
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
556
|
+
gapic_version: ::Google::Analytics::Data::V1beta::VERSION
|
557
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
558
|
+
|
559
|
+
header_params = {
|
560
|
+
"property" => request.property
|
561
|
+
}
|
562
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
563
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
564
|
+
|
565
|
+
options.apply_defaults timeout: @config.rpcs.batch_run_pivot_reports.timeout,
|
566
|
+
metadata: metadata,
|
567
|
+
retry_policy: @config.rpcs.batch_run_pivot_reports.retry_policy
|
568
|
+
options.apply_defaults metadata: @config.metadata,
|
569
|
+
retry_policy: @config.retry_policy
|
570
|
+
|
571
|
+
@analytics_data_stub.call_rpc :batch_run_pivot_reports, request, options: options do |response, operation|
|
572
|
+
yield response, operation if block_given?
|
573
|
+
return response
|
574
|
+
end
|
575
|
+
rescue ::GRPC::BadStatus => e
|
576
|
+
raise ::Google::Cloud::Error.from_error(e)
|
577
|
+
end
|
578
|
+
|
579
|
+
##
|
580
|
+
# Returns metadata for dimensions and metrics available in reporting methods.
|
581
|
+
# Used to explore the dimensions and metrics. In this method, a Google
|
582
|
+
# Analytics GA4 Property Identifier is specified in the request, and
|
583
|
+
# the metadata response includes Custom dimensions and metrics as well as
|
584
|
+
# Universal metadata.
|
585
|
+
#
|
586
|
+
# For example if a custom metric with parameter name `levels_unlocked` is
|
587
|
+
# registered to a property, the Metadata response will contain
|
588
|
+
# `customEvent:levels_unlocked`. Universal metadata are dimensions and
|
589
|
+
# metrics applicable to any property such as `country` and `totalUsers`.
|
590
|
+
#
|
591
|
+
# @overload get_metadata(request, options = nil)
|
592
|
+
# Pass arguments to `get_metadata` via a request object, either of type
|
593
|
+
# {::Google::Analytics::Data::V1beta::GetMetadataRequest} or an equivalent Hash.
|
594
|
+
#
|
595
|
+
# @param request [::Google::Analytics::Data::V1beta::GetMetadataRequest, ::Hash]
|
596
|
+
# A request object representing the call parameters. Required. To specify no
|
597
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
598
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
599
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
600
|
+
#
|
601
|
+
# @overload get_metadata(name: nil)
|
602
|
+
# Pass arguments to `get_metadata` via keyword arguments. Note that at
|
603
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
604
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
605
|
+
#
|
606
|
+
# @param name [::String]
|
607
|
+
# Required. The resource name of the metadata to retrieve. This name field is
|
608
|
+
# specified in the URL path and not URL parameters. Property is a numeric
|
609
|
+
# Google Analytics GA4 Property identifier. To learn more, see [where to find
|
610
|
+
# your Property
|
611
|
+
# ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
|
612
|
+
#
|
613
|
+
# Example: properties/1234/metadata
|
614
|
+
#
|
615
|
+
# Set the Property ID to 0 for dimensions and metrics common to all
|
616
|
+
# properties. In this special mode, this method will not return custom
|
617
|
+
# dimensions and metrics.
|
618
|
+
#
|
619
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
620
|
+
# @yieldparam response [::Google::Analytics::Data::V1beta::Metadata]
|
621
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
622
|
+
#
|
623
|
+
# @return [::Google::Analytics::Data::V1beta::Metadata]
|
624
|
+
#
|
625
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
626
|
+
#
|
627
|
+
def get_metadata request, options = nil
|
628
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
629
|
+
|
630
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1beta::GetMetadataRequest
|
631
|
+
|
632
|
+
# Converts hash and nil to an options object
|
633
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
634
|
+
|
635
|
+
# Customize the options with defaults
|
636
|
+
metadata = @config.rpcs.get_metadata.metadata.to_h
|
637
|
+
|
638
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
639
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
640
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
641
|
+
gapic_version: ::Google::Analytics::Data::V1beta::VERSION
|
642
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
643
|
+
|
644
|
+
header_params = {
|
645
|
+
"name" => request.name
|
646
|
+
}
|
647
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
648
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
649
|
+
|
650
|
+
options.apply_defaults timeout: @config.rpcs.get_metadata.timeout,
|
651
|
+
metadata: metadata,
|
652
|
+
retry_policy: @config.rpcs.get_metadata.retry_policy
|
653
|
+
options.apply_defaults metadata: @config.metadata,
|
654
|
+
retry_policy: @config.retry_policy
|
655
|
+
|
656
|
+
@analytics_data_stub.call_rpc :get_metadata, request, options: options do |response, operation|
|
657
|
+
yield response, operation if block_given?
|
658
|
+
return response
|
659
|
+
end
|
660
|
+
rescue ::GRPC::BadStatus => e
|
661
|
+
raise ::Google::Cloud::Error.from_error(e)
|
662
|
+
end
|
663
|
+
|
664
|
+
##
|
665
|
+
# The Google Analytics Realtime API returns a customized report of realtime
|
666
|
+
# event data for your property. These reports show events and usage from the
|
667
|
+
# last 30 minutes.
|
668
|
+
#
|
669
|
+
# @overload run_realtime_report(request, options = nil)
|
670
|
+
# Pass arguments to `run_realtime_report` via a request object, either of type
|
671
|
+
# {::Google::Analytics::Data::V1beta::RunRealtimeReportRequest} or an equivalent Hash.
|
672
|
+
#
|
673
|
+
# @param request [::Google::Analytics::Data::V1beta::RunRealtimeReportRequest, ::Hash]
|
674
|
+
# A request object representing the call parameters. Required. To specify no
|
675
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
676
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
677
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
678
|
+
#
|
679
|
+
# @overload run_realtime_report(property: nil, dimensions: nil, metrics: nil, dimension_filter: nil, metric_filter: nil, limit: nil, metric_aggregations: nil, order_bys: nil, return_property_quota: nil)
|
680
|
+
# Pass arguments to `run_realtime_report` via keyword arguments. Note that at
|
681
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
682
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
683
|
+
#
|
684
|
+
# @param property [::String]
|
685
|
+
# A Google Analytics GA4 property identifier whose events are tracked.
|
686
|
+
# Specified in the URL path and not the body. To learn more, see [where to
|
687
|
+
# find your Property
|
688
|
+
# ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
|
689
|
+
#
|
690
|
+
# Example: properties/1234
|
691
|
+
# @param dimensions [::Array<::Google::Analytics::Data::V1beta::Dimension, ::Hash>]
|
692
|
+
# The dimensions requested and displayed.
|
693
|
+
# @param metrics [::Array<::Google::Analytics::Data::V1beta::Metric, ::Hash>]
|
694
|
+
# The metrics requested and displayed.
|
695
|
+
# @param dimension_filter [::Google::Analytics::Data::V1beta::FilterExpression, ::Hash]
|
696
|
+
# The filter clause of dimensions. Dimensions must be requested to be used in
|
697
|
+
# this filter. Metrics cannot be used in this filter.
|
698
|
+
# @param metric_filter [::Google::Analytics::Data::V1beta::FilterExpression, ::Hash]
|
699
|
+
# The filter clause of metrics. Applied at post aggregation phase, similar to
|
700
|
+
# SQL having-clause. Metrics must be requested to be used in this filter.
|
701
|
+
# Dimensions cannot be used in this filter.
|
702
|
+
# @param limit [::Integer]
|
703
|
+
# The number of rows to return. If unspecified, 10,000 rows are returned. The
|
704
|
+
# API returns a maximum of 100,000 rows per request, no matter how many you
|
705
|
+
# ask for. `limit` must be positive.
|
706
|
+
#
|
707
|
+
# The API can also return fewer rows than the requested `limit`, if there
|
708
|
+
# aren't as many dimension values as the `limit`. For instance, there are
|
709
|
+
# fewer than 300 possible values for the dimension `country`, so when
|
710
|
+
# reporting on only `country`, you can't get more than 300 rows, even if you
|
711
|
+
# set `limit` to a higher value.
|
712
|
+
# @param metric_aggregations [::Array<::Google::Analytics::Data::V1beta::MetricAggregation>]
|
713
|
+
# Aggregation of metrics. Aggregated metric values will be shown in rows
|
714
|
+
# where the dimension_values are set to "RESERVED_(MetricAggregation)".
|
715
|
+
# @param order_bys [::Array<::Google::Analytics::Data::V1beta::OrderBy, ::Hash>]
|
716
|
+
# Specifies how rows are ordered in the response.
|
717
|
+
# @param return_property_quota [::Boolean]
|
718
|
+
# Toggles whether to return the current state of this Analytics Property's
|
719
|
+
# Realtime quota. Quota is returned in [PropertyQuota](#PropertyQuota).
|
720
|
+
#
|
721
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
722
|
+
# @yieldparam response [::Google::Analytics::Data::V1beta::RunRealtimeReportResponse]
|
723
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
724
|
+
#
|
725
|
+
# @return [::Google::Analytics::Data::V1beta::RunRealtimeReportResponse]
|
726
|
+
#
|
727
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
728
|
+
#
|
729
|
+
def run_realtime_report request, options = nil
|
730
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
731
|
+
|
732
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1beta::RunRealtimeReportRequest
|
733
|
+
|
734
|
+
# Converts hash and nil to an options object
|
735
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
736
|
+
|
737
|
+
# Customize the options with defaults
|
738
|
+
metadata = @config.rpcs.run_realtime_report.metadata.to_h
|
739
|
+
|
740
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
741
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
742
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
743
|
+
gapic_version: ::Google::Analytics::Data::V1beta::VERSION
|
744
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
745
|
+
|
746
|
+
header_params = {
|
747
|
+
"property" => request.property
|
748
|
+
}
|
749
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
750
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
751
|
+
|
752
|
+
options.apply_defaults timeout: @config.rpcs.run_realtime_report.timeout,
|
753
|
+
metadata: metadata,
|
754
|
+
retry_policy: @config.rpcs.run_realtime_report.retry_policy
|
755
|
+
options.apply_defaults metadata: @config.metadata,
|
756
|
+
retry_policy: @config.retry_policy
|
757
|
+
|
758
|
+
@analytics_data_stub.call_rpc :run_realtime_report, request, options: options do |response, operation|
|
759
|
+
yield response, operation if block_given?
|
760
|
+
return response
|
761
|
+
end
|
762
|
+
rescue ::GRPC::BadStatus => e
|
763
|
+
raise ::Google::Cloud::Error.from_error(e)
|
764
|
+
end
|
765
|
+
|
766
|
+
##
|
767
|
+
# Configuration class for the AnalyticsData API.
|
768
|
+
#
|
769
|
+
# This class represents the configuration for AnalyticsData,
|
770
|
+
# providing control over timeouts, retry behavior, logging, transport
|
771
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
772
|
+
# applied individually to specific RPCs. See
|
773
|
+
# {::Google::Analytics::Data::V1beta::AnalyticsData::Client::Configuration::Rpcs}
|
774
|
+
# for a list of RPCs that can be configured independently.
|
775
|
+
#
|
776
|
+
# Configuration can be applied globally to all clients, or to a single client
|
777
|
+
# on construction.
|
778
|
+
#
|
779
|
+
# # Examples
|
780
|
+
#
|
781
|
+
# To modify the global config, setting the timeout for run_report
|
782
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
783
|
+
#
|
784
|
+
# ::Google::Analytics::Data::V1beta::AnalyticsData::Client.configure do |config|
|
785
|
+
# config.timeout = 10.0
|
786
|
+
# config.rpcs.run_report.timeout = 20.0
|
787
|
+
# end
|
788
|
+
#
|
789
|
+
# To apply the above configuration only to a new client:
|
790
|
+
#
|
791
|
+
# client = ::Google::Analytics::Data::V1beta::AnalyticsData::Client.new do |config|
|
792
|
+
# config.timeout = 10.0
|
793
|
+
# config.rpcs.run_report.timeout = 20.0
|
794
|
+
# end
|
795
|
+
#
|
796
|
+
# @!attribute [rw] endpoint
|
797
|
+
# The hostname or hostname:port of the service endpoint.
|
798
|
+
# Defaults to `"analyticsdata.googleapis.com"`.
|
799
|
+
# @return [::String]
|
800
|
+
# @!attribute [rw] credentials
|
801
|
+
# Credentials to send with calls. You may provide any of the following types:
|
802
|
+
# * (`String`) The path to a service account key file in JSON format
|
803
|
+
# * (`Hash`) A service account key as a Hash
|
804
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
805
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
806
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
807
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
808
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
809
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
810
|
+
# * (`nil`) indicating no credentials
|
811
|
+
# @return [::Object]
|
812
|
+
# @!attribute [rw] scope
|
813
|
+
# The OAuth scopes
|
814
|
+
# @return [::Array<::String>]
|
815
|
+
# @!attribute [rw] lib_name
|
816
|
+
# The library name as recorded in instrumentation and logging
|
817
|
+
# @return [::String]
|
818
|
+
# @!attribute [rw] lib_version
|
819
|
+
# The library version as recorded in instrumentation and logging
|
820
|
+
# @return [::String]
|
821
|
+
# @!attribute [rw] channel_args
|
822
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
823
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
824
|
+
# @return [::Hash]
|
825
|
+
# @!attribute [rw] interceptors
|
826
|
+
# An array of interceptors that are run before calls are executed.
|
827
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
828
|
+
# @!attribute [rw] timeout
|
829
|
+
# The call timeout in seconds.
|
830
|
+
# @return [::Numeric]
|
831
|
+
# @!attribute [rw] metadata
|
832
|
+
# Additional gRPC headers to be sent with the call.
|
833
|
+
# @return [::Hash{::Symbol=>::String}]
|
834
|
+
# @!attribute [rw] retry_policy
|
835
|
+
# The retry policy. The value is a hash with the following keys:
|
836
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
837
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
838
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
839
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
840
|
+
# trigger a retry.
|
841
|
+
# @return [::Hash]
|
842
|
+
# @!attribute [rw] quota_project
|
843
|
+
# A separate project against which to charge quota.
|
844
|
+
# @return [::String]
|
845
|
+
#
|
846
|
+
class Configuration
|
847
|
+
extend ::Gapic::Config
|
848
|
+
|
849
|
+
config_attr :endpoint, "analyticsdata.googleapis.com", ::String
|
850
|
+
config_attr :credentials, nil do |value|
|
851
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
852
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
853
|
+
allowed.any? { |klass| klass === value }
|
854
|
+
end
|
855
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
856
|
+
config_attr :lib_name, nil, ::String, nil
|
857
|
+
config_attr :lib_version, nil, ::String, nil
|
858
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
859
|
+
config_attr :interceptors, nil, ::Array, nil
|
860
|
+
config_attr :timeout, nil, ::Numeric, nil
|
861
|
+
config_attr :metadata, nil, ::Hash, nil
|
862
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
863
|
+
config_attr :quota_project, nil, ::String, nil
|
864
|
+
|
865
|
+
# @private
|
866
|
+
def initialize parent_config = nil
|
867
|
+
@parent_config = parent_config unless parent_config.nil?
|
868
|
+
|
869
|
+
yield self if block_given?
|
870
|
+
end
|
871
|
+
|
872
|
+
##
|
873
|
+
# Configurations for individual RPCs
|
874
|
+
# @return [Rpcs]
|
875
|
+
#
|
876
|
+
def rpcs
|
877
|
+
@rpcs ||= begin
|
878
|
+
parent_rpcs = nil
|
879
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
880
|
+
Rpcs.new parent_rpcs
|
881
|
+
end
|
882
|
+
end
|
883
|
+
|
884
|
+
##
|
885
|
+
# Configuration RPC class for the AnalyticsData API.
|
886
|
+
#
|
887
|
+
# Includes fields providing the configuration for each RPC in this service.
|
888
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
889
|
+
# the following configuration fields:
|
890
|
+
#
|
891
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
892
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
893
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
894
|
+
# include the following keys:
|
895
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
896
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
897
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
898
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
899
|
+
# trigger a retry.
|
900
|
+
#
|
901
|
+
class Rpcs
|
902
|
+
##
|
903
|
+
# RPC-specific configuration for `run_report`
|
904
|
+
# @return [::Gapic::Config::Method]
|
905
|
+
#
|
906
|
+
attr_reader :run_report
|
907
|
+
##
|
908
|
+
# RPC-specific configuration for `run_pivot_report`
|
909
|
+
# @return [::Gapic::Config::Method]
|
910
|
+
#
|
911
|
+
attr_reader :run_pivot_report
|
912
|
+
##
|
913
|
+
# RPC-specific configuration for `batch_run_reports`
|
914
|
+
# @return [::Gapic::Config::Method]
|
915
|
+
#
|
916
|
+
attr_reader :batch_run_reports
|
917
|
+
##
|
918
|
+
# RPC-specific configuration for `batch_run_pivot_reports`
|
919
|
+
# @return [::Gapic::Config::Method]
|
920
|
+
#
|
921
|
+
attr_reader :batch_run_pivot_reports
|
922
|
+
##
|
923
|
+
# RPC-specific configuration for `get_metadata`
|
924
|
+
# @return [::Gapic::Config::Method]
|
925
|
+
#
|
926
|
+
attr_reader :get_metadata
|
927
|
+
##
|
928
|
+
# RPC-specific configuration for `run_realtime_report`
|
929
|
+
# @return [::Gapic::Config::Method]
|
930
|
+
#
|
931
|
+
attr_reader :run_realtime_report
|
932
|
+
|
933
|
+
# @private
|
934
|
+
def initialize parent_rpcs = nil
|
935
|
+
run_report_config = parent_rpcs.run_report if parent_rpcs.respond_to? :run_report
|
936
|
+
@run_report = ::Gapic::Config::Method.new run_report_config
|
937
|
+
run_pivot_report_config = parent_rpcs.run_pivot_report if parent_rpcs.respond_to? :run_pivot_report
|
938
|
+
@run_pivot_report = ::Gapic::Config::Method.new run_pivot_report_config
|
939
|
+
batch_run_reports_config = parent_rpcs.batch_run_reports if parent_rpcs.respond_to? :batch_run_reports
|
940
|
+
@batch_run_reports = ::Gapic::Config::Method.new batch_run_reports_config
|
941
|
+
batch_run_pivot_reports_config = parent_rpcs.batch_run_pivot_reports if parent_rpcs.respond_to? :batch_run_pivot_reports
|
942
|
+
@batch_run_pivot_reports = ::Gapic::Config::Method.new batch_run_pivot_reports_config
|
943
|
+
get_metadata_config = parent_rpcs.get_metadata if parent_rpcs.respond_to? :get_metadata
|
944
|
+
@get_metadata = ::Gapic::Config::Method.new get_metadata_config
|
945
|
+
run_realtime_report_config = parent_rpcs.run_realtime_report if parent_rpcs.respond_to? :run_realtime_report
|
946
|
+
@run_realtime_report = ::Gapic::Config::Method.new run_realtime_report_config
|
947
|
+
|
948
|
+
yield self if block_given?
|
949
|
+
end
|
950
|
+
end
|
951
|
+
end
|
952
|
+
end
|
953
|
+
end
|
954
|
+
end
|
955
|
+
end
|
956
|
+
end
|
957
|
+
end
|