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

Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.

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)
  deserialize(response.body, request_options[:debug_return_type] || 'Object')
end

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

Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.

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

Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.

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)
  deserialize(response.body, request_options[:debug_return_type] || 'Object')
end

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

Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.

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

Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.

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)
  deserialize(response.body, request_options[:debug_return_type] || 'Object')
end

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

Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.

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

Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.

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)
  deserialize(response.body, request_options[:debug_return_type] || 'Object')
end

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

Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.

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

Get average click position. 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`.

Parameters:

  • index (String)

    Index name to target. (required)

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

    End date (a string in the format &#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)


268
269
270
271
# File 'lib/algolia/api/analytics_client.rb', line 268

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)
  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

Get average click position. 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;.

Parameters:

  • index (String)

    Index name to target. (required)

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

    End date (a string in the format &#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:



221
222
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
251
252
253
254
255
256
257
258
# File 'lib/algolia/api/analytics_client.rb', line 221

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

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !start_date.nil? && start_date !~ pattern
    raise ArgumentError, "invalid value for '\"start_date\"' when calling AnalyticsClient.get_average_click_position, must conform to the pattern #{pattern}."
  end

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !end_date.nil? && end_date !~ pattern
    raise ArgumentError, "invalid value for '\"end_date\"' when calling AnalyticsClient.get_average_click_position, must conform to the pattern #{pattern}."
  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

Get click positions. 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`.

Parameters:

  • index (String)

    Index name to target. (required)

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

    End date (a string in the format &#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)


328
329
330
331
# File 'lib/algolia/api/analytics_client.rb', line 328

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)
  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

Get click positions. 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;.

