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

Link to this section Summary

Link to this section Functions

Link to this function

all_custom_prop_values(conn, params)

View Source
Link to this function

all_props_breakdown(conn, params)

View Source
Link to this function

browser_versions(conn, 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
Link to this function

main_graph(conn, params)

View Source

Returns a time-series based on given parameters.

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

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.

  • with_imported - boolean indicating whether the Google Analytics data was queried or not.

  • imported_source - the source of the imported data, when applicable. Currently only Google Analytics is supported.

  • 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
  },
  "imported_source" => nil,
  "interval" => "month",
  "labels" => ["2021-09-01", "2021-10-01", "2021-11-01", "2021-12-01"],
  "plot" => [0, 0, 0, 0],
  "present_index" => nil,
  "with_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

prop_breakdown(conn, params)

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