Class: Google::Apis::AnalyticsV2_4::AnalyticsService

Inherits:
Core::BaseService show all
Defined in:
generated/google/apis/analytics_v2_4/service.rb

Overview

Google Analytics API

Views and manages your Google Analytics data.

Examples:

require 'google/apis/analytics_v2_4'

Analytics = Google::Apis::AnalyticsV2_4 # Alias the module
service = Analytics::AnalyticsService.new

See Also:

Instance Attribute Summary collapse

Attributes inherited from Core::BaseService

#authorization, #base_path, #batch_path, #client, #client_options, #request_options, #root_url, #upload_path

Instance Method Summary collapse

Methods inherited from Core::BaseService

#batch, #batch_upload, #fetch_all, #http

Methods included from Core::Logging

#logger

Constructor Details

#initializeAnalyticsService

Returns a new instance of AnalyticsService



51
52
53
54
# File 'generated/google/apis/analytics_v2_4/service.rb', line 51

def initialize
  super('https://www.googleapis.com/', 'analytics/v2.4/')
  @batch_path = 'batch/analytics/v2.4'
end

Instance Attribute Details

#keyString

Returns API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.

Returns:

  • (String)

    API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.



38
39
40
# File 'generated/google/apis/analytics_v2_4/service.rb', line 38

def key
  @key
end

#quota_userString

Returns Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.

Returns:

  • (String)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.



44
45
46
# File 'generated/google/apis/analytics_v2_4/service.rb', line 44

def quota_user
  @quota_user
end

#user_ipString

Returns IP address of the site where the request originates. Use this if you want to enforce per-user limits.

