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



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

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 An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

Returns:

  • (String)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.



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

def quota_user
  @quota_user
end

#user_ipString

Returns Deprecated. Please use quotaUser instead.

Returns:

  • (String)

    Deprecated. Please use quotaUser instead.



47
48
49
# File 'generated/google/apis/analytics_v2_4/service.rb', line 47

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)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

  • user_ip (String)

    Deprecated. Please use quotaUser instead.

  • 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:



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'generated/google/apis/analytics_v2_4/service.rb', line 101

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)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

  • user_ip (String)

    Deprecated. Please use quotaUser instead.

  • 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:



144
145
146
147
148
149
150
151
152
# File 'generated/google/apis/analytics_v2_4/service.rb', line 144

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)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

  • user_ip (String)

    Deprecated. Please use quotaUser instead.

  • 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:



189
190
191
192
193
194
195
196
197
198
199
200
# File 'generated/google/apis/analytics_v2_4/service.rb', line 189

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)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

  • user_ip (String)

    Deprecated. Please use quotaUser instead.

  • 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:



235
236
237
238
239
240
241
242
243
244
245
# File 'generated/google/apis/analytics_v2_4/service.rb', line 235

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)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

  • user_ip (String)

    Deprecated. Please use quotaUser instead.

  • 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:



272
273
274
275
276
277
278
279
280
# File 'generated/google/apis/analytics_v2_4/service.rb', line 272

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)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

  • user_ip (String)

    Deprecated. Please use quotaUser instead.

  • 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:



310
311
312
313
314
315
316
317
318
319
# File 'generated/google/apis/analytics_v2_4/service.rb', line 310

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