Skip to content

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

Fix order of setting window.plausible.l = true (#5588)

Artur Pata57400ab90b2c
diff --git a/tracker/npm_package/CHANGELOG.md b/tracker/npm_package/CHANGELOG.md
index 6b27de25cb..07b8057e07 100644
--- a/tracker/npm_package/CHANGELOG.md
+++ b/tracker/npm_package/CHANGELOG.md
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
+- Plausible loaded indicator `window.plausible.l = true` is set last in initialisation functions
+
## [0.3.3] - 2025-07-22
- Bind the `track` function into `window.plausible`. This makes it possible for the Plausible verification agent to verify a successful installation. Can be disabled setting the `bindToWindow` config option to `false`.
diff --git a/tracker/package.json b/tracker/package.json
index e331c5d7ae..66ce925351 100644
--- a/tracker/package.json
+++ b/tracker/package.json
@@ -1,5 +1,5 @@
{
- "tracker_script_version": 24,
+ "tracker_script_version": 25,
"type": "module",
"scripts": {
"deploy": "node compile.js",
diff --git a/tracker/src/plausible.js b/tracker/src/plausible.js
index 87a7856102..6dbf34bb9b 100644
--- a/tracker/src/plausible.js
+++ b/tracker/src/plausible.js
@@ -34,21 +34,22 @@ function init(overrides) {
window.plausible = track
window.plausible.init = init
- window.plausible.l = true
window.plausible.v = COMPILE_TRACKER_SCRIPT_VERSION
-
+
if (COMPILE_PLAUSIBLE_WEB) {
window.plausible.s = 'web'
}
+
+ window.plausible.l = true
}
// Bind to window to be detectable by the verifier tool
// This is done in a 'safe' way to avoid breaking the page if window is frozen or running without window
if (COMPILE_PLAUSIBLE_NPM && config.bindToWindow && typeof window !== 'undefined') {
window.plausible = track
- window.plausible.l = true
window.plausible.s = 'npm'
window.plausible.v = COMPILE_TRACKER_SCRIPT_VERSION
+ window.plausible.l = true
}
}