mirror of
https://github.com/plausible/analytics.git
synced 2024-12-24 01:54:34 +03:00
Fix samplign in main graph and top pages
This commit is contained in:
parent
96df035285
commit
d9ac8ccdb9
@ -62,11 +62,8 @@ defmodule Plausible.Stats.Base do
|
||||
{:member, list} ->
|
||||
from(e in q, where: e.name in ^list)
|
||||
|
||||
# Logically, this isn't necessary and might even cause some confusion (request with no filters will still filter for event:name==pageviews).
|
||||
nil ->
|
||||
from(e in q, where: e.name == "pageview")
|
||||
|
||||
# When removing this, however, sampling in clickhouse goes a bit weird (dashboard with 3m pageviews will start getting sampled which is weird)
|
||||
q
|
||||
end
|
||||
|
||||
q =
|
||||
|
@ -9,6 +9,12 @@ defmodule PlausibleWeb.Api.StatsController do
|
||||
site = conn.assigns[:site]
|
||||
query = Query.from(site.timezone, params) |> Filters.add_prefix()
|
||||
|
||||
query =
|
||||
case query.filters["visit:goal"] do
|
||||
nil -> Query.put_filter(query, "event:name", {:is, "pageview"})
|
||||
_ -> query
|
||||
end
|
||||
|
||||
timeseries = Task.async(fn -> Stats.timeseries(site, query, ["visitors"]) end)
|
||||
{top_stats, sample_percent} = fetch_top_stats(site, query)
|
||||
|
||||
@ -313,6 +319,12 @@ defmodule PlausibleWeb.Api.StatsController do
|
||||
site = conn.assigns[:site]
|
||||
query = Query.from(site.timezone, params) |> Filters.add_prefix()
|
||||
|
||||
query =
|
||||
case query.filters["visit:goal"] do
|
||||
nil -> Query.put_filter(query, "event:name", {:is, "pageview"})
|
||||
_ -> query
|
||||
end
|
||||
|
||||
metrics =
|
||||
if params["detailed"],
|
||||
do: ["visitors", "pageviews", "bounce_rate", "time_on_page"],
|
||||
|
Loading…
Reference in New Issue
Block a user