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.



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

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.



7
8
9
# File 'lib/algolia/api/analytics_client.rb', line 7

def api_client
  @api_client
end

Class Method Details

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



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/algolia/api/analytics_client.rb', line 17

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

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

  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



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/algolia/api/analytics_client.rb', line 40

def self.create_with_config(config)
  if config.connect_timeout.nil?
    config.connect_timeout = 2000
  end

  if config.read_timeout.nil?
    config.read_timeout = 5000
  end

  if config.write_timeout.nil?
    config.write_timeout = 30000
  end

  new(config)
end

Instance Method Details

#add_user_agent_segment(segment, version = nil) ⇒ Object



66
67
68
69
70
# File 'lib/algolia/api/analytics_client.rb', line 66

def add_user_agent_segment(segment, version = nil)
  @api_client.config.add_user_agent_segment(segment, version)

  self
end

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

Parameters:

  • path (String)

    Path of the endpoint, for example ‘1/newFeature`. (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)


110
111
112
113
# File 'lib/algolia/api/analytics_client.rb', line 110

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, for example ‘1/newFeature`. (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:



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/algolia/api/analytics_client.rb', line 78

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 = "/{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, for example ‘1/newFeature`. (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)


153
154
155
156
# File 'lib/algolia/api/analytics_client.rb', line 153

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, for example ‘1/newFeature`. (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:



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/algolia/api/analytics_client.rb', line 121

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 = "/{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, for example ‘1/newFeature`. (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)


198
199
200
201
# File 'lib/algolia/api/analytics_client.rb', line 198

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, for example ‘1/newFeature`. (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:



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/algolia/api/analytics_client.rb', line 165

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 = "/{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, for example ‘1/newFeature`. (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)


243
244
245
246
# File 'lib/algolia/api/analytics_client.rb', line 243

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, for example ‘1/newFeature`. (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:



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/algolia/api/analytics_client.rb', line 210

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 = "/{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_add_to_cart_rate(index, start_date = nil, end_date = nil, tags = nil, request_options = {}) ⇒ GetAddToCartRateResponse

Retrieves the add-to-cart rate for all your searches with at least one add-to-cart event, including a daily breakdown. By default, the analyzed period includes the last eight days including the current day. The rate is the number of add-to-cart conversion events divided by the number of tracked searches. A search is tracked if it returns a queryID (‘clickAnalytics` is `true`). This differs from the response’s ‘count`, which shows the overall number of searches, including those where `clickAnalytics` is `false`. **There’s a difference between a 0 and null add-to-cart rate when ‘clickAnalytics` is enabled:** - Null means there were no queries: since Algolia didn’t receive any events, the add-to-cart rate is null. - 0 mean there were queries but no [add-to-cart events](www.algolia.com/doc/guides/sending-events/getting-started/) were received.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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

  • (GetAddToCartRateResponse)


297
298
299
300
301
302
303
# File 'lib/algolia/api/analytics_client.rb', line 297

def get_add_to_cart_rate(index, start_date = nil, end_date = nil, tags = nil, request_options = {})
  response = get_add_to_cart_rate_with_http_info(index, start_date, end_date, tags, request_options)
  @api_client.deserialize(
    response.body,
    request_options[:debug_return_type] || "Analytics::GetAddToCartRateResponse"
  )
end

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

