Commit Graph

8 Commits

Author SHA1 Message Date
Artur Pata cc5ca4b752
Script v2: Apply prettier (#5718)
* Apply prettier

* Fix issue with quotes in test setup

* Fix other issues with customSubmitHandlerStub

* Fix format with cookies fixtures
2025-09-15 11:21:27 +00:00
Artur Pata 757cf95070
Script v2: Adds linter and prettier, satisfies linter (#5691)
* Install deps and create config

* Satisfy linter in tests

* Silence redeclare warnings

* Remove shadowed/redeclared variables

* Update changelog
2025-09-04 04:56:42 +00:00
Karl-Aksel Puulmann 428d9893e3
ScriptV2: Allow customizing lib passed from init (#5641)
* Allow customizing lib passed from init

Going to be used by GTM (and possibly wordpress) to make it easier to detect what source was used for install

* chore: Bump tracker_script_version to 28
2025-08-18 09:06:15 +00:00
Artur Pata a533116444
Fix unexpected config switch from calling init twice with plausible web (#5601) 2025-08-04 10:26:40 +00:00
RobertJoonas 9be0b71233
Add `window.plausible` to NPM + `window.plausible.v2` (#5580)
* setWindowFlag

* bindToWindow

* set window.plausiuble.v2 flag

* chore: Bump tracker_script_version to 24

* fix billing test

* tracker changlog

* Update tracker/test/plausible-npm.spec.js

Co-authored-by: Artur Pata <artur.pata@gmail.com>

* update npm tracker changelog

* flattened window.plausible fields with more info

* remove unused function + readme update

---------

Co-authored-by: Karl-Aksel Puulmann <oxymaccy@gmail.com>
Co-authored-by: RobertJoonas <RobertJoonas@users.noreply.github.com>
Co-authored-by: Artur Pata <artur.pata@gmail.com>
2025-07-22 10:06:46 +00:00
Karl-Aksel Puulmann 1f86ae55ef
ScriptV2: `callback`, file downloads and `logging` changes (#5514)
* Make logging in tracker script configurable

* Improved callbacks

* Improved fileDownloads

* Export DEFAULT_FILE_TYPES

* Cross-browser compatibility

* Rename

* Rename a test

* chore: Bump tracker_script_version to 20
2025-06-19 08:45:20 +00:00
Karl-Aksel Puulmann 595e71a399
ScriptV2: NPM library codebase (#5459)
* Compile NPM modules into commonjs and esm modules

Note that since the module uses only vanilla es5 outside the export,
it's safe to just append to the minified output

* package.json, Typescript definition, generation for commonjs

* Scrap commonjs for the moment

Running into too big rabbit holes trying to get it off the ground

* Shared tests for npm and web

* Better way to identify npm module in fixture

* Simplify code

* Add NPM library specific tests

* Fix a flaky test

* Standardize a callsite

* npm_package standardize on

* Make legacy variant code more explicit

* Wrap code pre and post

* analyze-sizes.js should work with npm_package

* Port test changes from PR #5432

* Update outbound link feature test

* Await callInit

* Smaller npm module - mangle variables

* Clean up wrapping code

* chore: Bump tracker_script_version to 15

* Add debug messaging to expect

* Remove dead code

* Refactor, account for initialization delays in tests

* Remove needless features from compiler

As the compiler currently manages to compile everything in ~3 seconds,
the `features`/`compileIds` feature serves no more point. Scrapping it

* Re-inline readOutput

* Update tracker/test/plausible-npm.spec.js

Co-authored-by: Artur Pata <artur.pata@gmail.com>

* Remove redundant comment

---------

Co-authored-by: Artur Pata <artur.pata@gmail.com>
2025-06-04 10:47:44 +00:00
Karl-Aksel Puulmann 426ae49ed1
Proposal: ScriptV2 bundler (#5449)
* Experiment with rollup bundler

* WIP: Unbundle

* Always allow overriding url with options.u

* fix conditional

* Update manual conditional #2

* Unbundle custom events code

* Unbundle autocapturing of pageviews

* Comment Object.assign

* Rename functions in compiler

* Rename trigger -> track, unbundle

* Dont rely on window.plausible in custom-events.js

* chore: Bump tracker_script_version to 14

* Cherry-pick PR #5462
2025-06-04 07:36:02 +00:00