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
Limit excluded goals to 1000 in goal suggestions (#4319)
Adrian Gruntkowski22b18db94ad9
diff --git a/lib/plausible/stats/goal_suggestions.ex b/lib/plausible/stats/goal_suggestions.exindex b55ee934dd..4ff23bc8e6 100644--- a/lib/plausible/stats/goal_suggestions.ex+++ b/lib/plausible/stats/goal_suggestions.ex@@ -6,6 +6,14 @@ defmodule Plausible.Stats.GoalSuggestions doimport Plausible.Stats.Baseimport Ecto.Query+ # As excluded goal names are interpolated as separate+ # parameters in the query, there's a risk of running+ # against max parameters limit. Given the failure mode+ # in this case is suggesting an event that is already+ # added as a goal, which will be validated when creating,+ # it's safe to trim exclusions list.+ @max_excluded 1000+defmacrop visitors(e) doquote doselected_as(@@ -23,7 +31,11 @@ defmodule Plausible.Stats.GoalSuggestions do|> Repo.preload(:goals)|> Plausible.Imported.load_import_data()- excluded = Keyword.get(opts, :exclude, [])+ excluded =+ opts+ |> Keyword.get(:exclude, [])+ |> Enum.take(@max_excluded)+limit = Keyword.get(opts, :limit, 25)params = %{"with_imported" => "true", "period" => "6mo"}