Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Carry _sample_factor from right side to left in join (#2962)

Uku Taht6be67bc6c2f2
diff --git a/lib/plausible/stats/base.ex b/lib/plausible/stats/base.ex
index 901428888e..b509f440ce 100644
--- a/lib/plausible/stats/base.ex
+++ b/lib/plausible/stats/base.ex
@@ -424,7 +424,10 @@ defmodule Plausible.Stats.Base do
if Query.has_event_filters?(query) do
converted_sessions =
from(e in query_events(site, query),
- select: %{session_id: fragment("DISTINCT ?", e.session_id)}
+ select: %{
+ session_id: fragment("DISTINCT ?", e.session_id),
+ _sample_factor: fragment("_sample_factor")
+ }
)
from(s in db_query,