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

* Fix order of setting window.plausible.l = true

* chore: Bump tracker_script_version to 25

---------

Co-authored-by: apata <apata@users.noreply.github.com>
This commit is contained in:
Artur Pata 2025-07-23 16:00:26 +03:00 committed by GitHub
parent 144b58e508
commit 57400ab90b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 4 deletions

View File

@ -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`.

View File

@ -1,5 +1,5 @@
{
"tracker_script_version": 24,
"tracker_script_version": 25,
"type": "module",
"scripts": {
"deploy": "node compile.js",

View File

@ -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
}
}