# frozen_string_literal: true # 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 if opts.nil? || opts[:connect_timeout].nil? opts[:connect_timeout] = 2000 end if opts.nil? || opts[:read_timeout].nil? opts[:read_timeout] = 5000 end if opts.nil? || opts[:write_timeout].nil? opts[:write_timeout] = 30000 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 def self.create_with_config(config) new(config) end # Helper method to switch the API key used to authenticate the requests. # # @param api_key [String] the new API key to use. # @return [void] def set_client_api_key(api_key) @api_client.set_client_api_key(api_key) self end def add_user_agent_segment(segment, version = nil) @api_client.config.add_user_agent_segment(segment, version) self 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 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](https://www.algolia.com/doc/guides/sending-events/getting-started/) were received. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 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](https://www.algolia.com/doc/guides/sending-events/getting-started/) were received. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 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](https://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 # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 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](https://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 # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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. An average of `0` when `clickAnalytics` is enabled means Algolia didn't receive any [click events](https://www.algolia.com/doc/guides/sending-events/getting-started/) for the queries. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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. An average of `0` when `clickAnalytics` is enabled means Algolia didn't receive any [click events](https://www.algolia.com/doc/guides/sending-events/getting-started/) for the queries. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 (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](https://www.algolia.com/doc/guides/sending-events/getting-started/) were received. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 (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](https://www.algolia.com/doc/guides/sending-events/getting-started/) were received. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 (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](https://www.algolia.com/doc/guides/sending-events/getting-started/) were received. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 (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](https://www.algolia.com/doc/guides/sending-events/getting-started/) were received. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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. 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 # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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. 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 # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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. 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 # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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. 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 # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 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](https://www.algolia.com/doc/guides/sending-events/getting-started/) were received. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 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](https://www.algolia.com/doc/guides/sending-events/getting-started/) were received. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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, 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 # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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, 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 # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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. For each search, it also returns the number of displayed search results that remained unclicked. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 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. For each search, it also returns the number of displayed search results that remained unclicked. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 1,000 most frequent searches that produced zero results. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 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 1,000 most frequent searches that produced zero results. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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. 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 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. 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 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 in your index. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 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 in your index. # # Required API Key ACLs: # - analytics # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 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 # @param index [String] Index name. (required) # @param search [String] Search query. # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 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 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 # @param index [String] Index name. (required) # @param search [String] Search query. # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 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 # @param attribute [String] Attribute name. (required) # @param index [String] Index name. (required) # @param search [String] Search query. # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 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 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 # @param attribute [String] Attribute name. (required) # @param index [String] Index name. (required) # @param search [String] Search query. # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 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 # @param index [String] Index name. (required) # @param search [String] Search query. # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 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 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 # @param index [String] Index name. (required) # @param search [String] Search query. # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 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](https://www.algolia.com/doc/guides/sending-events/getting-started/) were received. # # 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 metrics related to revenue events in the response. (default to false) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 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 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](https://www.algolia.com/doc/guides/sending-events/getting-started/) were received. # # 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 metrics related to revenue events in the response. (default to false) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 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](https://www.algolia.com/doc/guides/sending-events/getting-started/) were received. # # 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 metrics related to revenue events in the response. (default to false) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 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 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](https://www.algolia.com/doc/guides/sending-events/getting-started/) were received. # # 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 metrics related to revenue events in the response. (default to false) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 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 # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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 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 # @param index [String] Index name. (required) # @param start_date [String] Start date of the period to analyze, in `YYYY-MM-DD` format. # @param end_date [String] End date of the period to analyze, in `YYYY-MM-DD` format. # @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