Retrieves the add-to-cart rate for all your searches with at least one add-to-cart event, including a daily breakdown. By default, the analyzed period includes the last eight days including the current day. The rate is the number of add-to-cart conversion events divided by the number of tracked searches. A search is tracked if it returns a queryID (‘clickAnalytics` is `true`). This differs from the response’s ‘count`, which shows the overall number of searches, including those where `clickAnalytics` is `false`. **There’s a difference between a 0 and null add-to-cart rate when ‘clickAnalytics` is enabled:** - Null means there were no queries: since Algolia didn’t receive any events, the add-to-cart rate is null. - 0 mean there were queries but no [add-to-cart events](www.algolia.com/doc/guides/sending-events/getting-started/) were received.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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



258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/algolia/api/analytics_client.rb', line 258

def get_add_to_cart_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_add_to_cart_rate`."
  end

  path = "/2/conversions/addToCartRate"
  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_add_to_cart_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_average_click_position(index, start_date = nil, end_date = nil, tags = nil, request_options = {}) ⇒ GetAverageClickPositionResponse

Retrieves the average click position of your search results, including a daily breakdown. The average click position is the average of all clicked search result positions. For example, if users only ever click on the first result for any search, the average click position is 1. By default, the analyzed period includes the last eight days including the current day. An average of ‘null` when `clickAnalytics` is enabled means Algolia didn’t receive any [click events](www.algolia.com/doc/guides/sending-events/getting-started/) for the queries. The average is ‘null` until Algolia receives at least one click event.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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


360
361
362
363
364
365
366
# File 'lib/algolia/api/analytics_client.rb', line 360

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

Retrieves the average click position of your search results, including a daily breakdown. The average click position is the average of all clicked search result positions. For example, if users only ever click on the first result for any search, the average click position is 1. By default, the analyzed period includes the last eight days including the current day. An average of ‘null` when `clickAnalytics` is enabled means Algolia didn’t receive any [click events](www.algolia.com/doc/guides/sending-events/getting-started/) for the queries. The average is ‘null` until Algolia receives at least one click event.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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



315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
# File 'lib/algolia/api/analytics_client.rb', line 315

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

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

  post_body = request_options[:debug_body]

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

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

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

Retrieves the positions in the search results and their associated number of clicks. This lets you check how many clicks the first, second, or tenth search results receive. An average of ‘0` when `clickAnalytics` is enabled means Algolia didn’t receive any [click events](www.algolia.com/doc/guides/sending-events/getting-started/) for the queries.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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


417
418
419
420
421
422
423
# File 'lib/algolia/api/analytics_client.rb', line 417

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

Retrieves the positions in the search results and their associated number of clicks. This lets you check how many clicks the first, second, or tenth search results receive. An average of ‘0` when `clickAnalytics` is enabled means Algolia didn’t receive any [click events](www.algolia.com/doc/guides/sending-events/getting-started/) for the queries.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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



378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
# File 'lib/algolia/api/analytics_client.rb', line 378

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

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

  post_body = request_options[:debug_body]

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

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

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

Retrieves the click-through rate (CTR) for all your searches with at least one click event, including a daily breakdown. By default, the analyzed period includes the last eight days including the current day. **There’s a difference between a 0 and null CTR when ‘clickAnalytics` is enabled:** - Null means there were no queries: since Algolia didn’t receive any events, CTR is null. - 0 mean there were queries but no [click events](www.algolia.com/doc/guides/sending-events/getting-started/) were received.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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


474
475
476
477
478
479
480
# File 'lib/algolia/api/analytics_client.rb', line 474

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

Retrieves the click-through rate (CTR) for all your searches with at least one click event, including a daily breakdown. By default, the analyzed period includes the last eight days including the current day. **There’s a difference between a 0 and null CTR when ‘clickAnalytics` is enabled:** - Null means there were no queries: since Algolia didn’t receive any events, CTR is null. - 0 mean there were queries but no [click events](www.algolia.com/doc/guides/sending-events/getting-started/) were received.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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



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

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

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

  post_body = request_options[:debug_body]

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

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

#get_conversion_rate(index, start_date = nil, end_date = nil, tags = nil, request_options = {}) ⇒ GetConversionRateResponse

Retrieves the conversion rate (CR) for all your searches with at least one conversion event, including a daily breakdown. By default, the analyzed period includes the last eight days including the current day. **There’s a difference between a 0 and null CR when ‘clickAnalytics` is enabled:** - Null means there were no queries: since Algolia didn’t receive any events, CR is null. - 0 mean there were queries but no [conversion events](www.algolia.com/doc/guides/sending-events/getting-started/) were received.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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

  • (GetConversionRateResponse)


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

def get_conversion_rate(index, start_date = nil, end_date = nil, tags = nil, request_options = {})
  response = get_conversion_rate_with_http_info(index, start_date, end_date, tags, request_options)
  @api_client.deserialize(
    response.body,
    request_options[:debug_return_type] || "Analytics::GetConversionRateResponse"
  )
end

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

Retrieves the conversion rate (CR) for all your searches with at least one conversion event, including a daily breakdown. By default, the analyzed period includes the last eight days including the current day. **There’s a difference between a 0 and null CR when ‘clickAnalytics` is enabled:** - Null means there were no queries: since Algolia didn’t receive any events, CR is null. - 0 mean there were queries but no [conversion events](www.algolia.com/doc/guides/sending-events/getting-started/) were received.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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



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

def get_conversion_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_conversion_rate`."
  end

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

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :"AnalyticsClient.get_conversion_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

Retrieves the fraction of searches that didn’t lead to any click within a time range, including a daily breakdown. It also returns the number of tracked searches and tracked searches without clicks. By default, the analyzed period includes the last eight days including the current day.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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


588
589
590
591
# File 'lib/algolia/api/analytics_client.rb', line 588

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

Retrieves the fraction of searches that didn’t lead to any click within a time range, including a daily breakdown. It also returns the number of tracked searches and tracked searches without clicks. By default, the analyzed period includes the last eight days including the current day.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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



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

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

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

  post_body = request_options[:debug_body]

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

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

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

Retrieves the fraction of searches that didn’t return any results within a time range, including a daily breakdown. It also returns the count of searches and searches without results used to compute the rates. By default, the analyzed period includes the last eight days including the current day.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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


642
643
644
645
646
647
648
# File 'lib/algolia/api/analytics_client.rb', line 642

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

Retrieves the fraction of searches that didn’t return any results within a time range, including a daily breakdown. It also returns the count of searches and searches without results used to compute the rates. By default, the analyzed period includes the last eight days including the current day.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

  • request_options:

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

Returns:



603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
# File 'lib/algolia/api/analytics_client.rb', line 603

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

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

  post_body = request_options[:debug_body]

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

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

#get_purchase_rate(index, start_date = nil, end_date = nil, tags = nil, request_options = {}) ⇒ GetPurchaseRateResponse

Retrieves the purchase rate for all your searches with at least one purchase event, including a daily breakdown. By default, the analyzed period includes the last eight days including the current day. The rate is the number of purchase conversion events divided by the number of tracked searches. A search is tracked if it returns a query ID (‘clickAnalytics` is `true`). This differs from the response’s ‘count`, which shows the overall number of searches, including those where `clickAnalytics` is `false`. **There’s a difference between a 0 and null purchase rate when ‘clickAnalytics` is enabled:** - Null means there were no queries: since Algolia didn’t receive any events, the purchase rate is null. - 0 mean there were queries but no [purchase conversion events](www.algolia.com/doc/guides/sending-events/getting-started/) were received.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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

  • (GetPurchaseRateResponse)


