Class: Algolia::AnalyticsClient

Inherits:
Object
  • Object
show all
Defined in:
lib/algolia/api/analytics_client.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = nil) ⇒ AnalyticsClient

Returns a new instance of AnalyticsClient.



7
8
9
10
11
12
13
# File 'lib/algolia/api/analytics_client.rb', line 7

def initialize(config = nil)
  raise '`config` is missing.' if config.nil?
  raise '`app_id` is missing.' if config.app_id.nil? || config.app_id == ''
  raise '`api_key` is missing.' if config.api_key.nil? || config.api_key == ''

  @api_client = Algolia::ApiClient.new(config)
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



5
6
7
# File 'lib/algolia/api/analytics_client.rb', line 5

def api_client
  @api_client
end

Class Method Details

.create(app_id, api_key, region = nil, opts = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/algolia/api/analytics_client.rb', line 15

def self.create(app_id, api_key, region = nil, opts = {})
  hosts = []
  regions = ['de', 'us']

  if region.is_a?(Hash) && (opts.nil? || opts.empty?)
    opts = region
    region = nil
  end

  raise "`region` must be one of the following: #{regions.join(', ')}" if !region.nil? && (!region.is_a?(String) || !regions.include?(region))

  hosts << Transport::StatefulHost.new(region.nil? ? 'analytics.algolia.com' : 'analytics.{region}.algolia.com'.sub!('{region}', region),
                                       accept: CallType::READ | CallType::WRITE)

  config = Algolia::Configuration.new(app_id, api_key, hosts, 'Analytics', opts)
  create_with_config(config)
end

.create_with_config(config) ⇒ Object



33
34
35
# File 'lib/algolia/api/analytics_client.rb', line 33

def self.create_with_config(config)
  new(config)
end

Instance Method Details

#custom_delete(path, parameters = nil, request_options = {}) ⇒ Object

Parameters:

  • path (String)

    Path of the endpoint, anything after &quot;/1&quot; must be specified. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (Object)


75
76
77
78
# File 'lib/algolia/api/analytics_client.rb', line 75

def custom_delete(path, parameters = nil, request_options = {})
  response = custom_delete_with_http_info(path, parameters, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Object')
end

#custom_delete_with_http_info(path, parameters = nil, request_options = {}) ⇒ Http::Response

Returns the response.

Parameters:

  • path (String)

    Path of the endpoint, anything after &quot;/1&quot; must be specified. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/algolia/api/analytics_client.rb', line 43

def custom_delete_with_http_info(path, parameters = nil, request_options = {})
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    raise ArgumentError, "Parameter `path` is required when calling `custom_delete`."
  end

  path = '/1{path}'.sub('{' + 'path' + '}', path.to_s)
  query_params = {}
  query_params = query_params.merge(parameters) unless parameters.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'AnalyticsClient.custom_delete',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:DELETE, path, new_options)
end

#custom_get(path, parameters = nil, request_options = {}) ⇒ Object

Parameters:

  • path (String)

    Path of the endpoint, anything after &quot;/1&quot; must be specified. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (Object)


118
119
120
121
# File 'lib/algolia/api/analytics_client.rb', line 118

def custom_get(path, parameters = nil, request_options = {})
  response = custom_get_with_http_info(path, parameters, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Object')
end

#custom_get_with_http_info(path, parameters = nil, request_options = {}) ⇒ Http::Response

Returns the response.

Parameters:

  • path (String)

    Path of the endpoint, anything after &quot;/1&quot; must be specified. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/algolia/api/analytics_client.rb', line 86

def custom_get_with_http_info(path, parameters = nil, request_options = {})
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    raise ArgumentError, "Parameter `path` is required when calling `custom_get`."
  end

  path = '/1{path}'.sub('{' + 'path' + '}', path.to_s)
  query_params = {}
  query_params = query_params.merge(parameters) unless parameters.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'AnalyticsClient.custom_get',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#custom_post(path, parameters = nil, body = nil, request_options = {}) ⇒ Object

Parameters:

  • path (String)

    Path of the endpoint, anything after &quot;/1&quot; must be specified. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • body (Object) (defaults to: nil)

    Parameters to send with the custom request.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (Object)


163
164
165
166
# File 'lib/algolia/api/analytics_client.rb', line 163

def custom_post(path, parameters = nil, body = nil, request_options = {})
  response = custom_post_with_http_info(path, parameters, body, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Object')
end

#custom_post_with_http_info(path, parameters = nil, body = nil, request_options = {}) ⇒ Http::Response

Returns the response.

Parameters:

  • path (String)

    Path of the endpoint, anything after &quot;/1&quot; must be specified. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • body (Object) (defaults to: nil)

    Parameters to send with the custom request.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/algolia/api/analytics_client.rb', line 130

def custom_post_with_http_info(path, parameters = nil, body = nil, request_options = {})
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    raise ArgumentError, "Parameter `path` is required when calling `custom_post`."
  end

  path = '/1{path}'.sub('{' + 'path' + '}', path.to_s)
  query_params = {}
  query_params = query_params.merge(parameters) unless parameters.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(body)

  new_options = request_options.merge(
    :operation => :'AnalyticsClient.custom_post',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#custom_put(path, parameters = nil, body = nil, request_options = {}) ⇒ Object

Parameters:

  • path (String)

    Path of the endpoint, anything after &quot;/1&quot; must be specified. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • body (Object) (defaults to: nil)

    Parameters to send with the custom request.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (Object)


208
209
210
211
# File 'lib/algolia/api/analytics_client.rb', line 208

def custom_put(path, parameters = nil, body = nil, request_options = {})
  response = custom_put_with_http_info(path, parameters, body, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Object')
end

#custom_put_with_http_info(path, parameters = nil, body = nil, request_options = {}) ⇒ Http::Response

Returns the response.

Parameters:

  • path (String)

    Path of the endpoint, anything after &quot;/1&quot; must be specified. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • body (Object) (defaults to: nil)

    Parameters to send with the custom request.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



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/algolia/api/analytics_client.rb', line 175

def custom_put_with_http_info(path, parameters = nil, body = nil, request_options = {})
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    raise ArgumentError, "Parameter `path` is required when calling `custom_put`."
  end

  path = '/1{path}'.sub('{' + 'path' + '}', path.to_s)
  query_params = {}
  query_params = query_params.merge(parameters) unless parameters.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(body)

  new_options = request_options.merge(
    :operation => :'AnalyticsClient.custom_put',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:PUT, path, new_options)
end

#get_average_click_position(index, start_date = nil, end_date = nil, tags = nil, request_options = {}) ⇒ GetAverageClickPositionResponse

Return the average click position for the complete time range and for individual days. > Note: If all ‘positions` have a `clickCount` of `0` or `null`, it means Algolia didn’t receive any click events for tracked searches. A tracked search is a search request where the ‘clickAnalytics` parameter is `true`.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetAverageClickPositionResponse)


262
263
264
265
# File 'lib/algolia/api/analytics_client.rb', line 262

def get_average_click_position(index, start_date = nil, end_date = nil, tags = nil, request_options = {})
  response = get_average_click_position_with_http_info(index, start_date, end_date, tags, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Analytics::GetAverageClickPositionResponse')
end

#get_average_click_position_with_http_info(index, start_date = nil, end_date = nil, tags = nil, request_options = {}) ⇒ Http::Response

Return the average click position for the complete time range and for individual days. &gt; Note: If all &#x60;positions&#x60; have a &#x60;clickCount&#x60; of &#x60;0&#x60; or &#x60;null&#x60;, it means Algolia didn&#39;t receive any click events for tracked searches. A tracked search is a search request where the &#x60;clickAnalytics&#x60; parameter is &#x60;true&#x60;.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/algolia/api/analytics_client.rb', line 223

def get_average_click_position_with_http_info(index, start_date = nil, end_date = nil, tags = nil, request_options = {})
  # verify the required parameter 'index' is set
  if @api_client.config.client_side_validation && index.nil?
    raise ArgumentError, "Parameter `index` is required when calling `get_average_click_position`."
  end

  path = '/2/clicks/averageClickPosition'
  query_params = {}
  query_params[:index] = index
  query_params[:startDate] = start_date unless start_date.nil?
  query_params[:endDate] = end_date unless end_date.nil?
  query_params[:tags] = tags unless tags.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'AnalyticsClient.get_average_click_position',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_click_positions(index, start_date = nil, end_date = nil, tags = nil, request_options = {}) ⇒ GetClickPositionsResponse

Show the number of clicks events and their associated position in the search results. > Note: If all ‘positions` have a `clickCount` of `0` or `null`, it means Algolia didn’t receive any click events for tracked searches. A tracked search is a search request where the ‘clickAnalytics` parameter is `true`.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetClickPositionsResponse)


316
317
318
319
# File 'lib/algolia/api/analytics_client.rb', line 316

def get_click_positions(index, start_date = nil, end_date = nil, tags = nil, request_options = {})
  response = get_click_positions_with_http_info(index, start_date, end_date, tags, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Analytics::GetClickPositionsResponse')
end

#get_click_positions_with_http_info(index, start_date = nil, end_date = nil, tags = nil, request_options = {}) ⇒ Http::Response

Show the number of clicks events and their associated position in the search results. &gt; Note: If all &#x60;positions&#x60; have a &#x60;clickCount&#x60; of &#x60;0&#x60; or &#x60;null&#x60;, it means Algolia didn&#39;t receive any click events for tracked searches. A tracked search is a search request where the &#x60;clickAnalytics&#x60; parameter is &#x60;true&#x60;.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/algolia/api/analytics_client.rb', line 277

def get_click_positions_with_http_info(index, start_date = nil, end_date = nil, tags = nil, request_options = {})
  # verify the required parameter 'index' is set
  if @api_client.config.client_side_validation && index.nil?
    raise ArgumentError, "Parameter `index` is required when calling `get_click_positions`."
  end

  path = '/2/clicks/positions'
  query_params = {}
  query_params[:index] = index
  query_params[:startDate] = start_date unless start_date.nil?
  query_params[:endDate] = end_date unless end_date.nil?
  query_params[:tags] = tags unless tags.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'AnalyticsClient.get_click_positions',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_click_through_rate(index, start_date = nil, end_date = nil, tags = nil, request_options = {}) ⇒ GetClickThroughRateResponse

Returns a [click-through rate (CTR)](www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate).

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetClickThroughRateResponse)


370
371
372
373
# File 'lib/algolia/api/analytics_client.rb', line 370

def get_click_through_rate(index, start_date = nil, end_date = nil, tags = nil, request_options = {})
  response = get_click_through_rate_with_http_info(index, start_date, end_date, tags, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Analytics::GetClickThroughRateResponse')
end

#get_click_through_rate_with_http_info(index, start_date = nil, end_date = nil, tags = nil, request_options = {}) ⇒ Http::Response

Returns a [click-through rate (CTR)](www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate).

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
# File 'lib/algolia/api/analytics_client.rb', line 331

def get_click_through_rate_with_http_info(index, start_date = nil, end_date = nil, tags = nil, request_options = {})
  # verify the required parameter 'index' is set
  if @api_client.config.client_side_validation && index.nil?
    raise ArgumentError, "Parameter `index` is required when calling `get_click_through_rate`."
  end

  path = '/2/clicks/clickThroughRate'
  query_params = {}
  query_params[:index] = index
  query_params[:startDate] = start_date unless start_date.nil?
  query_params[:endDate] = end_date unless end_date.nil?
  query_params[:tags] = tags unless tags.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'AnalyticsClient.get_click_through_rate',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_conversation_rate(index, start_date = nil, end_date = nil, tags = nil, request_options = {}) ⇒ GetConversationRateResponse

Return a [conversion rate](www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate).

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetConversationRateResponse)


424
425
426
427
# File 'lib/algolia/api/analytics_client.rb', line 424

def get_conversation_rate(index, start_date = nil, end_date = nil, tags = nil, request_options = {})
  response = get_conversation_rate_with_http_info(index, start_date, end_date, tags, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Analytics::GetConversationRateResponse')
end

#get_conversation_rate_with_http_info(index, start_date = nil, end_date = nil, tags = nil, request_options = {}) ⇒ Http::Response

Return a [conversion rate](www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate).

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
# File 'lib/algolia/api/analytics_client.rb', line 385

def get_conversation_rate_with_http_info(index, start_date = nil, end_date = nil, tags = nil, request_options = {})
  # verify the required parameter 'index' is set
  if @api_client.config.client_side_validation && index.nil?
    raise ArgumentError, "Parameter `index` is required when calling `get_conversation_rate`."
  end

  path = '/2/conversions/conversionRate'
  query_params = {}
  query_params[:index] = index
  query_params[:startDate] = start_date unless start_date.nil?
  query_params[:endDate] = end_date unless end_date.nil?
  query_params[:tags] = tags unless tags.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'AnalyticsClient.get_conversation_rate',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_no_click_rate(index, start_date = nil, end_date = nil, tags = nil, request_options = {}) ⇒ GetNoClickRateResponse

Returns the rate at which searches don’t lead to any clicks. The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of searches and searches without clicks.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetNoClickRateResponse)


478
479
480
481
# File 'lib/algolia/api/analytics_client.rb', line 478

def get_no_click_rate(index, start_date = nil, end_date = nil, tags = nil, request_options = {})
  response = get_no_click_rate_with_http_info(index, start_date, end_date, tags, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Analytics::GetNoClickRateResponse')
end

#get_no_click_rate_with_http_info(index, start_date = nil, end_date = nil, tags = nil, request_options = {}) ⇒ Http::Response

Returns the rate at which searches don&#39;t lead to any clicks. The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of searches and searches without clicks.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
# File 'lib/algolia/api/analytics_client.rb', line 439

def get_no_click_rate_with_http_info(index, start_date = nil, end_date = nil, tags = nil, request_options = {})
  # verify the required parameter 'index' is set
  if @api_client.config.client_side_validation && index.nil?
    raise ArgumentError, "Parameter `index` is required when calling `get_no_click_rate`."
  end

  path = '/2/searches/noClickRate'
  query_params = {}
  query_params[:index] = index
  query_params[:startDate] = start_date unless start_date.nil?
  query_params[:endDate] = end_date unless end_date.nil?
  query_params[:tags] = tags unless tags.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'AnalyticsClient.get_no_click_rate',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_no_results_rate(index, start_date = nil, end_date = nil, tags = nil, request_options = {}) ⇒ GetNoResultsRateResponse

Returns the rate at which searches didn’t return any results.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetNoResultsRateResponse)


532
533
534
535
# File 'lib/algolia/api/analytics_client.rb', line 532

def get_no_results_rate(index, start_date = nil, end_date = nil, tags = nil, request_options = {})
  response = get_no_results_rate_with_http_info(index, start_date, end_date, tags, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Analytics::GetNoResultsRateResponse')
end

#get_no_results_rate_with_http_info(index, start_date = nil, end_date = nil, tags = nil, request_options = {}) ⇒ Http::Response

Returns the rate at which searches didn&#39;t return any results.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
# File 'lib/algolia/api/analytics_client.rb', line 493

def get_no_results_rate_with_http_info(index, start_date = nil, end_date = nil, tags = nil, request_options = {})
  # verify the required parameter 'index' is set
  if @api_client.config.client_side_validation && index.nil?
    raise ArgumentError, "Parameter `index` is required when calling `get_no_results_rate`."
  end

  path = '/2/searches/noResultRate'
  query_params = {}
  query_params[:index] = index
  query_params[:startDate] = start_date unless start_date.nil?
  query_params[:endDate] = end_date unless end_date.nil?
  query_params[:tags] = tags unless tags.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'AnalyticsClient.get_no_results_rate',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_searches_count(index, start_date = nil, end_date = nil, tags = nil, request_options = {}) ⇒ GetSearchesCountResponse

Returns the number of searches within a time range.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetSearchesCountResponse)


586
587
588
589
# File 'lib/algolia/api/analytics_client.rb', line 586

def get_searches_count(index, start_date = nil, end_date = nil, tags = nil, request_options = {})
  response = get_searches_count_with_http_info(index, start_date, end_date, tags, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Analytics::GetSearchesCountResponse')
end

#get_searches_count_with_http_info(index, start_date = nil, end_date = nil, tags = nil, request_options = {}) ⇒ Http::Response

Returns the number of searches within a time range.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
# File 'lib/algolia/api/analytics_client.rb', line 547

def get_searches_count_with_http_info(index, start_date = nil, end_date = nil, tags = nil, request_options = {})
  # verify the required parameter 'index' is set
  if @api_client.config.client_side_validation && index.nil?
    raise ArgumentError, "Parameter `index` is required when calling `get_searches_count`."
  end

  path = '/2/searches/count'
  query_params = {}
  query_params[:index] = index
  query_params[:startDate] = start_date unless start_date.nil?
  query_params[:endDate] = end_date unless end_date.nil?
  query_params[:tags] = tags unless tags.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'AnalyticsClient.get_searches_count',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_searches_no_clicks(index, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {}) ⇒ GetSearchesNoClicksResponse

Return the most popular of the last 1,000 searches that didn’t lead to any clicks.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the first item to return. (default to 0)

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetSearchesNoClicksResponse)


649
650
651
652
# File 'lib/algolia/api/analytics_client.rb', line 649

def get_searches_no_clicks(index, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {})
  response = get_searches_no_clicks_with_http_info(index, start_date, end_date, limit, offset, tags, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Analytics::GetSearchesNoClicksResponse')
end

#get_searches_no_clicks_with_http_info(index, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {}) ⇒ Http::Response

Return the most popular of the last 1,000 searches that didn&#39;t lead to any clicks.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the first item to return. (default to 0)

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



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/algolia/api/analytics_client.rb', line 603

def get_searches_no_clicks_with_http_info(index, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {})
  # verify the required parameter 'index' is set
  if @api_client.config.client_side_validation && index.nil?
    raise ArgumentError, "Parameter `index` is required when calling `get_searches_no_clicks`."
  end
  if @api_client.config.client_side_validation && !offset.nil? && offset < 0
    raise ArgumentError, 'invalid value for ""offset"" when calling AnalyticsClient.get_searches_no_clicks, must be greater than or equal to 0.'
  end

  path = '/2/searches/noClicks'
  query_params = {}
  query_params[:index] = index
  query_params[:startDate] = start_date unless start_date.nil?
  query_params[:endDate] = end_date unless end_date.nil?
  query_params[:limit] = limit unless limit.nil?
  query_params[:offset] = offset unless offset.nil?
  query_params[:tags] = tags unless tags.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'AnalyticsClient.get_searches_no_clicks',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_searches_no_results(index, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {}) ⇒ GetSearchesNoResultsResponse

Returns the most popular of the latest 1,000 searches that didn’t return any results.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the first item to return. (default to 0)

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetSearchesNoResultsResponse)


712
713
714
715
# File 'lib/algolia/api/analytics_client.rb', line 712

def get_searches_no_results(index, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {})
  response = get_searches_no_results_with_http_info(index, start_date, end_date, limit, offset, tags, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Analytics::GetSearchesNoResultsResponse')
end

#get_searches_no_results_with_http_info(index, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {}) ⇒ Http::Response

Returns the most popular of the latest 1,000 searches that didn&#39;t return any results.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the first item to return. (default to 0)

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
# File 'lib/algolia/api/analytics_client.rb', line 666

def get_searches_no_results_with_http_info(index, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {})
  # verify the required parameter 'index' is set
  if @api_client.config.client_side_validation && index.nil?
    raise ArgumentError, "Parameter `index` is required when calling `get_searches_no_results`."
  end
  if @api_client.config.client_side_validation && !offset.nil? && offset < 0
    raise ArgumentError, 'invalid value for ""offset"" when calling AnalyticsClient.get_searches_no_results, must be greater than or equal to 0.'
  end

  path = '/2/searches/noResults'
  query_params = {}
  query_params[:index] = index
  query_params[:startDate] = start_date unless start_date.nil?
  query_params[:endDate] = end_date unless end_date.nil?
  query_params[:limit] = limit unless limit.nil?
  query_params[:offset] = offset unless offset.nil?
  query_params[:tags] = tags unless tags.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'AnalyticsClient.get_searches_no_results',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_status(index, request_options = {}) ⇒ GetStatusResponse

Return the latest update time of the Analytics API for an index. If the index has been recently created or no search has been performed yet, ‘updatedAt` will be `null`. > Note: The Analytics API is updated every 5&nbsp;minutes.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetStatusResponse)


757
758
759
760
# File 'lib/algolia/api/analytics_client.rb', line 757

def get_status(index, request_options = {})
  response = get_status_with_http_info(index, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Analytics::GetStatusResponse')
end

#get_status_with_http_info(index, request_options = {}) ⇒ Http::Response

Return the latest update time of the Analytics API for an index. If the index has been recently created or no search has been performed yet, &#x60;updatedAt&#x60; will be &#x60;null&#x60;. &gt; Note: The Analytics API is updated every 5&amp;nbsp;minutes.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
# File 'lib/algolia/api/analytics_client.rb', line 724

def get_status_with_http_info(index, request_options = {})
  # verify the required parameter 'index' is set
  if @api_client.config.client_side_validation && index.nil?
    raise ArgumentError, "Parameter `index` is required when calling `get_status`."
  end

  path = '/2/status'
  query_params = {}
  query_params[:index] = index
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'AnalyticsClient.get_status',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_top_countries(index, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {}) ⇒ GetTopCountriesResponse

Returns top countries. Limited to the 1,000 most frequent ones.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the first item to return. (default to 0)

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetTopCountriesResponse)


820
821
822
823
# File 'lib/algolia/api/analytics_client.rb', line 820

def get_top_countries(index, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {})
  response = get_top_countries_with_http_info(index, start_date, end_date, limit, offset, tags, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Analytics::GetTopCountriesResponse')
end

#get_top_countries_with_http_info(index, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {}) ⇒ Http::Response

Returns top countries. Limited to the 1,000 most frequent ones.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the first item to return. (default to 0)

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
# File 'lib/algolia/api/analytics_client.rb', line 774

def get_top_countries_with_http_info(index, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {})
  # verify the required parameter 'index' is set
  if @api_client.config.client_side_validation && index.nil?
    raise ArgumentError, "Parameter `index` is required when calling `get_top_countries`."
  end
  if @api_client.config.client_side_validation && !offset.nil? && offset < 0
    raise ArgumentError, 'invalid value for ""offset"" when calling AnalyticsClient.get_top_countries, must be greater than or equal to 0.'
  end

  path = '/2/countries'
  query_params = {}
  query_params[:index] = index
  query_params[:startDate] = start_date unless start_date.nil?
  query_params[:endDate] = end_date unless end_date.nil?
  query_params[:limit] = limit unless limit.nil?
  query_params[:offset] = offset unless offset.nil?
  query_params[:tags] = tags unless tags.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'AnalyticsClient.get_top_countries',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_top_filter_attributes(index, search = nil, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {}) ⇒ GetTopFilterAttributesResponse

Return the most popular [filterable attributes](www.algolia.com/doc/guides/managing-results/refine-results/filtering/) in the 1,000 most recently used filters.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • search (String) (defaults to: nil)

    User query.

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the first item to return. (default to 0)

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetTopFilterAttributesResponse)


886
887
888
889
# File 'lib/algolia/api/analytics_client.rb', line 886

def get_top_filter_attributes(index, search = nil, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {})
  response = get_top_filter_attributes_with_http_info(index, search, start_date, end_date, limit, offset, tags, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Analytics::GetTopFilterAttributesResponse')
end

#get_top_filter_attributes_with_http_info(index, search = nil, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {}) ⇒ Http::Response

Return the most popular [filterable attributes](www.algolia.com/doc/guides/managing-results/refine-results/filtering/) in the 1,000 most recently used filters.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • search (String) (defaults to: nil)

    User query.

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the first item to return. (default to 0)

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
# File 'lib/algolia/api/analytics_client.rb', line 838

def get_top_filter_attributes_with_http_info(index, search = nil, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {})
  # verify the required parameter 'index' is set
  if @api_client.config.client_side_validation && index.nil?
    raise ArgumentError, "Parameter `index` is required when calling `get_top_filter_attributes`."
  end
  if @api_client.config.client_side_validation && !offset.nil? && offset < 0
    raise ArgumentError, 'invalid value for ""offset"" when calling AnalyticsClient.get_top_filter_attributes, must be greater than or equal to 0.'
  end

  path = '/2/filters'
  query_params = {}
  query_params[:index] = index
  query_params[:search] = search unless search.nil?
  query_params[:startDate] = start_date unless start_date.nil?
  query_params[:endDate] = end_date unless end_date.nil?
  query_params[:limit] = limit unless limit.nil?
  query_params[:offset] = offset unless offset.nil?
  query_params[:tags] = tags unless tags.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'AnalyticsClient.get_top_filter_attributes',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_top_filter_for_attribute(attribute, index, search = nil, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {}) ⇒ GetTopFilterForAttributeResponse

Returns the most popular filter values for an attribute in the 1,000 most recently used filters.

Required API Key ACLs:

- analytics

Parameters:

  • attribute (String)

    Attribute name. (required)

  • index (String)

    Index name. (required)

  • search (String) (defaults to: nil)

    User query.

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the first item to return. (default to 0)

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetTopFilterForAttributeResponse)


958
959
960
961
# File 'lib/algolia/api/analytics_client.rb', line 958

def get_top_filter_for_attribute(attribute, index, search = nil, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {})
  response = get_top_filter_for_attribute_with_http_info(attribute, index, search, start_date, end_date, limit, offset, tags, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Analytics::GetTopFilterForAttributeResponse')
end

#get_top_filter_for_attribute_with_http_info(attribute, index, search = nil, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {}) ⇒ Http::Response

Returns the most popular filter values for an attribute in the 1,000 most recently used filters.

Required API Key ACLs:

- analytics

Parameters:

  • attribute (String)

    Attribute name. (required)

  • index (String)

    Index name. (required)

  • search (String) (defaults to: nil)

    User query.

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the first item to return. (default to 0)

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
# File 'lib/algolia/api/analytics_client.rb', line 905

def get_top_filter_for_attribute_with_http_info(attribute, index, search = nil, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {})
  # verify the required parameter 'attribute' is set
  if @api_client.config.client_side_validation && attribute.nil?
    raise ArgumentError, "Parameter `attribute` is required when calling `get_top_filter_for_attribute`."
  end
  # verify the required parameter 'index' is set
  if @api_client.config.client_side_validation && index.nil?
    raise ArgumentError, "Parameter `index` is required when calling `get_top_filter_for_attribute`."
  end
  if @api_client.config.client_side_validation && !offset.nil? && offset < 0
    raise ArgumentError, 'invalid value for ""offset"" when calling AnalyticsClient.get_top_filter_for_attribute, must be greater than or equal to 0.'
  end

  path = '/2/filters/{attribute}'.sub('{' + 'attribute' + '}', Transport.encode_uri(attribute.to_s))
  query_params = {}
  query_params[:index] = index
  query_params[:search] = search unless search.nil?
  query_params[:startDate] = start_date unless start_date.nil?
  query_params[:endDate] = end_date unless end_date.nil?
  query_params[:limit] = limit unless limit.nil?
  query_params[:offset] = offset unless offset.nil?
  query_params[:tags] = tags unless tags.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'AnalyticsClient.get_top_filter_for_attribute',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_top_filters_no_results(index, search = nil, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {}) ⇒ GetTopFiltersNoResultsResponse

Returns top filters for filter-enabled searches that don’t return results. Limited to the 1,000 most recently used filters.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • search (String) (defaults to: nil)

    User query.

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the first item to return. (default to 0)

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetTopFiltersNoResultsResponse)


1024
1025
1026
1027
# File 'lib/algolia/api/analytics_client.rb', line 1024

def get_top_filters_no_results(index, search = nil, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {})
  response = get_top_filters_no_results_with_http_info(index, search, start_date, end_date, limit, offset, tags, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Analytics::GetTopFiltersNoResultsResponse')
end

#get_top_filters_no_results_with_http_info(index, search = nil, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {}) ⇒ Http::Response

Returns top filters for filter-enabled searches that don&#39;t return results. Limited to the 1,000 most recently used filters.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • search (String) (defaults to: nil)

    User query.

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the first item to return. (default to 0)

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
# File 'lib/algolia/api/analytics_client.rb', line 976

def get_top_filters_no_results_with_http_info(index, search = nil, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {})
  # verify the required parameter 'index' is set
  if @api_client.config.client_side_validation && index.nil?
    raise ArgumentError, "Parameter `index` is required when calling `get_top_filters_no_results`."
  end
  if @api_client.config.client_side_validation && !offset.nil? && offset < 0
    raise ArgumentError, 'invalid value for ""offset"" when calling AnalyticsClient.get_top_filters_no_results, must be greater than or equal to 0.'
  end

  path = '/2/filters/noResults'
  query_params = {}
  query_params[:index] = index
  query_params[:search] = search unless search.nil?
  query_params[:startDate] = start_date unless start_date.nil?
  query_params[:endDate] = end_date unless end_date.nil?
  query_params[:limit] = limit unless limit.nil?
  query_params[:offset] = offset unless offset.nil?
  query_params[:tags] = tags unless tags.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'AnalyticsClient.get_top_filters_no_results',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_top_hits(index, search = nil, click_analytics = nil, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {}) ⇒ GetTopHitsResponse

Return the most popular clicked results in the last 1,000 searches.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • search (String) (defaults to: nil)

    User query.

  • click_analytics (Boolean) (defaults to: nil)

    Whether to include [click and conversion](www.algolia.com/doc/guides/sending-events/getting-started/) rates for a search. (default to false)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the first item to return. (default to 0)

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetTopHitsResponse)


1093
1094
1095
1096
# File 'lib/algolia/api/analytics_client.rb', line 1093

def get_top_hits(index, search = nil, click_analytics = nil, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {})
  response = get_top_hits_with_http_info(index, search, click_analytics, start_date, end_date, limit, offset, tags, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Analytics::GetTopHitsResponse')
end

#get_top_hits_with_http_info(index, search = nil, click_analytics = nil, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {}) ⇒ Http::Response

Return the most popular clicked results in the last 1,000 searches.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • search (String) (defaults to: nil)

    User query.

  • click_analytics (Boolean) (defaults to: nil)

    Whether to include [click and conversion](www.algolia.com/doc/guides/sending-events/getting-started/) rates for a search. (default to false)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the first item to return. (default to 0)

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1043
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
# File 'lib/algolia/api/analytics_client.rb', line 1043

def get_top_hits_with_http_info(index, search = nil, click_analytics = nil, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {})
  # verify the required parameter 'index' is set
  if @api_client.config.client_side_validation && index.nil?
    raise ArgumentError, "Parameter `index` is required when calling `get_top_hits`."
  end
  if @api_client.config.client_side_validation && !offset.nil? && offset < 0
    raise ArgumentError, 'invalid value for ""offset"" when calling AnalyticsClient.get_top_hits, must be greater than or equal to 0.'
  end

  path = '/2/hits'
  query_params = {}
  query_params[:index] = index
  query_params[:search] = search unless search.nil?
  query_params[:clickAnalytics] = click_analytics unless click_analytics.nil?
  query_params[:startDate] = start_date unless start_date.nil?
  query_params[:endDate] = end_date unless end_date.nil?
  query_params[:limit] = limit unless limit.nil?
  query_params[:offset] = offset unless offset.nil?
  query_params[:tags] = tags unless tags.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'AnalyticsClient.get_top_hits',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_top_searches(index, click_analytics = nil, start_date = nil, end_date = nil, order_by = nil, direction = nil, limit = nil, offset = nil, tags = nil, request_options = {}) ⇒ GetTopSearchesResponse

Returns the most popular of the latest 1,000 searches. For each search, also returns the number of hits.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • click_analytics (Boolean) (defaults to: nil)

    Whether to include [click and conversion](www.algolia.com/doc/guides/sending-events/getting-started/) rates for a search. (default to false)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • order_by (OrderBy) (defaults to: nil)

    Reorder the results. (default to ‘searchCount’)

  • direction (Direction) (defaults to: nil)

    Sorting direction of the results: ascending or descending. (default to ‘asc’)

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the first item to return. (default to 0)

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetTopSearchesResponse)


1166
1167
1168
1169
1170
# File 'lib/algolia/api/analytics_client.rb', line 1166

def get_top_searches(index, click_analytics = nil, start_date = nil, end_date = nil, order_by = nil, direction = nil, limit = nil, offset = nil, tags = nil,
                     request_options = {})
  response = get_top_searches_with_http_info(index, click_analytics, start_date, end_date, order_by, direction, limit, offset, tags, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Analytics::GetTopSearchesResponse')
end

#get_top_searches_with_http_info(index, click_analytics = nil, start_date = nil, end_date = nil, order_by = nil, direction = nil, limit = nil, offset = nil, tags = nil, request_options = {}) ⇒ Http::Response

Returns the most popular of the latest 1,000 searches. For each search, also returns the number of hits.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • click_analytics (Boolean) (defaults to: nil)

    Whether to include [click and conversion](www.algolia.com/doc/guides/sending-events/getting-started/) rates for a search. (default to false)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • order_by (OrderBy) (defaults to: nil)

    Reorder the results. (default to ‘searchCount’)

  • direction (Direction) (defaults to: nil)

    Sorting direction of the results: ascending or descending. (default to ‘asc’)

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the first item to return. (default to 0)

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
# File 'lib/algolia/api/analytics_client.rb', line 1113

def get_top_searches_with_http_info(index, click_analytics = nil, start_date = nil, end_date = nil, order_by = nil, direction = nil, limit = nil, offset = nil, tags = nil,
                                    request_options = {})
  # verify the required parameter 'index' is set
  if @api_client.config.client_side_validation && index.nil?
    raise ArgumentError, "Parameter `index` is required when calling `get_top_searches`."
  end
  if @api_client.config.client_side_validation && !offset.nil? && offset < 0
    raise ArgumentError, 'invalid value for ""offset"" when calling AnalyticsClient.get_top_searches, must be greater than or equal to 0.'
  end

  path = '/2/searches'
  query_params = {}
  query_params[:index] = index
  query_params[:clickAnalytics] = click_analytics unless click_analytics.nil?
  query_params[:startDate] = start_date unless start_date.nil?
  query_params[:endDate] = end_date unless end_date.nil?
  query_params[:orderBy] = order_by unless order_by.nil?
  query_params[:direction] = direction unless direction.nil?
  query_params[:limit] = limit unless limit.nil?
  query_params[:offset] = offset unless offset.nil?
  query_params[:tags] = tags unless tags.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'AnalyticsClient.get_top_searches',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_users_count(index, start_date = nil, end_date = nil, tags = nil, request_options = {}) ⇒ GetUsersCountResponse

Return the count of unique users.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetUsersCountResponse)


1221
1222
1223
1224
# File 'lib/algolia/api/analytics_client.rb', line 1221

def get_users_count(index, start_date = nil, end_date = nil, tags = nil, request_options = {})
  response = get_users_count_with_http_info(index, start_date, end_date, tags, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Analytics::GetUsersCountResponse')
end

#get_users_count_with_http_info(index, start_date = nil, end_date = nil, tags = nil, request_options = {}) ⇒ Http::Response

Return the count of unique users.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (&#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • tags (String) (defaults to: nil)

    Filter analytics on the [&#x60;analyticsTags&#x60;](www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
# File 'lib/algolia/api/analytics_client.rb', line 1182

def get_users_count_with_http_info(index, start_date = nil, end_date = nil, tags = nil, request_options = {})
  # verify the required parameter 'index' is set
  if @api_client.config.client_side_validation && index.nil?
    raise ArgumentError, "Parameter `index` is required when calling `get_users_count`."
  end

  path = '/2/users/count'
  query_params = {}
  query_params[:index] = index
  query_params[:startDate] = start_date unless start_date.nil?
  query_params[:endDate] = end_date unless end_date.nil?
  query_params[:tags] = tags unless tags.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'AnalyticsClient.get_users_count',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end