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
Adds an option to rename the script file
Uku Taht369f63bc5813
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 2eb5dd0f91..8a9cc0160f 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file.- Menu (with auto-complete) to add new and edit existing filters directly plausible/analytics#1089- Added `CLICKHOUSE_FLUSH_INTERVAL_MS` and `CLICKHOUSE_MAX_BUFFER_SIZE` configuration parameters plausible/analytics#1073- Ability to invite users to sites with different roles plausible/analytics#1122+- Option to configure a custom name for the script file### Fixed- Fix weekly report time range plausible/analytics#951diff --git a/config/runtime.exs b/config/runtime.exsindex 48c08b58ec..fca0206ac8 100644--- a/config/runtime.exs+++ b/config/runtime.exs@@ -136,6 +136,10 @@ is_selfhost =|> get_var_from_path_or_env("SELFHOST", "true")|> String.to_existing_atom()+custom_script_name =+ config_dir+ |> get_var_from_path_or_env("CUSTOM_SCRIPT_NAME", "script")+{site_limit, ""} =config_dir|> get_var_from_path_or_env("SITE_LIMIT", "50")@@ -171,7 +175,8 @@ config :plausible,admin_user_ids: admin_user_ids,site_limit: site_limit,site_limit_exempt: site_limit_exempt,- is_selfhost: is_selfhost+ is_selfhost: is_selfhost,+ custom_script_name: custom_script_nameconfig :plausible, :selfhost,disable_authentication: disable_auth,diff --git a/lib/plausible_web/plugs/tracker.ex b/lib/plausible_web/plugs/tracker.exindex 8252f04c41..54f0f54712 100644--- a/lib/plausible_web/plugs/tracker.ex+++ b/lib/plausible_web/plugs/tracker.ex@@ -2,7 +2,9 @@ defmodule PlausibleWeb.Tracker doimport Plug.Connuse Agent+ custom_script_name = Application.get_env(:plausible, :custom_script_name)base_variants = ["hash", "outbound-links", "exclusions", "compat"]+ base_filenames = ["plausible", custom_script_name]# Generates Power Set of all variantsvariants =@@ -24,8 +26,8 @@ defmodule PlausibleWeb.Tracker doString.split(x, ".")|> Combination.permutate()|> Enum.map(fn p -> Enum.join(p, ".") end)- |> Enum.filter(fn permutation -> permutation != x end)- |> Enum.map(fn v -> "plausible.#{v}.js" end)+ |> Enum.map(fn v -> Enum.map(base_filenames, fn filename -> "#{filename}.#{v}.js" end) end)+ |> List.flatten()if Enum.count(variants) > 0 do{"plausible.#{x}.js", variants}@@ -33,7 +35,7 @@ defmodule PlausibleWeb.Tracker doend)|> Enum.reject(fn x -> x == nil end)|> Enum.into(%{})- |> Map.put("plausible.js", ["analytics.js"])+ |> Map.put("plausible.js", ["analytics.js", "#{custom_script_name}.js"])@templates files_available@aliases aliases_available