699
700
701
702
703
704
705
# File 'lib/algolia/api/analytics_client.rb', line 699

def get_purchase_rate(index, start_date = nil, end_date = nil, tags = nil, request_options = {})
  response = get_purchase_rate_with_http_info(index, start_date, end_date, tags, request_options)
  @api_client.deserialize(
    response.body,
    request_options[:debug_return_type] || "Analytics::GetPurchaseRateResponse"
  )
end

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

Retrieves the purchase rate for all your searches with at least one purchase event, including a daily breakdown. By default, the analyzed period includes the last eight days including the current day. The rate is the number of purchase conversion events divided by the number of tracked searches. A search is tracked if it returns a query ID (‘clickAnalytics` is `true`). This differs from the response’s ‘count`, which shows the overall number of searches, including those where `clickAnalytics` is `false`. **There’s a difference between a 0 and null purchase rate when ‘clickAnalytics` is enabled:** - Null means there were no queries: since Algolia didn’t receive any events, the purchase rate is null. - 0 mean there were queries but no [purchase conversion events](www.algolia.com/doc/guides/sending-events/getting-started/) were received.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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



660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
# File 'lib/algolia/api/analytics_client.rb', line 660

def get_purchase_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_purchase_rate`."
  end

  path = "/2/conversions/purchaseRate"
  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_purchase_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_revenue(index, start_date = nil, end_date = nil, tags = nil, request_options = {}) ⇒ GetRevenue

Retrieves revenue-related metrics, such as the total revenue or the average order value. To retrieve revenue-related metrics, send purchase events. By default, the analyzed period includes the last eight days including the current day. Revenue is based on purchase conversion events (a conversion event with an ‘eventSubtype` attribute of `purchase`). The revenue is the `price` attribute multiplied by the `quantity` attribute for each object in the event’s ‘objectData` array.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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

  • (GetRevenue)


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

def get_revenue(index, start_date = nil, end_date = nil, tags = nil, request_options = {})
  response = get_revenue_with_http_info(index, start_date, end_date, tags, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Analytics::GetRevenue")
end

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

Retrieves revenue-related metrics, such as the total revenue or the average order value. To retrieve revenue-related metrics, send purchase events. By default, the analyzed period includes the last eight days including the current day. Revenue is based on purchase conversion events (a conversion event with an ‘eventSubtype` attribute of `purchase`). The revenue is the `price` attribute multiplied by the `quantity` attribute for each object in the event’s ‘objectData` array.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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



717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
# File 'lib/algolia/api/analytics_client.rb', line 717

def get_revenue_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_revenue`."
  end

  path = "/2/conversions/revenue"
  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_revenue",
    :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

Retrieves the number of searches within a time range, including a daily breakdown. By default, the analyzed period includes the last eight days including the current day.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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


810
811
812
813
814
815
816
# File 'lib/algolia/api/analytics_client.rb', line 810

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

Retrieves the number of searches within a time range, including a daily breakdown. By default, the analyzed period includes the last eight days including the current day.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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



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

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

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

  post_body = request_options[:debug_body]

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

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

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

Retrieves the most popular searches that didn’t lead to any clicks, from the 1,000 most frequent searches. For each search, it also returns the number of displayed search results that remained unclicked.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

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

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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


881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
# File 'lib/algolia/api/analytics_client.rb', line 881

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

Retrieves the most popular searches that didn’t lead to any clicks, from the 1,000 most frequent searches. For each search, it also returns the number of displayed search results that remained unclicked.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

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

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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



830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
# File 'lib/algolia/api/analytics_client.rb', line 830

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

  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

Retrieves the 1,000 most frequent searches that produced zero results.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

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

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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


968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
# File 'lib/algolia/api/analytics_client.rb', line 968

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

Retrieves the 1,000 most frequent searches that produced zero results.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

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

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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



917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
# File 'lib/algolia/api/analytics_client.rb', line 917

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

  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

Retrieves the time when the Analytics data for the specified index was last updated. If the index has been recently created or no search has been performed yet the updated time is ‘null`. The Analytics data is updated every 5&nbsp;minutes.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • request_options:

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

Returns:

  • (GetStatusResponse)


1032
1033
1034
1035
# File 'lib/algolia/api/analytics_client.rb', line 1032

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

Retrieves the time when the Analytics data for the specified index was last updated. If the index has been recently created or no search has been performed yet the updated time is ‘null`. The Analytics data is updated every 5&nbsp;minutes.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • request_options:

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

Returns:



999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
# File 'lib/algolia/api/analytics_client.rb', line 999

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

Retrieves the countries with the most searches in your index.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

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

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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


1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
# File 'lib/algolia/api/analytics_client.rb', line 1100

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

Retrieves the countries with the most searches in your index.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

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

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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



1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
# File 'lib/algolia/api/analytics_client.rb', line 1049

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

  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

Retrieves the 1,000 most frequently used filter attributes. These are attributes of your records that you included in the ‘attributesForFaceting` setting.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • search (String) (defaults to: nil)

    Search query.

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

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

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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


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

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

Retrieves the 1,000 most frequently used filter attributes. These are attributes of your records that you included in the ‘attributesForFaceting` setting.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • search (String) (defaults to: nil)

    Search query.

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

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

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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



1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
# File 'lib/algolia/api/analytics_client.rb', line 1129

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

  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

Retrieves the 1,000 most frequent filter (facet) values for a filter attribute. These are attributes of your records that you included in the ‘attributesForFaceting` setting.

Required API Key ACLs:

- analytics

Parameters:

  • attribute (String)

    Attribute name. (required)

  • index (String)

    Index name. (required)

  • search (String) (defaults to: nil)

    Search query.

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

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

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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


1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
# File 'lib/algolia/api/analytics_client.rb', line 1283

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

Retrieves the 1,000 most frequent filter (facet) values for a filter attribute. These are attributes of your records that you included in the ‘attributesForFaceting` setting.

Required API Key ACLs:

- analytics

Parameters:

  • attribute (String)

    Attribute name. (required)

  • index (String)

    Index name. (required)

  • search (String) (defaults to: nil)

    Search query.

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

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

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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



1223
1224
1225
1226
1227
1228
1229
1230
1231
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
# File 'lib/algolia/api/analytics_client.rb', line 1223

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

  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

Retrieves the 1,000 most frequently used filters for a search that didn’t return any results. To get the most frequent searches without results, use the [Retrieve searches without results](#tag/search/operation/getSearchesNoResults) operation.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • search (String) (defaults to: nil)

    Search query.

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

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

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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


1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
# File 'lib/algolia/api/analytics_client.rb', line 1378

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

Retrieves the 1,000 most frequently used filters for a search that didn’t return any results. To get the most frequent searches without results, use the [Retrieve searches without results](#tag/search/operation/getSearchesNoResults) operation.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • search (String) (defaults to: nil)

    Search query.

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

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

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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



1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
# File 'lib/algolia/api/analytics_client.rb', line 1324

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

  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, revenue_analytics = nil, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {}) ⇒ GetTopHitsResponse

Retrieves the object IDs of the 1,000 most frequent search results. If you set the ‘clickAnalytics` query parameter to true, the response also includes: - Tracked searches count. Tracked searches are Search API requests with the `clickAnalytics` parameter set to `true`. This differs from the response’s ‘count`, which shows the overall number of searches, including those where `clickAnalytics` is `false`. - Click count - Click-through rate (CTR) - Conversion count - Conversion rate (CR) - Average click position If you set the `revenueAnalytics` parameter to `true`, the response also includes: - Add-to-cart count - Add-to-cart rate (ATCR) - Purchase count - Purchase rate - Revenue details for each currency **There’s a difference between 0% rates and null rates:** - Null means there were no queries: since Algolia didn’t receive any events, the rates (CTR, CR, ATCR, purchase rate) are null. - **0% rates** mean there were queries but no [click or conversion events](www.algolia.com/doc/guides/sending-events/getting-started/) were received.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • search (String) (defaults to: nil)

    Search query.

  • click_analytics (Boolean) (defaults to: nil)

    Whether to include metrics related to click and conversion events in the response. (default to false)

  • revenue_analytics (Boolean) (defaults to: nil)

    Whether to include metrics related to revenue events in the response. (default to false)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

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

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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


1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
# File 'lib/algolia/api/analytics_client.rb', line 1479

def get_top_hits(
  index,
  search = nil,
  click_analytics = nil,
  revenue_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,
    revenue_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, revenue_analytics = nil, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {}) ⇒ Http::Response

Retrieves the object IDs of the 1,000 most frequent search results. If you set the ‘clickAnalytics` query parameter to true, the response also includes: - Tracked searches count. Tracked searches are Search API requests with the `clickAnalytics` parameter set to `true`. This differs from the response’s ‘count`, which shows the overall number of searches, including those where `clickAnalytics` is `false`. - Click count - Click-through rate (CTR) - Conversion count - Conversion rate (CR) - Average click position If you set the `revenueAnalytics` parameter to `true`, the response also includes: - Add-to-cart count - Add-to-cart rate (ATCR) - Purchase count - Purchase rate - Revenue details for each currency **There’s a difference between 0% rates and null rates:** - Null means there were no queries: since Algolia didn’t receive any events, the rates (CTR, CR, ATCR, purchase rate) are null. - **0% rates** mean there were queries but no [click or conversion events](www.algolia.com/doc/guides/sending-events/getting-started/) were received.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • search (String) (defaults to: nil)

    Search query.

  • click_analytics (Boolean) (defaults to: nil)

    Whether to include metrics related to click and conversion events in the response. (default to false)

  • revenue_analytics (Boolean) (defaults to: nil)

    Whether to include metrics related to revenue events in the response. (default to false)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

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

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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



1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
# File 'lib/algolia/api/analytics_client.rb', line 1419

def get_top_hits_with_http_info(
  index,
  search = nil,
  click_analytics = nil,
  revenue_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

  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[:revenueAnalytics] = revenue_analytics unless revenue_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, revenue_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 searches. For each search, it also includes the average number of hits. If you set the ‘clickAnalytics` query parameter to `true`, the response also includes - Tracked searches count. Tracked searches are Search API requests with the `clickAnalytics` parameter set to `true`. This differs from the response’s ‘count`, which shows the overall number of searches, including those where `clickAnalytics` is `false`. - Click count - Click-through rate (CTR) - Conversion count - Conversion rate (CR) - Average click position If you set the `revenueAnalytics` query parameter to `true`, the response also includes: - Add-to-cart count - Add-to-cart rate (ATCR) - Purchase count - Purchase rate - Revenue details for each currency **There’s a difference between 0% rates and null rates:** - Null means there were no queries: since Algolia didn’t receive any events, the rates (CTR, CR, ATCR, purchase rate) are null. - **0% rates** mean there were queries but no [click or conversion events](www.algolia.com/doc/guides/sending-events/getting-started/) were received.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • click_analytics (Boolean) (defaults to: nil)

    Whether to include metrics related to click and conversion events in the response. (default to false)

  • revenue_analytics (Boolean) (defaults to: nil)

    Whether to include metrics related to revenue events in the response. (default to false)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • order_by (OrderBy) (defaults to: nil)

    Attribute by which to order the response items. If the ‘clickAnalytics` parameter is false, only `searchCount` is available. (default to ’searchCount’)

  • direction (Direction) (defaults to: nil)

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

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

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

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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


1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
# File 'lib/algolia/api/analytics_client.rb', line 1585

def get_top_searches(
  index,
  click_analytics = nil,
  revenue_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,
    revenue_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, revenue_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 searches. For each search, it also includes the average number of hits. If you set the ‘clickAnalytics` query parameter to `true`, the response also includes - Tracked searches count. Tracked searches are Search API requests with the `clickAnalytics` parameter set to `true`. This differs from the response’s ‘count`, which shows the overall number of searches, including those where `clickAnalytics` is `false`. - Click count - Click-through rate (CTR) - Conversion count - Conversion rate (CR) - Average click position If you set the `revenueAnalytics` query parameter to `true`, the response also includes: - Add-to-cart count - Add-to-cart rate (ATCR) - Purchase count - Purchase rate - Revenue details for each currency **There’s a difference between 0% rates and null rates:** - Null means there were no queries: since Algolia didn’t receive any events, the rates (CTR, CR, ATCR, purchase rate) are null. - **0% rates** mean there were queries but no [click or conversion events](www.algolia.com/doc/guides/sending-events/getting-started/) were received.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • click_analytics (Boolean) (defaults to: nil)

    Whether to include metrics related to click and conversion events in the response. (default to false)

  • revenue_analytics (Boolean) (defaults to: nil)

    Whether to include metrics related to revenue events in the response. (default to false)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • order_by (OrderBy) (defaults to: nil)

    Attribute by which to order the response items. If the ‘clickAnalytics` parameter is false, only `searchCount` is available. (default to ’searchCount’)

  • direction (Direction) (defaults to: nil)

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

  • limit (Integer) (defaults to: nil)

    Number of items to return. (default to 10)

  • offset (Integer) (defaults to: nil)

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

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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



1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
# File 'lib/algolia/api/analytics_client.rb', line 1522

def get_top_searches_with_http_info(
  index,
  click_analytics = nil,
  revenue_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

  path = "/2/searches"
  query_params = {}
  query_params[:index] = index
  query_params[:clickAnalytics] = click_analytics unless click_analytics.nil?
  query_params[:revenueAnalytics] = revenue_analytics unless revenue_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

Retrieves the number of unique users within a time range, including a daily breakdown. Since it returns the number of unique users, the sum of the daily values might be different from the total number. By default: - Algolia distinguishes search users by their IP address, unless you include a pseudonymous user identifier in your search requests with the ‘userToken` API parameter or `x-algolia-usertoken` request header. - The analyzed period includes the last eight days including the current day.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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


1663
1664
1665
1666
# File 'lib/algolia/api/analytics_client.rb', line 1663

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

Retrieves the number of unique users within a time range, including a daily breakdown. Since it returns the number of unique users, the sum of the daily values might be different from the total number. By default: - Algolia distinguishes search users by their IP address, unless you include a pseudonymous user identifier in your search requests with the ‘userToken` API parameter or `x-algolia-usertoken` request header. - The analyzed period includes the last eight days including the current day.

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

    Start date of the period to analyze, in ‘YYYY-MM-DD` format.

  • end_date (String) (defaults to: nil)

    End date of the period to analyze, in ‘YYYY-MM-DD` format.

  • tags (String) (defaults to: nil)

    Tags by which to segment the analytics. You can combine multiple tags with ‘OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).

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



1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
# File 'lib/algolia/api/analytics_client.rb', line 1624

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

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

  post_body = request_options[:debug_body]

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

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

#set_client_api_key(api_key) ⇒ void

This method returns an undefined value.

Helper method to switch the API key used to authenticate the requests.

Parameters:

  • api_key (String)

    the new API key to use.



60
61
62
63
64
# File 'lib/algolia/api/analytics_client.rb', line 60

def set_client_api_key(api_key)
  @api_client.set_client_api_key(api_key)

  self
end