Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Cache the tracking script for 24 hours

Uku Tahtd1fe1f7e4127
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0c7985aaca..a020f76e38 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,7 +3,6 @@ All notable changes to this project will be documented in this file.
## Unreleased
-- Added `LISTEN_IP` configuration parameter plausible/analytics#1189
### Added
- API route `PUT /api/v1/sites/goals` with form params `site_id`, `event_name` and/or `page_path`, and `goal_type` with supported types `event` and `page`
@@ -17,6 +16,7 @@ All notable changes to this project will be documented in this file.
- Allow custom styles to be passed to embedded iframe plausible/analytics#1522
- New UTM Tags `utm_content` and `utm_term` plausible/analytics#515
- If a session was started without a screen_size it is updated if an event with screen_size occurs
+- Added `LISTEN_IP` configuration parameter plausible/analytics#1189
### Fixed
- UI fix where multi-line text in pills would not be underlined properly on small screens.
@@ -24,6 +24,9 @@ All notable changes to this project will be documented in this file.
- Guests can now use the favicon to toggle additional info about the site bing viewed (such as in public embeds).
- Fix SecurityError in tracking script when user has blocked all local storage
+### Changed
+- Cache the tracking script for 24 hours
+
## v1.4.1
### Fixed
diff --git a/lib/plausible_web/plugs/tracker.ex b/lib/plausible_web/plugs/tracker.ex
index 31780c53d3..71d6032741 100644
--- a/lib/plausible_web/plugs/tracker.ex
+++ b/lib/plausible_web/plugs/tracker.ex
@@ -66,6 +66,7 @@ defmodule PlausibleWeb.Tracker do
|> put_resp_header("x-content-type-options", "nosniff")
|> put_resp_header("cross-origin-resource-policy", "cross-origin")
|> put_resp_header("access-control-allow-origin", "*")
+ |> put_resp_header("cache-control", "public, max-age=86400, must-revalidate")
|> send_file(200, location)
|> halt()
end