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
Fix a typo (that causes 500) and add tests (#6605)
RobertJoonasb787d17e2549
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 531a54b0a5..ef0c06af98 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -59,6 +59,7 @@ All notable changes to this project will be documented in this file.- Fixed issue with users with billing role not being able to create personal segments- Fixed period arrow keys hijacking custom-range calendar- Fixed dashboard CSV export failing when the dashboard is filtered by entry page or exit page+- Fixed entry page hostname breakdown crashing when revenue metrics are queried## v3.2.0 - 2026-01-16diff --git a/lib/plausible/stats/sql/expression.ex b/lib/plausible/stats/sql/expression.exindex a5c433f7da..142ad71f1d 100644--- a/lib/plausible/stats/sql/expression.ex+++ b/lib/plausible/stats/sql/expression.ex@@ -283,7 +283,7 @@ defmodule Plausible.Stats.SQL.Expression dodo: select_merge_as(q, [..., t], %{key => t.entry_page})def select_dimension_from_join(q, key, "visit:entry_page_hostname"),- do: select_merge_as(q, [..., t], %{key => t.entry_page_hostaname})+ do: select_merge_as(q, [..., t], %{key => t.entry_page_hostname})def select_dimension_from_join(q, key, "visit:exit_page"),do: select_merge_as(q, [..., t], %{key => t.exit_page})diff --git a/test/plausible/stats/query/query_test.exs b/test/plausible/stats/query/query_test.exsindex 1616571d52..d74e4fdb50 100644--- a/test/plausible/stats/query/query_test.exs+++ b/test/plausible/stats/query/query_test.exs@@ -670,4 +670,54 @@ defmodule Plausible.Stats.QueryTest doassert results == [%{dimensions: ["author"], metrics: [1]}]endend++ describe "hostname dimensions" do+ for hostname_dim <- ["visit:entry_page_hostname", "visit:exit_page_hostname"] do+ @tag :ee_only+ test "revenue metrics in #{hostname_dim} breakdown", %{site: site} do+ insert(:goal, site: site, event_name: "Purchase", currency: "USD")++ populate_stats(site, [+ build(:pageview,+ user_id: 1,+ hostname: "onetwothree.com",+ timestamp: ~N[2021-01-01 00:00:00]+ ),+ build(:event,+ name: "Purchase",+ user_id: 1,+ hostname: "onetwothree.com",+ revenue_reporting_amount: Decimal.new("100"),+ revenue_reporting_currency: "USD",+ timestamp: ~N[2021-01-01 00:00:10]+ ),+ build(:pageview,+ user_id: 1,+ hostname: "onetwothree.com",+ timestamp: ~N[2021-01-01 00:00:20]+ )+ ])++ {:ok, query} =+ QueryBuilder.build(site, %ParsedQueryParams{+ metrics: [:total_revenue, :average_revenue],+ input_date_range: :all,+ dimensions: [unquote(hostname_dim)],+ filters: [[:is, "event:goal", ["Purchase"]]]+ })++ %Stats.QueryResult{results: results} = Stats.query(site, query)++ assert results == [+ %{+ dimensions: ["onetwothree.com"],+ metrics: [+ %{currency: :USD, long: "$100.00", short: "$100.0", value: 100.0},+ %{currency: :USD, long: "$100.00", short: "$100.0", value: 100.0}+ ]+ }+ ]+ end+ end+ endend