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
make CSV export return only conversions with goal filter (#2760)
RobertJoonas4175a7abae5a
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 2ad4fd3b65..cfb0177c0f 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.- Add support for more Bamboo adapters, i.e. `Bamboo.MailgunAdapter`, `Bamboo.MandrillAdapter`, `Bamboo.SendGridAdapter` plausible/analytics#2649### Fixed+- Make goal-filtered CSV export return only unique_conversions timeseries in the 'visitors.csv' file- Stop treating page filter as an entry page filter- City report showing N/A instead of city names with imported data plausible/analytics#2675- Empty values for Screen Size, OS and Browser are uniformly replaced with "(not set)"diff --git a/lib/plausible_web/controllers/stats_controller.ex b/lib/plausible_web/controllers/stats_controller.exindex 355ae5be88..dd6600cb72 100644--- a/lib/plausible_web/controllers/stats_controller.ex+++ b/lib/plausible_web/controllers/stats_controller.ex@@ -98,7 +98,7 @@ defmodule PlausibleWeb.StatsController dometrics =cond doquery.filters["event:goal"] ->- [:visitors, :pageviews, :bounce_rate, :visit_duration]+ [:visitors]FunWithFlags.enabled?(:visits_metric, for: conn.assigns[:current_user]) ->[:visitors, :pageviews, :visits, :views_per_visit, :bounce_rate, :visit_duration]@@ -108,11 +108,18 @@ defmodule PlausibleWeb.StatsController doendgraph = Plausible.Stats.timeseries(site, query, metrics)- headers = [:date | metrics]+ columns = [:date | metrics]++ column_headers =+ if query.filters["event:goal"] do+ [:date, :unique_conversions]+ else+ columns+ endvisitors =- Enum.map(graph, fn row -> Enum.map(headers, &row[&1]) end)- |> (fn data -> [headers | data] end).()+ Enum.map(graph, fn row -> Enum.map(columns, &row[&1]) end)+ |> (fn data -> [column_headers | data] end).()|> CSV.encode()|> Enum.join()diff --git a/test/plausible_web/controllers/CSVs/30d-filter-goal/visitors.csv b/test/plausible_web/controllers/CSVs/30d-filter-goal/visitors.csvindex 0887396c4b..f42b575ee3 100644--- a/test/plausible_web/controllers/CSVs/30d-filter-goal/visitors.csv+++ b/test/plausible_web/controllers/CSVs/30d-filter-goal/visitors.csv@@ -1,32 +1,32 @@-date,visitors,pageviews,bounce_rate,visit_duration-2021-09-20,0,0,,-2021-09-21,0,0,,-2021-09-22,0,0,,-2021-09-23,0,0,,-2021-09-24,0,0,,-2021-09-25,0,0,,-2021-09-26,0,0,,-2021-09-27,0,0,,-2021-09-28,0,0,,-2021-09-29,0,0,,-2021-09-30,0,0,,-2021-10-01,0,0,,-2021-10-02,0,0,,-2021-10-03,0,0,,-2021-10-04,0,0,,-2021-10-05,0,0,,-2021-10-06,0,0,,-2021-10-07,0,0,,-2021-10-08,0,0,,-2021-10-09,0,0,,-2021-10-10,0,0,,-2021-10-11,0,0,,-2021-10-12,0,0,,-2021-10-13,0,0,,-2021-10-14,0,0,,-2021-10-15,0,0,,-2021-10-16,0,0,,-2021-10-17,0,0,,-2021-10-18,0,0,,-2021-10-19,1,0,100,0-2021-10-20,0,0,,+date,unique_conversions+2021-09-20,0+2021-09-21,0+2021-09-22,0+2021-09-23,0+2021-09-24,0+2021-09-25,0+2021-09-26,0+2021-09-27,0+2021-09-28,0+2021-09-29,0+2021-09-30,0+2021-10-01,0+2021-10-02,0+2021-10-03,0+2021-10-04,0+2021-10-05,0+2021-10-06,0+2021-10-07,0+2021-10-08,0+2021-10-09,0+2021-10-10,0+2021-10-11,0+2021-10-12,0+2021-10-13,0+2021-10-14,0+2021-10-15,0+2021-10-16,0+2021-10-17,0+2021-10-18,0+2021-10-19,1+2021-10-20,0