Class: Algolia::AnalyticsClient

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = nil) ⇒ AnalyticsClient

Returns a new instance of AnalyticsClient.



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

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

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



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

def api_client
  @api_client
end

Class Method Details

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



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

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

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

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

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

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

.create_with_config(config) ⇒ Object



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

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

Instance Method Details

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

Parameters:

  • path (String)

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

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

    Query parameters to apply to the current query.

  • request_options:

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

Returns:

  • (Object)


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

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

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

Returns the response.

Parameters:

  • path (String)

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

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

    Query parameters to apply to the current query.

  • request_options:

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

Returns:



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

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

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

  post_body = request_options[:debug_body]

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

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

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

Parameters:

  • path (String)

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

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

    Query parameters to apply to the current query.

  • request_options:

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

Returns:

  • (Object)


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

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

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

Returns the response.

Parameters:

  • path (String)

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

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

    Query parameters to apply to the current query.

  • request_options:

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

Returns:



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

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

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

  post_body = request_options[:debug_body]

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

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

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

Parameters:

  • path (String)

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

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

    Query parameters to apply to the current query.

  • body (Object) (defaults to: nil)

    Parameters to send with the custom request.

  • request_options:

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

Returns:

  • (Object)


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

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

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

Returns the response.

Parameters:

  • path (String)

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

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

    Query parameters to apply to the current query.

  • body (Object) (defaults to: nil)

    Parameters to send with the custom request.

  • request_options:

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

Returns:



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

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

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

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

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

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

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

Parameters:

  • path (String)

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

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

    Query parameters to apply to the current query.

  • body (Object) (defaults to: nil)

    Parameters to send with the custom request.

  • request_options:

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

Returns:

  • (Object)


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

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

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

Returns the response.

Parameters:

  • path (String)

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

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

    Query parameters to apply to the current query.

  • body (Object) (defaults to: nil)

    Parameters to send with the custom request.

  • request_options:

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

Returns:



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/algolia/api/analytics_client.rb', line 175

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

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

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

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

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

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

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


272
273
274
275
# File 'lib/algolia/api/analytics_client.rb', line 272

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

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name 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:



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

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

  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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

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


336
337
338
339
# File 'lib/algolia/api/analytics_client.rb', line 336

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

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name 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:



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
319
320
321
322
323
324
# File 'lib/algolia/api/analytics_client.rb', line 287

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

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


400
401
402
403
# File 'lib/algolia/api/analytics_client.rb', line 400

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

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name 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:



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
379
380
381
382
383
384
385
386
387
388
# File 'lib/algolia/api/analytics_client.rb', line 351

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

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


464
465
466
467
# File 'lib/algolia/api/analytics_client.rb', line 464

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

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name 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:



415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
# File 'lib/algolia/api/analytics_client.rb', line 415

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

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


528
529
530
531
# File 'lib/algolia/api/analytics_client.rb', line 528

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

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name 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:



479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
# File 'lib/algolia/api/analytics_client.rb', line 479

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

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

Required API Key ACLs:

- analytics

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)


592
593
594
595
# File 'lib/algolia/api/analytics_client.rb', line 592

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

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name 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:



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

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

Returns the number of searches within a time range.

Required API Key ACLs:

- analytics

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)


656
657
658
659
# File 'lib/algolia/api/analytics_client.rb', line 656

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

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

Returns the number of searches within a time range.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name 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:



607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
# File 'lib/algolia/api/analytics_client.rb', line 607

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

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


726
727
728
729
# File 'lib/algolia/api/analytics_client.rb', line 726

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

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name 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:



673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
# File 'lib/algolia/api/analytics_client.rb', line 673

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

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


796
797
798
799
# File 'lib/algolia/api/analytics_client.rb', line 796

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

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name 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:



743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
# File 'lib/algolia/api/analytics_client.rb', line 743

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

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


841
842
843
844
# File 'lib/algolia/api/analytics_client.rb', line 841

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

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name 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:



808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
# File 'lib/algolia/api/analytics_client.rb', line 808

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

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

  post_body = request_options[:debug_body]

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

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

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

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


911
912
913
914
# File 'lib/algolia/api/analytics_client.rb', line 911

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

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name 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:



858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
# File 'lib/algolia/api/analytics_client.rb', line 858

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

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


984
985
986
987
# File 'lib/algolia/api/analytics_client.rb', line 984

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

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name 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:



929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
# File 'lib/algolia/api/analytics_client.rb', line 929

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

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

Required API Key ACLs:

- analytics

Parameters:

  • attribute (String)

    Attribute name. (required)

  • index (String)

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


1063
1064
1065
1066
# File 'lib/algolia/api/analytics_client.rb', line 1063

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

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

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

Required API Key ACLs:

- analytics

Parameters:

  • attribute (String)

    Attribute name. (required)

  • index (String)

    Index name 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:



1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
# File 'lib/algolia/api/analytics_client.rb', line 1003

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' + '}', Transport.encode_uri(attribute.to_s))
  query_params = {}
  query_params[:index] = index
  query_params[:search] = search unless search.nil?
  query_params[:startDate] = start_date unless start_date.nil?
  query_params[:endDate] = end_date unless end_date.nil?
  query_params[:limit] = limit unless limit.nil?
  query_params[:offset] = offset unless offset.nil?
  query_params[:tags] = tags unless tags.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

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

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

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

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


1136
1137
1138
1139
# File 'lib/algolia/api/analytics_client.rb', line 1136

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

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name 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:



1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
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
# File 'lib/algolia/api/analytics_client.rb', line 1081

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

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

Required API Key ACLs:

- analytics

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)


1212
1213
1214
1215
# File 'lib/algolia/api/analytics_client.rb', line 1212

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

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name 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:



1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
# File 'lib/algolia/api/analytics_client.rb', line 1155

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

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


1292
1293
1294
1295
1296
# File 'lib/algolia/api/analytics_client.rb', line 1292

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

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name 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:



1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
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
# File 'lib/algolia/api/analytics_client.rb', line 1232

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

Return the count of unique users.

Required API Key ACLs:

- analytics

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)


1357
1358
1359
1360
# File 'lib/algolia/api/analytics_client.rb', line 1357

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

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

Return the count of unique users.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name 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:



1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
# File 'lib/algolia/api/analytics_client.rb', line 1308

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