View Source PlausibleWeb.Api.StatsController (Plausible v0.0.1)

Summary

Functions

Link to this function

all_custom_prop_values(conn, params)

View Source
Link to this function

browser_versions(conn, params)

View Source
Link to this function

build_intervals(labels, date_range, start_fn, end_fn)

View Source
Link to this function

comparison_query(site, query, params)

View Source
Link to this function

conversions(conn, params)

View Source
Link to this function

current_visitors(conn, _)

View Source
Link to this function

custom_prop_values(conn, params)

View Source
Link to this function

entry_pages(conn, params)

View Source
Link to this function

exit_pages(conn, params)

View Source
Link to this function

filter_suggestions(conn, params)

View Source

See PlausibleWeb.Controllers.API.Revenue.format_money/1.

Link to this function

format_revenue_metric(metric_value)

View Source

See PlausibleWeb.Controllers.API.Revenue.format_revenue_metric/1.

Link to this function

main_graph(conn, params)

View Source

Returns a time-series based on given parameters.

Parameters

This API accepts the following parameters:

  • period - x-axis of the graph, e.g. 12mo, day, custom.

  • metric - y-axis of the graph, e.g. visits, visitors, pageviews. See the Stats API "Metrics" section for more details. Defaults to visitors.

  • interval - granularity of the time-series data. You can think of it as a GROUP BY clause. Possible values are minute, hour, date, week, and month. The default depends on the period parameter. Check Plausible.Query.from/2 for each default.

  • filters - optional filters to drill down data. See the Stats API "Filtering" section for more details.

  • with_imported - boolean indicating whether to include Google Analytics imported data or not. Defaults to false.

Full example:

%{
  "from" => "2021-09-06",
  "interval" => "month",
  "metric" => "visitors",
  "period" => "custom",
  "to" => "2021-12-13"
}

Response

Returns a map with the following keys:

  • plot - list of values for the requested metric representing the y-axis of the graph.

  • labels - list of date times representing the x-axis of the graph.

  • present_index - index of the element representing the current date in labels and plot lists.

  • interval - the interval used for querying.

  • includes_imported - boolean indicating whether imported data was queried or not.

  • imports_exist - boolean indicating whether there are any completed imports for a given site or not.

  • full_intervals - map of dates indicating whether the interval has been cut off by the requested date range or not. For example, if looking at a month week-by-week, some weeks may be cut off by the month boundaries. It's useful to adjust the graph display slightly in case the interval is not 'full' so that the user understands why the numbers might be lower for those partial periods.

Full example:

%{
  "full_intervals" => %{
    "2021-09-01" => false,
    "2021-10-01" => true,
    "2021-11-01" => true,
    "2021-12-01" => false
  },
  "imports_exist" => false,
  "interval" => "month",
  "labels" => ["2021-09-01", "2021-10-01", "2021-11-01", "2021-12-01"],
  "plot" => [0, 0, 0, 0],
  "present_index" => nil,
  "includes_imported" => false
}
Link to this function

operating_system_versions(conn, params)

View Source
Link to this function

operating_systems(conn, params)

View Source
Link to this function

parse_comparison_options(site, params)

View Source
Link to this function

put_combined_name_with_version(row, name_key)

View Source
Link to this function

referrer_drilldown(conn, params)

View Source
Link to this function

screen_sizes(conn, params)

View Source
Link to this function

utm_campaigns(conn, params)

View Source
Link to this function

utm_contents(conn, params)

View Source
Link to this function

utm_mediums(conn, params)

View Source
Link to this function

utm_sources(conn, params)

View Source