Returns:

  • (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.



49
50
51
# File 'generated/google/apis/analytics_v2_4/service.rb', line 49

def user_ip
  @user_ip
end

Instance Method Details

#get_datum(ids, start_date, end_date, metrics, dimensions: nil, filters: nil, max_results: nil, segment: nil, sort: nil, start_index: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... }

This method returns an undefined value.

Returns Analytics report data for a view (profile).

Parameters:

  • ids (String)

    Unique table ID for retrieving report data. Table ID is of the form ga:XXXX, where XXXX is the Analytics view (profile) ID.

  • start_date (String)

    Start date for fetching report data. All requests should specify a start date formatted as YYYY-MM-DD.

  • end_date (String)

    End date for fetching report data. All requests should specify an end date formatted as YYYY-MM-DD.

  • metrics (String)

    A comma-separated list of Analytics metrics. E.g., 'ga:sessions,ga:pageviews'. At least one metric must be specified to retrieve a valid Analytics report.

  • dimensions (String)

    A comma-separated list of Analytics dimensions. E.g., 'ga:browser,ga:city'.

  • filters (String)

    A comma-separated list of dimension or metric filters to be applied to the report data.

  • max_results (Fixnum)

    The maximum number of entries to include in this feed.

  • segment (String)

    An Analytics advanced segment to be applied to the report data.

  • sort (String)

    A comma-separated list of dimensions or metrics that determine the sort order for the report data.

  • start_index (Fixnum)

    An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

  • result (NilClass)

    No result returned for this method

  • err (StandardError)

    error object if request failed

Raises:



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'generated/google/apis/analytics_v2_4/service.rb', line 105

def get_datum(ids, start_date, end_date, metrics, dimensions: nil, filters: nil, max_results: nil, segment: nil, sort: nil, start_index: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:get, 'data', options)
  command.query['dimensions'] = dimensions unless dimensions.nil?
  command.query['end-date'] = end_date unless end_date.nil?
  command.query['filters'] = filters unless filters.nil?
  command.query['ids'] = ids unless ids.nil?
  command.query['max-results'] = max_results unless max_results.nil?
  command.query['metrics'] = metrics unless metrics.nil?
  command.query['segment'] = segment unless segment.nil?
  command.query['sort'] = sort unless sort.nil?
  command.query['start-date'] = start_date unless start_date.nil?
  command.query['start-index'] = start_index unless start_index.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end

#list_management_accounts(max_results: nil, start_index: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... }

This method returns an undefined value.

Lists all accounts to which the user has access.

Parameters:

  • max_results (Fixnum)

    The maximum number of accounts to include in this response.

  • start_index (Fixnum)

    An index of the first account to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

  • result (NilClass)

    No result returned for this method

  • err (StandardError)

    error object if request failed

Raises:



150
151
152
153
154
155
156
157
158
# File 'generated/google/apis/analytics_v2_4/service.rb', line 150

def list_management_accounts(max_results: nil, start_index: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:get, 'management/accounts', options)
  command.query['max-results'] = max_results unless max_results.nil?
  command.query['start-index'] = start_index unless start_index.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end

#list_management_goals(account_id, web_property_id, profile_id, max_results: nil, start_index: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... }

This method returns an undefined value.

Lists goals to which the user has access.

Parameters:

  • account_id (String)

    Account ID to retrieve goals for. Can either be a specific account ID or '~all' , which refers to all the accounts that user has access to.

  • web_property_id (String)

    Web property ID to retrieve goals for. Can either be a specific web property ID or '~all', which refers to all the web properties that user has access to.

  • profile_id (String)

    View (Profile) ID to retrieve goals for. Can either be a specific view ( profile) ID or '~all', which refers to all the views (profiles) that user has access to.

  • max_results (Fixnum)

    The maximum number of goals to include in this response.

  • start_index (Fixnum)

    An index of the first goal to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

  • result (NilClass)

    No result returned for this method

  • err (StandardError)

    error object if request failed

Raises:



197
198
199
200
201
202
203
204
205
206
207
208
# File 'generated/google/apis/analytics_v2_4/service.rb', line 197

def list_management_goals(, web_property_id, profile_id, max_results: nil, start_index: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:get, 'management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals', options)
  command.params['accountId'] =  unless .nil?
  command.params['webPropertyId'] = web_property_id unless web_property_id.nil?
  command.params['profileId'] = profile_id unless profile_id.nil?
  command.query['max-results'] = max_results unless max_results.nil?
  command.query['start-index'] = start_index unless start_index.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end

#list_management_profiles(account_id, web_property_id, max_results: nil, start_index: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... }

This method returns an undefined value.

Lists views (profiles) to which the user has access.

Parameters:

  • account_id (String)

    Account ID for the views (profiles) to retrieve. Can either be a specific account ID or '~all', which refers to all the accounts to which the user has access.

  • web_property_id (String)

    Web property ID for the views (profiles) to retrieve. Can either be a specific web property ID or '~all', which refers to all the web properties to which the user has access.

  • max_results (Fixnum)

    The maximum number of views (profiles) to include in this response.

  • start_index (Fixnum)

    An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

  • result (NilClass)

    No result returned for this method

  • err (StandardError)

    error object if request failed

Raises:



245
246
247
248
249
250
251
252
253
254
255
# File 'generated/google/apis/analytics_v2_4/service.rb', line 245

def list_management_profiles(, web_property_id, max_results: nil, start_index: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:get, 'management/accounts/{accountId}/webproperties/{webPropertyId}/profiles', options)
  command.params['accountId'] =  unless .nil?
  command.params['webPropertyId'] = web_property_id unless web_property_id.nil?
  command.query['max-results'] = max_results unless max_results.nil?
  command.query['start-index'] = start_index unless start_index.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end

#list_management_segments(max_results: nil, start_index: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... }

This method returns an undefined value.

Lists advanced segments to which the user has access.

Parameters:

  • max_results (Fixnum)

    The maximum number of advanced segments to include in this response.

  • start_index (Fixnum)

    An index of the first advanced segment to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

  • result (NilClass)

    No result returned for this method

  • err (StandardError)

    error object if request failed

Raises:



284
285
286
287
288
289
290
291
292
# File 'generated/google/apis/analytics_v2_4/service.rb', line 284

def list_management_segments(max_results: nil, start_index: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:get, 'management/segments', options)
  command.query['max-results'] = max_results unless max_results.nil?
  command.query['start-index'] = start_index unless start_index.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end

#list_management_webproperties(account_id, max_results: nil, start_index: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... }

This method returns an undefined value.

Lists web properties to which the user has access.

Parameters:

  • account_id (String)

    Account ID to retrieve web properties for. Can either be a specific account ID or '~all', which refers to all the accounts that user has access to.

  • max_results (Fixnum)

    The maximum number of web properties to include in this response.

  • start_index (Fixnum)

    An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

  • result (NilClass)

    No result returned for this method

  • err (StandardError)

    error object if request failed

Raises:



324
325
326
327
328
329
330
331
332
333
# File 'generated/google/apis/analytics_v2_4/service.rb', line 324

def list_management_webproperties(, max_results: nil, start_index: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:get, 'management/accounts/{accountId}/webproperties', options)
  command.params['accountId'] =  unless .nil?
  command.query['max-results'] = max_results unless max_results.nil?
  command.query['start-index'] = start_index unless start_index.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end