# Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. module Algolia class AnalyticsClient attr_accessor :api_client 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 def self.create(app_id, api_key, region = nil, opts = {}) hosts = [] regions = ['de', 'us'] if region.is_a?(Hash) && (opts.nil? || opts.empty?) opts = region region = nil end raise "`region` must be one of the following: #{regions.join(', ')}" if !region.nil? && (!region.is_a?(String) || !regions.include?(region)) hosts << Transport::StatefulHost.new(region.nil? ? 'analytics.algolia.com' : 'analytics.{region}.algolia.com'.sub!('{region}', region), accept: CallType::READ | CallType::WRITE) config = Algolia::Configuration.new(app_id, api_key, hosts, 'Analytics', opts) create_with_config(config) end def self.create_with_config(config) new(config) end # This method allow you to send requests to the Algolia REST API. # @param path [String] Path of the endpoint, anything after \"/1\" must be specified. (required) # @param parameters [Hash] Query parameters to apply to the current query. # @param 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) # @return [Http::Response] the response 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 # This method allow you to send requests to the Algolia REST API. # @param path [String] Path of the endpoint, anything after \"/1\" must be specified. (required) # @param parameters [Hash] Query parameters to apply to the current query. # @param 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) # @return [Object] 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 # This method allow you to send requests to the Algolia REST API. # @param path [String] Path of the endpoint, anything after \"/1\" must be specified. (required) # @param parameters [Hash] Query parameters to apply to the current query. # @param 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) # @return [Http::Response] the response 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 # This method allow you to send requests to the Algolia REST API. # @param path [String] Path of the endpoint, anything after \"/1\" must be specified. (required) # @param parameters [Hash] Query parameters to apply to the current query. # @param 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) # @return [Object] 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 # This method allow you to send requests to the Algolia REST API. # @param path [String] Path of the endpoint, anything after \"/1\" must be specified. (required) # @param parameters [Hash] Query parameters to apply to the current query. # @param body [Object] Parameters to send with the custom request. # @param 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) # @return [Http::Response] the response 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 # This method allow you to send requests to the Algolia REST API. # @param path [String] Path of the endpoint, anything after \"/1\" must be specified. (required) # @param parameters [Hash] Query parameters to apply to the current query. # @param body [Object] Parameters to send with the custom request. # @param 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) # @return [Object] 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 # This method allow you to send requests to the Algolia REST API. # @param path [String] Path of the endpoint, anything after \"/1\" must be specified. (required) # @param parameters [Hash] Query parameters to apply to the current query. # @param body [Object] Parameters to send with the custom request. # @param 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) # @return [Http::Response] the response 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 # This method allow you to send requests to the Algolia REST API. # @param path [String] Path of the endpoint, anything after \"/1\" must be specified. (required) # @param parameters [Hash] Query parameters to apply to the current query. # @param body [Object] Parameters to send with the custom request. # @param 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) # @return [Object] 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 # Retrieves the add-to-cart rate for all of 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. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [Http::Response] the response 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 # Retrieves the add-to-cart rate for all of 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. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [GetAddToCartRateResponse] 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 # Retrieves the average click position of your search results, including a daily breakdown. The average click position is the average of all clicked search results' 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. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [Http::Response] the response 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 # Retrieves the average click position of your search results, including a daily breakdown. The average click position is the average of all clicked search results' 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. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [GetAverageClickPositionResponse] 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 # 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. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [Http::Response] the response 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 # 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. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [GetClickPositionsResponse] 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 # Retrieves the click-through rate for all of 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. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [Http::Response] the response 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 # Retrieves the click-through rate for all of 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. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [GetClickThroughRateResponse] 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 # Retrieves the conversion rate for all of 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. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [Http::Response] the response 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 # Retrieves the conversion rate for all of 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. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [GetConversionRateResponse] 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 # Retrieves the fraction of searches that didn't lead to any click 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 # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [Http::Response] the response 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 # Retrieves the fraction of searches that didn't lead to any click 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 # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [GetNoClickRateResponse] 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 # Retrieves the fraction of searches that didn't return any results 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 # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [Http::Response] the response 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 # Retrieves the fraction of searches that didn't return any results 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 # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [GetNoResultsRateResponse] 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 # Retrieves the purchase rate for all of 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. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [Http::Response] the response 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 # Retrieves the purchase rate for all of 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. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [GetPurchaseRateResponse] 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 # Retrieves revenue-related metrics, such as the total revenue or the average order value. To retrieve revenue-related metrics, sent purchase events. By default, the analyzed period includes the last eight days including the current day. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [Http::Response] the response 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 # Retrieves revenue-related metrics, such as the total revenue or the average order value. To retrieve revenue-related metrics, sent purchase events. By default, the analyzed period includes the last eight days including the current day. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [GetRevenue] 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 # 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 # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [Http::Response] the response 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 # 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 # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [GetSearchesCountResponse] 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 # Retrieves the most popular searches that didn't lead to any clicks, from the 1,000 most frequent searches. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param limit [Integer] Number of items to return. (default to 10) # @param offset [Integer] Position of the first item to return. (default to 0) # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [Http::Response] the response def get_searches_no_clicks_with_http_info(index, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {}) # verify the required parameter 'index' is set if @api_client.config.client_side_validation && index.nil? raise ArgumentError, "Parameter `index` is required when calling `get_searches_no_clicks`." end if @api_client.config.client_side_validation && !offset.nil? && offset < 0 raise ArgumentError, 'invalid value for ""offset"" when calling AnalyticsClient.get_searches_no_clicks, must be greater than or equal to 0.' end path = '/2/searches/noClicks' query_params = {} query_params[:index] = index query_params[:startDate] = start_date unless start_date.nil? query_params[:endDate] = end_date unless end_date.nil? query_params[:limit] = limit unless limit.nil? query_params[:offset] = offset unless offset.nil? query_params[:tags] = tags unless tags.nil? query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil? header_params = {} header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil? post_body = request_options[:debug_body] new_options = request_options.merge( :operation => :'AnalyticsClient.get_searches_no_clicks', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, new_options) end # Retrieves the most popular searches that didn't lead to any clicks, from the 1,000 most frequent searches. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param limit [Integer] Number of items to return. (default to 10) # @param offset [Integer] Position of the first item to return. (default to 0) # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [GetSearchesNoClicksResponse] 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 # Retrieves the most popular searches that didn't return any results. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param limit [Integer] Number of items to return. (default to 10) # @param offset [Integer] Position of the first item to return. (default to 0) # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [Http::Response] the response def get_searches_no_results_with_http_info(index, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {}) # verify the required parameter 'index' is set if @api_client.config.client_side_validation && index.nil? raise ArgumentError, "Parameter `index` is required when calling `get_searches_no_results`." end if @api_client.config.client_side_validation && !offset.nil? && offset < 0 raise ArgumentError, 'invalid value for ""offset"" when calling AnalyticsClient.get_searches_no_results, must be greater than or equal to 0.' end path = '/2/searches/noResults' query_params = {} query_params[:index] = index query_params[:startDate] = start_date unless start_date.nil? query_params[:endDate] = end_date unless end_date.nil? query_params[:limit] = limit unless limit.nil? query_params[:offset] = offset unless offset.nil? query_params[:tags] = tags unless tags.nil? query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil? header_params = {} header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil? post_body = request_options[:debug_body] new_options = request_options.merge( :operation => :'AnalyticsClient.get_searches_no_results', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, new_options) end # Retrieves the most popular searches that didn't return any results. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param limit [Integer] Number of items to return. (default to 10) # @param offset [Integer] Position of the first item to return. (default to 0) # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [GetSearchesNoResultsResponse] 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 # Retrieves the time when the Analytics data for the specified index was last updated. The Analytics data is updated every 5 minutes. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param 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) # @return [Http::Response] the response 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 # Retrieves the time when the Analytics data for the specified index was last updated. The Analytics data is updated every 5 minutes. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param 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) # @return [GetStatusResponse] 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 # Retrieves the countries with the most searches to your index. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param limit [Integer] Number of items to return. (default to 10) # @param offset [Integer] Position of the first item to return. (default to 0) # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [Http::Response] the response def get_top_countries_with_http_info(index, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {}) # verify the required parameter 'index' is set if @api_client.config.client_side_validation && index.nil? raise ArgumentError, "Parameter `index` is required when calling `get_top_countries`." end if @api_client.config.client_side_validation && !offset.nil? && offset < 0 raise ArgumentError, 'invalid value for ""offset"" when calling AnalyticsClient.get_top_countries, must be greater than or equal to 0.' end path = '/2/countries' query_params = {} query_params[:index] = index query_params[:startDate] = start_date unless start_date.nil? query_params[:endDate] = end_date unless end_date.nil? query_params[:limit] = limit unless limit.nil? query_params[:offset] = offset unless offset.nil? query_params[:tags] = tags unless tags.nil? query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil? header_params = {} header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil? post_body = request_options[:debug_body] new_options = request_options.merge( :operation => :'AnalyticsClient.get_top_countries', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, new_options) end # Retrieves the countries with the most searches to your index. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param limit [Integer] Number of items to return. (default to 10) # @param offset [Integer] Position of the first item to return. (default to 0) # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [GetTopCountriesResponse] 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 # Retrieves the most frequently used filter attributes. These are attributes of your records that you included in the `attributesForFaceting` setting. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param search [String] Search query. # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param limit [Integer] Number of items to return. (default to 10) # @param offset [Integer] Position of the first item to return. (default to 0) # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [Http::Response] the response def get_top_filter_attributes_with_http_info(index, search = nil, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {}) # verify the required parameter 'index' is set if @api_client.config.client_side_validation && index.nil? raise ArgumentError, "Parameter `index` is required when calling `get_top_filter_attributes`." end if @api_client.config.client_side_validation && !offset.nil? && offset < 0 raise ArgumentError, 'invalid value for ""offset"" when calling AnalyticsClient.get_top_filter_attributes, must be greater than or equal to 0.' end path = '/2/filters' query_params = {} query_params[:index] = index query_params[:search] = search unless search.nil? query_params[:startDate] = start_date unless start_date.nil? query_params[:endDate] = end_date unless end_date.nil? query_params[:limit] = limit unless limit.nil? query_params[:offset] = offset unless offset.nil? query_params[:tags] = tags unless tags.nil? query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil? header_params = {} header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil? post_body = request_options[:debug_body] new_options = request_options.merge( :operation => :'AnalyticsClient.get_top_filter_attributes', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, new_options) end # Retrieves the most frequently used filter attributes. These are attributes of your records that you included in the `attributesForFaceting` setting. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param search [String] Search query. # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param limit [Integer] Number of items to return. (default to 10) # @param offset [Integer] Position of the first item to return. (default to 0) # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [GetTopFilterAttributesResponse] 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 # Retrieves the 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 # @param attribute [String] Attribute name. (required) # @param index [String] Index name. (required) # @param search [String] Search query. # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param limit [Integer] Number of items to return. (default to 10) # @param offset [Integer] Position of the first item to return. (default to 0) # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [Http::Response] the response def get_top_filter_for_attribute_with_http_info(attribute, index, search = nil, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {}) # verify the required parameter 'attribute' is set if @api_client.config.client_side_validation && attribute.nil? raise ArgumentError, "Parameter `attribute` is required when calling `get_top_filter_for_attribute`." end # verify the required parameter 'index' is set if @api_client.config.client_side_validation && index.nil? raise ArgumentError, "Parameter `index` is required when calling `get_top_filter_for_attribute`." end if @api_client.config.client_side_validation && !offset.nil? && offset < 0 raise ArgumentError, 'invalid value for ""offset"" when calling AnalyticsClient.get_top_filter_for_attribute, must be greater than or equal to 0.' end path = '/2/filters/{attribute}'.sub('{' + 'attribute' + '}', Transport.encode_uri(attribute.to_s)) query_params = {} query_params[:index] = index query_params[:search] = search unless search.nil? query_params[:startDate] = start_date unless start_date.nil? query_params[:endDate] = end_date unless end_date.nil? query_params[:limit] = limit unless limit.nil? query_params[:offset] = offset unless offset.nil? query_params[:tags] = tags unless tags.nil? query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil? header_params = {} header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil? post_body = request_options[:debug_body] new_options = request_options.merge( :operation => :'AnalyticsClient.get_top_filter_for_attribute', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, new_options) end # Retrieves the 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 # @param attribute [String] Attribute name. (required) # @param index [String] Index name. (required) # @param search [String] Search query. # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param limit [Integer] Number of items to return. (default to 10) # @param offset [Integer] Position of the first item to return. (default to 0) # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [GetTopFilterForAttributeResponse] 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 # Retrieves the 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 # @param index [String] Index name. (required) # @param search [String] Search query. # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param limit [Integer] Number of items to return. (default to 10) # @param offset [Integer] Position of the first item to return. (default to 0) # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [Http::Response] the response def get_top_filters_no_results_with_http_info(index, search = nil, start_date = nil, end_date = nil, limit = nil, offset = nil, tags = nil, request_options = {}) # verify the required parameter 'index' is set if @api_client.config.client_side_validation && index.nil? raise ArgumentError, "Parameter `index` is required when calling `get_top_filters_no_results`." end if @api_client.config.client_side_validation && !offset.nil? && offset < 0 raise ArgumentError, 'invalid value for ""offset"" when calling AnalyticsClient.get_top_filters_no_results, must be greater than or equal to 0.' end path = '/2/filters/noResults' query_params = {} query_params[:index] = index query_params[:search] = search unless search.nil? query_params[:startDate] = start_date unless start_date.nil? query_params[:endDate] = end_date unless end_date.nil? query_params[:limit] = limit unless limit.nil? query_params[:offset] = offset unless offset.nil? query_params[:tags] = tags unless tags.nil? query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil? header_params = {} header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil? post_body = request_options[:debug_body] new_options = request_options.merge( :operation => :'AnalyticsClient.get_top_filters_no_results', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, new_options) end # Retrieves the 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 # @param index [String] Index name. (required) # @param search [String] Search query. # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param limit [Integer] Number of items to return. (default to 10) # @param offset [Integer] Position of the first item to return. (default to 0) # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [GetTopFiltersNoResultsResponse] 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 # Retrieves the object IDs of the most frequent search results. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param search [String] Search query. # @param click_analytics [Boolean] Whether to include metrics related to click and conversion events in the response. (default to false) # @param revenue_analytics [Boolean] Whether to include revenue-related metrics in the response. If true, metrics related to click and conversion events are also included in the response. (default to false) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param limit [Integer] Number of items to return. (default to 10) # @param offset [Integer] Position of the first item to return. (default to 0) # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [Http::Response] the response 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 if @api_client.config.client_side_validation && !offset.nil? && offset < 0 raise ArgumentError, 'invalid value for ""offset"" when calling AnalyticsClient.get_top_hits, must be greater than or equal to 0.' end path = '/2/hits' query_params = {} query_params[:index] = index query_params[:search] = search unless search.nil? query_params[:clickAnalytics] = click_analytics unless click_analytics.nil? query_params[: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 # Retrieves the object IDs of the most frequent search results. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param search [String] Search query. # @param click_analytics [Boolean] Whether to include metrics related to click and conversion events in the response. (default to false) # @param revenue_analytics [Boolean] Whether to include revenue-related metrics in the response. If true, metrics related to click and conversion events are also included in the response. (default to false) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param limit [Integer] Number of items to return. (default to 10) # @param offset [Integer] Position of the first item to return. (default to 0) # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [GetTopHitsResponse] 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 # Returns the most popular search terms. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param click_analytics [Boolean] Whether to include metrics related to click and conversion events in the response. (default to false) # @param revenue_analytics [Boolean] Whether to include revenue-related metrics in the response. If true, metrics related to click and conversion events are also included in the response. (default to false) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param order_by [OrderBy] Attribute by which to order the response items. If the `clickAnalytics` parameter is false, only `searchCount` is available. (default to 'searchCount') # @param direction [Direction] Sorting direction of the results: ascending or descending. (default to 'asc') # @param limit [Integer] Number of items to return. (default to 10) # @param offset [Integer] Position of the first item to return. (default to 0) # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [Http::Response] the response 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 if @api_client.config.client_side_validation && !offset.nil? && offset < 0 raise ArgumentError, 'invalid value for ""offset"" when calling AnalyticsClient.get_top_searches, must be greater than or equal to 0.' end path = '/2/searches' query_params = {} query_params[:index] = index query_params[:clickAnalytics] = click_analytics unless click_analytics.nil? query_params[: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 # Returns the most popular search terms. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param click_analytics [Boolean] Whether to include metrics related to click and conversion events in the response. (default to false) # @param revenue_analytics [Boolean] Whether to include revenue-related metrics in the response. If true, metrics related to click and conversion events are also included in the response. (default to false) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param order_by [OrderBy] Attribute by which to order the response items. If the `clickAnalytics` parameter is false, only `searchCount` is available. (default to 'searchCount') # @param direction [Direction] Sorting direction of the results: ascending or descending. (default to 'asc') # @param limit [Integer] Number of items to return. (default to 10) # @param offset [Integer] Position of the first item to return. (default to 0) # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [GetTopSearchesResponse] 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 # Retrieves the number of unique users within a time range, including a daily breakdown. Since this endpoint 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. By default, the analyzed period includes the last eight days including the current day. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [Http::Response] the response 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 # Retrieves the number of unique users within a time range, including a daily breakdown. Since this endpoint 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. By default, the analyzed period includes the last eight days including the current day. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date (`YYYY-MM-DD`) of the period to analyze. # @param end_date [String] End date (`YYYY-MM-DD`) of the period to analyze. # @param tags [String] 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](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). # @param 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) # @return [GetUsersCountResponse] 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 end end