Class: Google::Analytics::Data::V1beta::AnalyticsData::Client
- Inherits:
-
Object
- Object
- Google::Analytics::Data::V1beta::AnalyticsData::Client
- Includes:
- Paths
- Defined in:
- lib/google/analytics/data/v1beta/analytics_data/client.rb
Overview
Client for the AnalyticsData service.
Google Analytics reporting data service.
Defined Under Namespace
Classes: Configuration
Instance Attribute Summary collapse
-
#operations_client ⇒ ::Google::Analytics::Data::V1beta::AnalyticsData::Operations
readonly
Get the associated client for long-running operations.
Class Method Summary collapse
-
.configure {|config| ... } ⇒ Client::Configuration
Configure the AnalyticsData Client class.
Instance Method Summary collapse
-
#batch_run_pivot_reports(request, options = nil) {|response, operation| ... } ⇒ ::Google::Analytics::Data::V1beta::BatchRunPivotReportsResponse
Returns multiple pivot reports in a batch.
-
#batch_run_reports(request, options = nil) {|response, operation| ... } ⇒ ::Google::Analytics::Data::V1beta::BatchRunReportsResponse
Returns multiple reports in a batch.
-
#check_compatibility(request, options = nil) {|response, operation| ... } ⇒ ::Google::Analytics::Data::V1beta::CheckCompatibilityResponse
This compatibility method lists dimensions and metrics that can be added to a report request and maintain compatibility.
-
#configure {|config| ... } ⇒ Client::Configuration
Configure the AnalyticsData Client instance.
-
#create_audience_export(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::Operation
Creates an audience export for later retrieval.
-
#get_audience_export(request, options = nil) {|response, operation| ... } ⇒ ::Google::Analytics::Data::V1beta::AudienceExport
Gets configuration metadata about a specific audience export.
-
#get_metadata(request, options = nil) {|response, operation| ... } ⇒ ::Google::Analytics::Data::V1beta::Metadata
Returns metadata for dimensions and metrics available in reporting methods.
-
#initialize {|config| ... } ⇒ Client
constructor
Create a new AnalyticsData client object.
-
#list_audience_exports(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::PagedEnumerable<::Google::Analytics::Data::V1beta::AudienceExport>
Lists all audience exports for a property.
-
#logger ⇒ Logger
The logger used for request/response debug logging.
-
#query_audience_export(request, options = nil) {|response, operation| ... } ⇒ ::Google::Analytics::Data::V1beta::QueryAudienceExportResponse
Retrieves an audience export of users.
-
#run_pivot_report(request, options = nil) {|response, operation| ... } ⇒ ::Google::Analytics::Data::V1beta::RunPivotReportResponse
Returns a customized pivot report of your Google Analytics event data.
-
#run_realtime_report(request, options = nil) {|response, operation| ... } ⇒ ::Google::Analytics::Data::V1beta::RunRealtimeReportResponse
Returns a customized report of realtime event data for your property.
-
#run_report(request, options = nil) {|response, operation| ... } ⇒ ::Google::Analytics::Data::V1beta::RunReportResponse
Returns a customized report of your Google Analytics event data.
-
#universe_domain ⇒ String
The effective universe domain.
Methods included from Paths
#audience_export_path, #metadata_path, #property_path
Constructor Details
#initialize {|config| ... } ⇒ Client
Create a new AnalyticsData client object.
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 |
# File 'lib/google/analytics/data/v1beta/analytics_data/client.rb', line 143 def initialize # These require statements are intentionally placed here to initialize # the gRPC module only when it's required. # See https://github.com/googleapis/toolkit/issues/446 require "gapic/grpc" require "google/analytics/data/v1beta/analytics_data_api_services_pb" # Create the configuration object @config = Configuration.new Client.configure # Yield the configuration if needed yield @config if block_given? # Create credentials credentials = @config.credentials # Use self-signed JWT if the endpoint is unchanged from default, # but only if the default endpoint does not have a region prefix. enable_self_signed_jwt = @config.endpoint.nil? || (@config.endpoint == Configuration::DEFAULT_ENDPOINT && !@config.endpoint.split(".").first.include?("-")) credentials ||= Credentials.default scope: @config.scope, enable_self_signed_jwt: enable_self_signed_jwt if credentials.is_a?(::String) || credentials.is_a?(::Hash) credentials = Credentials.new credentials, scope: @config.scope end @quota_project_id = @config.quota_project @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id @operations_client = Operations.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint config.universe_domain = @config.universe_domain end @analytics_data_stub = ::Gapic::ServiceStub.new( ::Google::Analytics::Data::V1beta::BetaAnalyticsData::Stub, credentials: credentials, endpoint: @config.endpoint, endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, universe_domain: @config.universe_domain, channel_args: @config.channel_args, interceptors: @config.interceptors, channel_pool_config: @config.channel_pool, logger: @config.logger ) @analytics_data_stub.stub_logger&.info do |entry| entry.set_system_name entry.set_service entry. = "Created client for #{entry.service}" entry.set_credentials_fields credentials entry.set "customEndpoint", @config.endpoint if @config.endpoint entry.set "defaultTimeout", @config.timeout if @config.timeout entry.set "quotaProject", @quota_project_id if @quota_project_id end end |
Instance Attribute Details
#operations_client ⇒ ::Google::Analytics::Data::V1beta::AnalyticsData::Operations (readonly)
Get the associated client for long-running operations.
206 207 208 |
# File 'lib/google/analytics/data/v1beta/analytics_data/client.rb', line 206 def operations_client @operations_client end |
Class Method Details
.configure {|config| ... } ⇒ Client::Configuration
Configure the AnalyticsData Client class.
See Configuration for a description of the configuration fields.
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 |
# File 'lib/google/analytics/data/v1beta/analytics_data/client.rb', line 62 def self.configure @configure ||= begin namespace = ["Google", "Analytics", "Data", "V1beta"] parent_config = while namespace.any? parent_name = namespace.join "::" parent_const = const_get parent_name break parent_const.configure if parent_const.respond_to? :configure namespace.pop end default_config = Client::Configuration.new parent_config default_config.timeout = 60.0 default_config.retry_policy = { initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [2] } default_config.rpcs.run_report.timeout = 60.0 default_config.rpcs.run_pivot_report.timeout = 60.0 default_config.rpcs.batch_run_reports.timeout = 60.0 default_config.rpcs.batch_run_pivot_reports.timeout = 60.0 default_config.rpcs..timeout = 60.0 default_config.rpcs.run_realtime_report.timeout = 60.0 default_config.rpcs.check_compatibility.timeout = 60.0 default_config end yield @configure if block_given? @configure end |
Instance Method Details
#batch_run_pivot_reports(request, options = nil) ⇒ ::Google::Analytics::Data::V1beta::BatchRunPivotReportsResponse #batch_run_pivot_reports(property: nil, requests: nil) ⇒ ::Google::Analytics::Data::V1beta::BatchRunPivotReportsResponse
Returns multiple pivot reports in a batch. All reports must be for the same Google Analytics property.
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 |
# File 'lib/google/analytics/data/v1beta/analytics_data/client.rb', line 693 def batch_run_pivot_reports request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1beta::BatchRunPivotReportsRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.batch_run_pivot_reports..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Analytics::Data::V1beta::VERSION [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.property header_params["property"] = request.property end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.batch_run_pivot_reports.timeout, metadata: , retry_policy: @config.rpcs.batch_run_pivot_reports.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @analytics_data_stub.call_rpc :batch_run_pivot_reports, request, options: do |response, operation| yield response, operation if block_given? end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#batch_run_reports(request, options = nil) ⇒ ::Google::Analytics::Data::V1beta::BatchRunReportsResponse #batch_run_reports(property: nil, requests: nil) ⇒ ::Google::Analytics::Data::V1beta::BatchRunReportsResponse
Returns multiple reports in a batch. All reports must be for the same Google Analytics property.
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 |
# File 'lib/google/analytics/data/v1beta/analytics_data/client.rb', line 596 def batch_run_reports request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1beta::BatchRunReportsRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.batch_run_reports..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Analytics::Data::V1beta::VERSION [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.property header_params["property"] = request.property end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.batch_run_reports.timeout, metadata: , retry_policy: @config.rpcs.batch_run_reports.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @analytics_data_stub.call_rpc :batch_run_reports, request, options: do |response, operation| yield response, operation if block_given? end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#check_compatibility(request, options = nil) ⇒ ::Google::Analytics::Data::V1beta::CheckCompatibilityResponse #check_compatibility(property: nil, dimensions: nil, metrics: nil, dimension_filter: nil, metric_filter: nil, compatibility_filter: nil) ⇒ ::Google::Analytics::Data::V1beta::CheckCompatibilityResponse
This compatibility method lists dimensions and metrics that can be added to a report request and maintain compatibility. This method fails if the request's dimensions and metrics are incompatible.
In Google Analytics, reports fail if they request incompatible dimensions and/or metrics; in that case, you will need to remove dimensions and/or metrics from the incompatible report until the report is compatible.
The Realtime and Core reports have different compatibility rules. This method checks compatibility for Core reports.
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 |
# File 'lib/google/analytics/data/v1beta/analytics_data/client.rb', line 1044 def check_compatibility request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1beta::CheckCompatibilityRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.check_compatibility..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Analytics::Data::V1beta::VERSION [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.property header_params["property"] = request.property end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.check_compatibility.timeout, metadata: , retry_policy: @config.rpcs.check_compatibility.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @analytics_data_stub.call_rpc :check_compatibility, request, options: do |response, operation| yield response, operation if block_given? end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#configure {|config| ... } ⇒ Client::Configuration
Configure the AnalyticsData Client instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on configure.
See Configuration for a description of the configuration fields.
113 114 115 116 |
# File 'lib/google/analytics/data/v1beta/analytics_data/client.rb', line 113 def configure yield @config if block_given? @config end |
#create_audience_export(request, options = nil) ⇒ ::Gapic::Operation #create_audience_export(parent: nil, audience_export: nil) ⇒ ::Gapic::Operation
Creates an audience export for later retrieval. This method quickly returns
the audience export's resource name and initiates a long running
asynchronous request to form an audience export. To export the users in an
audience export, first create the audience export through this method and
then send the audience resource name to the QueryAudienceExport
method.
See Creating an Audience Export for an introduction to Audience Exports with examples.
An audience export is a snapshot of the users currently in the audience at the time of audience export creation. Creating audience exports for one audience on different days will return different results as users enter and exit the audience.
Audiences in Google Analytics 4 allow you to segment your users in the ways that are important to your business. To learn more, see https://support.google.com/analytics/answer/9267572. Audience exports contain the users in each audience.
Audience Export APIs have some methods at alpha and other methods at beta stability. The intention is to advance methods to beta stability after some feedback and adoption. To give your feedback on this API, complete the Google Analytics Audience Export API Feedback form.
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 |
# File 'lib/google/analytics/data/v1beta/analytics_data/client.rb', line 1163 def create_audience_export request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1beta::CreateAudienceExportRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.create_audience_export..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Analytics::Data::V1beta::VERSION [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.parent header_params["parent"] = request.parent end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.create_audience_export.timeout, metadata: , retry_policy: @config.rpcs.create_audience_export.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @analytics_data_stub.call_rpc :create_audience_export, request, options: do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: yield response, operation if block_given? throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#get_audience_export(request, options = nil) ⇒ ::Google::Analytics::Data::V1beta::AudienceExport #get_audience_export(name: nil) ⇒ ::Google::Analytics::Data::V1beta::AudienceExport
Gets configuration metadata about a specific audience export. This method can be used to understand an audience export after it has been created.
See Creating an Audience Export for an introduction to Audience Exports with examples.
Audience Export APIs have some methods at alpha and other methods at beta stability. The intention is to advance methods to beta stability after some feedback and adoption. To give your feedback on this API, complete the Google Analytics Audience Export API Feedback form.
1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 |
# File 'lib/google/analytics/data/v1beta/analytics_data/client.rb', line 1387 def get_audience_export request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1beta::GetAudienceExportRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_audience_export..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Analytics::Data::V1beta::VERSION [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.get_audience_export.timeout, metadata: , retry_policy: @config.rpcs.get_audience_export.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @analytics_data_stub.call_rpc :get_audience_export, request, options: do |response, operation| yield response, operation if block_given? end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#get_metadata(request, options = nil) ⇒ ::Google::Analytics::Data::V1beta::Metadata #get_metadata(name: nil) ⇒ ::Google::Analytics::Data::V1beta::Metadata
Returns metadata for dimensions and metrics available in reporting methods. Used to explore the dimensions and metrics. In this method, a Google Analytics property identifier is specified in the request, and the metadata response includes Custom dimensions and metrics as well as Universal metadata.
For example if a custom metric with parameter name levels_unlocked
is
registered to a property, the Metadata response will contain
customEvent:levels_unlocked
. Universal metadata are dimensions and
metrics applicable to any property such as country
and totalUsers
.
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 |
# File 'lib/google/analytics/data/v1beta/analytics_data/client.rb', line 797 def request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1beta::GetMetadataRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs...to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Analytics::Data::V1beta::VERSION [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs..timeout, metadata: , retry_policy: @config.rpcs..retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @analytics_data_stub.call_rpc :get_metadata, request, options: do |response, operation| yield response, operation if block_given? end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#list_audience_exports(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Analytics::Data::V1beta::AudienceExport> #list_audience_exports(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Analytics::Data::V1beta::AudienceExport>
Lists all audience exports for a property. This method can be used for you to find and reuse existing audience exports rather than creating unnecessary new audience exports. The same audience can have multiple audience exports that represent the export of users that were in an audience on different days.
See Creating an Audience Export for an introduction to Audience Exports with examples.
Audience Export APIs have some methods at alpha and other methods at beta stability. The intention is to advance methods to beta stability after some feedback and adoption. To give your feedback on this API, complete the Google Analytics Audience Export API Feedback form.
1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 |
# File 'lib/google/analytics/data/v1beta/analytics_data/client.rb', line 1502 def list_audience_exports request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1beta::ListAudienceExportsRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.list_audience_exports..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Analytics::Data::V1beta::VERSION [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.parent header_params["parent"] = request.parent end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.list_audience_exports.timeout, metadata: , retry_policy: @config.rpcs.list_audience_exports.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @analytics_data_stub.call_rpc :list_audience_exports, request, options: do |response, operation| response = ::Gapic::PagedEnumerable.new @analytics_data_stub, :list_audience_exports, request, response, operation, yield response, operation if block_given? throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#logger ⇒ Logger
The logger used for request/response debug logging.
213 214 215 |
# File 'lib/google/analytics/data/v1beta/analytics_data/client.rb', line 213 def logger @analytics_data_stub.logger end |
#query_audience_export(request, options = nil) ⇒ ::Google::Analytics::Data::V1beta::QueryAudienceExportResponse #query_audience_export(name: nil, offset: nil, limit: nil) ⇒ ::Google::Analytics::Data::V1beta::QueryAudienceExportResponse
Retrieves an audience export of users. After creating an audience, the
users are not immediately available for exporting. First, a request to
CreateAudienceExport
is necessary to create an audience export of users,
and then second, this method is used to retrieve the users in the audience
export.
See Creating an Audience Export for an introduction to Audience Exports with examples.
Audiences in Google Analytics 4 allow you to segment your users in the ways that are important to your business. To learn more, see https://support.google.com/analytics/answer/9267572.
Audience Export APIs have some methods at alpha and other methods at beta stability. The intention is to advance methods to beta stability after some feedback and adoption. To give your feedback on this API, complete the Google Analytics Audience Export API Feedback form.
1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 |
# File 'lib/google/analytics/data/v1beta/analytics_data/client.rb', line 1290 def query_audience_export request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1beta::QueryAudienceExportRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.query_audience_export..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Analytics::Data::V1beta::VERSION [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.query_audience_export.timeout, metadata: , retry_policy: @config.rpcs.query_audience_export.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @analytics_data_stub.call_rpc :query_audience_export, request, options: do |response, operation| yield response, operation if block_given? end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#run_pivot_report(request, options = nil) ⇒ ::Google::Analytics::Data::V1beta::RunPivotReportResponse #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, comparisons: nil) ⇒ ::Google::Analytics::Data::V1beta::RunPivotReportResponse
Returns a customized pivot report of your Google Analytics event data. Pivot reports are more advanced and expressive formats than regular reports. In a pivot report, dimensions are only visible if they are included in a pivot. Multiple pivots can be specified to further dissect your data.
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 |
# File 'lib/google/analytics/data/v1beta/analytics_data/client.rb', line 499 def run_pivot_report request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1beta::RunPivotReportRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.run_pivot_report..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Analytics::Data::V1beta::VERSION [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.property header_params["property"] = request.property end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.run_pivot_report.timeout, metadata: , retry_policy: @config.rpcs.run_pivot_report.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @analytics_data_stub.call_rpc :run_pivot_report, request, options: do |response, operation| yield response, operation if block_given? end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#run_realtime_report(request, options = nil) ⇒ ::Google::Analytics::Data::V1beta::RunRealtimeReportResponse #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, minute_ranges: nil) ⇒ ::Google::Analytics::Data::V1beta::RunRealtimeReportResponse
Returns a customized report of realtime event data for your property. Events appear in realtime reports seconds after they have been sent to the Google Analytics. Realtime reports show events and usage data for the periods of time ranging from the present moment to 30 minutes ago (up to 60 minutes for Google Analytics 360 properties).
For a guide to constructing realtime requests & understanding responses, see Creating a Realtime Report.
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 |
# File 'lib/google/analytics/data/v1beta/analytics_data/client.rb', line 929 def run_realtime_report request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1beta::RunRealtimeReportRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.run_realtime_report..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Analytics::Data::V1beta::VERSION [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.property header_params["property"] = request.property end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.run_realtime_report.timeout, metadata: , retry_policy: @config.rpcs.run_realtime_report.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @analytics_data_stub.call_rpc :run_realtime_report, request, options: do |response, operation| yield response, operation if block_given? end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#run_report(request, options = nil) ⇒ ::Google::Analytics::Data::V1beta::RunReportResponse #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, comparisons: nil) ⇒ ::Google::Analytics::Data::V1beta::RunReportResponse
Returns a customized report of your Google Analytics event data. Reports contain statistics derived from data collected by the Google Analytics tracking code. The data returned from the API is as a table with columns for the requested dimensions and metrics. Metrics are individual measurements of user activity on your property, such as active users or event count. Dimensions break down metrics across some common criteria, such as country or event name.
For a guide to constructing requests & understanding responses, see Creating a Report.
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 |
# File 'lib/google/analytics/data/v1beta/analytics_data/client.rb', line 354 def run_report request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Analytics::Data::V1beta::RunReportRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.run_report..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Analytics::Data::V1beta::VERSION [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.property header_params["property"] = request.property end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.run_report.timeout, metadata: , retry_policy: @config.rpcs.run_report.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @analytics_data_stub.call_rpc :run_report, request, options: do |response, operation| yield response, operation if block_given? end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#universe_domain ⇒ String
The effective universe domain
123 124 125 |
# File 'lib/google/analytics/data/v1beta/analytics_data/client.rb', line 123 def universe_domain @analytics_data_stub.universe_domain end |