Parameters:

  • index (String)

    Index name to target. (required)

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

    End date (a string in the format &#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:



281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/algolia/api/analytics_client.rb', line 281

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

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !start_date.nil? && start_date !~ pattern
    raise ArgumentError, "invalid value for '\"start_date\"' when calling AnalyticsClient.get_click_positions, must conform to the pattern #{pattern}."
  end

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !end_date.nil? && end_date !~ pattern
    raise ArgumentError, "invalid value for '\"end_date\"' when calling AnalyticsClient.get_click_positions, must conform to the pattern #{pattern}."
  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

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

Parameters:

  • index (String)

    Index name to target. (required)

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

    End date (a string in the format &#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)


388
389
390
391
# File 'lib/algolia/api/analytics_client.rb', line 388

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)
  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

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

Parameters:

  • index (String)

    Index name to target. (required)

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

    End date (a string in the format &#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:



341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
# File 'lib/algolia/api/analytics_client.rb', line 341

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

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !start_date.nil? && start_date !~ pattern
    raise ArgumentError, "invalid value for '\"start_date\"' when calling AnalyticsClient.get_click_through_rate, must conform to the pattern #{pattern}."
  end

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !end_date.nil? && end_date !~ pattern
    raise ArgumentError, "invalid value for '\"end_date\"' when calling AnalyticsClient.get_click_through_rate, must conform to the pattern #{pattern}."
  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

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

Parameters:

  • index (String)

    Index name to target. (required)

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

    End date (a string in the format &#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)


448
449
450
451
# File 'lib/algolia/api/analytics_client.rb', line 448

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)
  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

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

Parameters:

  • index (String)

    Index name to target. (required)

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

    End date (a string in the format &#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:



401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
# File 'lib/algolia/api/analytics_client.rb', line 401

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

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !start_date.nil? && start_date !~ pattern
    raise ArgumentError, "invalid value for '\"start_date\"' when calling AnalyticsClient.get_conversation_rate, must conform to the pattern #{pattern}."
  end

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !end_date.nil? && end_date !~ pattern
    raise ArgumentError, "invalid value for '\"end_date\"' when calling AnalyticsClient.get_conversation_rate, must conform to the pattern #{pattern}."
  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

Get no click rate. 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.

Parameters:

  • index (String)

    Index name to target. (required)

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

    End date (a string in the format &#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)


508
509
510
511
# File 'lib/algolia/api/analytics_client.rb', line 508

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)
  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

Get no click rate. 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.

Parameters:

  • index (String)

    Index name to target. (required)

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

    End date (a string in the format &#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:



461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
# File 'lib/algolia/api/analytics_client.rb', line 461

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

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !start_date.nil? && start_date !~ pattern
    raise ArgumentError, "invalid value for '\"start_date\"' when calling AnalyticsClient.get_no_click_rate, must conform to the pattern #{pattern}."
  end

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !end_date.nil? && end_date !~ pattern
    raise ArgumentError, "invalid value for '\"end_date\"' when calling AnalyticsClient.get_no_click_rate, must conform to the pattern #{pattern}."
  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

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

Parameters:

  • index (String)

    Index name to target. (required)

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

    End date (a string in the format &#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)


568
569
570
571
# File 'lib/algolia/api/analytics_client.rb', line 568

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)
  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

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

Parameters:

  • index (String)

    Index name to target. (required)

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

    End date (a string in the format &#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:



521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
# File 'lib/algolia/api/analytics_client.rb', line 521

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

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !start_date.nil? && start_date !~ pattern
    raise ArgumentError, "invalid value for '\"start_date\"' when calling AnalyticsClient.get_no_results_rate, must conform to the pattern #{pattern}."
  end

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !end_date.nil? && end_date !~ pattern
    raise ArgumentError, "invalid value for '\"end_date\"' when calling AnalyticsClient.get_no_results_rate, must conform to the pattern #{pattern}."
  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

Get number of searches. Returns the number of searches within a time range.

Parameters:

  • index (String)

    Index name to target. (required)

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

    End date (a string in the format &#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)


628
629
630
631
# File 'lib/algolia/api/analytics_client.rb', line 628

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)
  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

Get number of searches. Returns the number of searches within a time range.

Parameters:

  • index (String)

    Index name to target. (required)

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

    End date (a string in the format &#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:



581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
# File 'lib/algolia/api/analytics_client.rb', line 581

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

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !start_date.nil? && start_date !~ pattern
    raise ArgumentError, "invalid value for '\"start_date\"' when calling AnalyticsClient.get_searches_count, must conform to the pattern #{pattern}."
  end

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !end_date.nil? && end_date !~ pattern
    raise ArgumentError, "invalid value for '\"end_date\"' when calling AnalyticsClient.get_searches_count, must conform to the pattern #{pattern}."
  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

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

Parameters:

  • index (String)

    Index name to target. (required)

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

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

  • limit (Integer) (defaults to: nil)

    Number of records to return (page size). (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the starting record. Used for paging. 0 is the first record. (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)


694
695
696
697
# File 'lib/algolia/api/analytics_client.rb', line 694

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)
  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

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

Parameters:

  • index (String)

    Index name to target. (required)

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

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

  • limit (Integer) (defaults to: nil)

    Number of records to return (page size). (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the starting record. Used for paging. 0 is the first record. (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:



643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
# File 'lib/algolia/api/analytics_client.rb', line 643

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

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !start_date.nil? && start_date !~ pattern
    raise ArgumentError, "invalid value for '\"start_date\"' when calling AnalyticsClient.get_searches_no_clicks, must conform to the pattern #{pattern}."
  end

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !end_date.nil? && end_date !~ pattern
    raise ArgumentError, "invalid value for '\"end_date\"' when calling AnalyticsClient.get_searches_no_clicks, must conform to the pattern #{pattern}."
  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

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

Parameters:

  • index (String)

    Index name to target. (required)

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

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

  • limit (Integer) (defaults to: nil)

    Number of records to return (page size). (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the starting record. Used for paging. 0 is the first record. (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)


760
761
762
763
# File 'lib/algolia/api/analytics_client.rb', line 760

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)
  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

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

Parameters:

  • index (String)

    Index name to target. (required)

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

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

  • limit (Integer) (defaults to: nil)

    Number of records to return (page size). (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the starting record. Used for paging. 0 is the first record. (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:



709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
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 709

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

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !start_date.nil? && start_date !~ pattern
    raise ArgumentError, "invalid value for '\"start_date\"' when calling AnalyticsClient.get_searches_no_results, must conform to the pattern #{pattern}."
  end

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !end_date.nil? && end_date !~ pattern
    raise ArgumentError, "invalid value for '\"end_date\"' when calling AnalyticsClient.get_searches_no_results, must conform to the pattern #{pattern}."
  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

Get Analytics API status. 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.

Parameters:

  • index (String)

    Index name to target. (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)


801
802
803
804
# File 'lib/algolia/api/analytics_client.rb', line 801

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

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

Get Analytics API status. 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.

Parameters:

  • index (String)

    Index name to target. (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:



770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
# File 'lib/algolia/api/analytics_client.rb', line 770

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

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

Parameters:

  • index (String)

    Index name to target. (required)

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

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

  • limit (Integer) (defaults to: nil)

    Number of records to return (page size). (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the starting record. Used for paging. 0 is the first record. (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)


867
868
869
870
# File 'lib/algolia/api/analytics_client.rb', line 867

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)
  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

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

Parameters:

  • index (String)

    Index name to target. (required)

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

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

  • limit (Integer) (defaults to: nil)

    Number of records to return (page size). (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the starting record. Used for paging. 0 is the first record. (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:



816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
# File 'lib/algolia/api/analytics_client.rb', line 816

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

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !start_date.nil? && start_date !~ pattern
    raise ArgumentError, "invalid value for '\"start_date\"' when calling AnalyticsClient.get_top_countries, must conform to the pattern #{pattern}."
  end

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !end_date.nil? && end_date !~ pattern
    raise ArgumentError, "invalid value for '\"end_date\"' when calling AnalyticsClient.get_top_countries, must conform to the pattern #{pattern}."
  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

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

Parameters:

  • index (String)

    Index name to target. (required)

  • search (String) (defaults to: nil)

    User query.

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

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

  • limit (Integer) (defaults to: nil)

    Number of records to return (page size). (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the starting record. Used for paging. 0 is the first record. (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)


936
937
938
939
# File 'lib/algolia/api/analytics_client.rb', line 936

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)
  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

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

Parameters:

  • index (String)

    Index name to target. (required)

  • search (String) (defaults to: nil)

    User query.

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

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

  • limit (Integer) (defaults to: nil)

    Number of records to return (page size). (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the starting record. Used for paging. 0 is the first record. (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:



883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
# File 'lib/algolia/api/analytics_client.rb', line 883

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

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !start_date.nil? && start_date !~ pattern
    raise ArgumentError, "invalid value for '\"start_date\"' when calling AnalyticsClient.get_top_filter_attributes, must conform to the pattern #{pattern}."
  end

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !end_date.nil? && end_date !~ pattern
    raise ArgumentError, "invalid value for '\"end_date\"' when calling AnalyticsClient.get_top_filter_attributes, must conform to the pattern #{pattern}."
  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

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

Parameters:

  • attribute (String)

    Attribute name. (required)

  • index (String)

    Index name to target. (required)

  • search (String) (defaults to: nil)

    User query.

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

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

  • limit (Integer) (defaults to: nil)

    Number of records to return (page size). (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the starting record. Used for paging. 0 is the first record. (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)


1011
1012
1013
1014
# File 'lib/algolia/api/analytics_client.rb', line 1011

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)
  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

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

Parameters:

  • attribute (String)

    Attribute name. (required)

  • index (String)

    Index name to target. (required)

  • search (String) (defaults to: nil)

    User query.

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

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

  • limit (Integer) (defaults to: nil)

    Number of records to return (page size). (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the starting record. Used for paging. 0 is the first record. (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:



953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
# File 'lib/algolia/api/analytics_client.rb', line 953

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

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !start_date.nil? && start_date !~ pattern
    raise ArgumentError, "invalid value for '\"start_date\"' when calling AnalyticsClient.get_top_filter_for_attribute, must conform to the pattern #{pattern}."
  end

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !end_date.nil? && end_date !~ pattern
    raise ArgumentError, "invalid value for '\"end_date\"' when calling AnalyticsClient.get_top_filter_for_attribute, must conform to the pattern #{pattern}."
  end

  path = '/2/filters/{attribute}'.sub('{' + 'attribute' + '}', @api_client.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

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

Parameters:

  • index (String)

    Index name to target. (required)

  • search (String) (defaults to: nil)

    User query.

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

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

  • limit (Integer) (defaults to: nil)

    Number of records to return (page size). (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the starting record. Used for paging. 0 is the first record. (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)


1080
1081
1082
1083
# File 'lib/algolia/api/analytics_client.rb', line 1080

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)
  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

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

Parameters:

  • index (String)

    Index name to target. (required)

  • search (String) (defaults to: nil)

    User query.

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

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

  • limit (Integer) (defaults to: nil)

    Number of records to return (page size). (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the starting record. Used for paging. 0 is the first record. (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:



1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
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
# File 'lib/algolia/api/analytics_client.rb', line 1027

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

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !start_date.nil? && start_date !~ pattern
    raise ArgumentError, "invalid value for '\"start_date\"' when calling AnalyticsClient.get_top_filters_no_results, must conform to the pattern #{pattern}."
  end

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !end_date.nil? && end_date !~ pattern
    raise ArgumentError, "invalid value for '\"end_date\"' when calling AnalyticsClient.get_top_filters_no_results, must conform to the pattern #{pattern}."
  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

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

Parameters:

  • index (String)

    Index name to target. (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 (a string in the format &#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

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

  • limit (Integer) (defaults to: nil)

    Number of records to return (page size). (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the starting record. Used for paging. 0 is the first record. (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)


1152
1153
1154
1155
# File 'lib/algolia/api/analytics_client.rb', line 1152

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)
  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

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

Parameters:

  • index (String)

    Index name to target. (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 (a string in the format &#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

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

  • limit (Integer) (defaults to: nil)

    Number of records to return (page size). (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the starting record. Used for paging. 0 is the first record. (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:



1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
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
# File 'lib/algolia/api/analytics_client.rb', line 1097

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

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !start_date.nil? && start_date !~ pattern
    raise ArgumentError, "invalid value for '\"start_date\"' when calling AnalyticsClient.get_top_hits, must conform to the pattern #{pattern}."
  end

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !end_date.nil? && end_date !~ pattern
    raise ArgumentError, "invalid value for '\"end_date\"' when calling AnalyticsClient.get_top_hits, must conform to the pattern #{pattern}."
  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

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

Parameters:

  • index (String)

    Index name to target. (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 (a string in the format &#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (a string in the format &#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 records to return (page size). (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the starting record. Used for paging. 0 is the first record. (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)


1228
1229
1230
1231
1232
# File 'lib/algolia/api/analytics_client.rb', line 1228

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)
  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

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

Parameters:

  • index (String)

    Index name to target. (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 (a string in the format &#x60;YYYY-MM-DD&#x60;) of the period to analyze.

  • end_date (String) (defaults to: nil)

    End date (a string in the format &#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 records to return (page size). (default to 10)

  • offset (Integer) (defaults to: nil)

    Position of the starting record. Used for paging. 0 is the first record. (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:



1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
# File 'lib/algolia/api/analytics_client.rb', line 1170

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

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !start_date.nil? && start_date !~ pattern
    raise ArgumentError, "invalid value for '\"start_date\"' when calling AnalyticsClient.get_top_searches, must conform to the pattern #{pattern}."
  end

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !end_date.nil? && end_date !~ pattern
    raise ArgumentError, "invalid value for '\"end_date\"' when calling AnalyticsClient.get_top_searches, must conform to the pattern #{pattern}."
  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

Get user count. Return the count of unique users.

Parameters:

  • index (String)

    Index name to target. (required)

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

    End date (a string in the format &#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)


1289
1290
1291
1292
# File 'lib/algolia/api/analytics_client.rb', line 1289

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)
  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

Get user count. Return the count of unique users.

Parameters:

  • index (String)

    Index name to target. (required)

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

    End date (a string in the format &#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:



1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
# File 'lib/algolia/api/analytics_client.rb', line 1242

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

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !start_date.nil? && start_date !~ pattern
    raise ArgumentError, "invalid value for '\"start_date\"' when calling AnalyticsClient.get_users_count, must conform to the pattern #{pattern}."
  end

  pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
  if @api_client.config.client_side_validation && !end_date.nil? && end_date !~ pattern
    raise ArgumentError, "invalid value for '\"end_date\"' when calling AnalyticsClient.get_users_count, must conform to the pattern #{pattern}."
  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