Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.
TypeScript analyticsanalytics-dashboardclickhouseelixirgoogle-analyticsmarketingopen-source-analyticsphoenixplausible-analyticspostgresqlprivacyprivacy-friendlyself-hostedsimple-analyticsstatisticstailwindcssweb-analyticswebsite-analyticswebsite-statswebsite-tracking
Improves realtime top stats and conversion rate calculation (#500)
Vignesh Joglekarf776c6bb30a0
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex e5f846c928..c7fa32ca31 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.- Simple notifications around traffic spikes plausible/analytics#453- Dark theme option/system setting follow plausible/analytics#467- "Load More" capability to pages modal plausible/analytics#480+- Unique Visitors (last 30 min) as a top stat in realtime view plausible/analytics#500- Pinned filter and date selector rows while scrolling plausible/analytics#472### Changed@@ -33,6 +34,7 @@ All notable changes to this project will be documented in this file.- Prevent picking dates before site insertion plausible/analtics#446- Fix overly-sticky from and to in query parameters plausible/analytics#495- Adds support for single-day date selection plausible/analytics#495+- Goal conversion rate in realtime view is now accurate plausible/analytics#500### Security- Do not run the plausible Docker container as root plausible/analytics#362diff --git a/lib/plausible/stats/clickhouse.ex b/lib/plausible/stats/clickhouse.exindex e5271f4098..cc678e5568 100644--- a/lib/plausible/stats/clickhouse.ex+++ b/lib/plausible/stats/clickhouse.ex@@ -166,6 +166,7 @@ defmodule Plausible.Stats.Clickhouse doenddef unique_visitors(site, query) do+ query = if query.period == "realtime", do: %Query{query | period: "30m"}, else: queryClickhouseRepo.one(from e in base_query_w_sessions(site, query),select: fragment("uniq(user_id)")diff --git a/lib/plausible_web/controllers/api/stats_controller.ex b/lib/plausible_web/controllers/api/stats_controller.exindex c48b2f3bd5..e9c165bc24 100644--- a/lib/plausible_web/controllers/api/stats_controller.ex+++ b/lib/plausible_web/controllers/api/stats_controller.ex@@ -28,6 +28,10 @@ defmodule PlausibleWeb.Api.StatsController doname: "Current visitors",count: Stats.current_visitors(site, query)},+ %{+ name: "Unique visitors (last 30 min)",+ count: Stats.unique_visitors(site, query)+ },%{name: "Pageviews (last 30 min)",count: Stats.total_pageviews(site, query)