Method: Algolia::AnalyticsClient#get_users_count_with_http_info

Defined in:
lib/algolia/api/analytics_client.rb

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

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

Required API Key ACLs:

- analytics

Parameters:

  • index (String)

    Index name. (required)

  • start_date (String) (defaults to: nil)

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

  • end_date (String) (defaults to: nil)

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

  • tags (String) (defaults to: nil)

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

  • request_options:

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

Returns:



1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
# File 'lib/algolia/api/analytics_client.rb', line 1610

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