Commit Graph

12 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 619a9ed57b
ScriptV2: Use async instead of defer, new snippet (#5655)
* async -> defer

* Run legacy tests using async instead of defer
2025-08-25 07:12:11 +00:00
Artur Pata a01f8e1c05
Update playwright (#5432)
* Refactor mock-many-requests

* Add commented fallback route

* Fix outbound link tracking expectation, fix file downloads import

* Remove console logs

* Add test skips and remove unnecessary skip

* Revert test name change

* Remove webkit related conditional in test expectations

* chore: Bump tracker_script_version to 13

---------

Co-authored-by: apata <apata@users.noreply.github.com>
2025-06-03 09:03:55 +00:00
Karl-Aksel Puulmann 7265d04a8c
ScriptV2: Improved tracker compile.js (#5363)
* Add CLI arguments to compile.js and logging

* Rename folder

* Extract compile code, es modules

* Add a progress bar

* Remove handlebars

* Update report-sizes

* Remove debug code

* inline

* More generous split

* Allow positional arguments for compiling

* Add watch option to compile

* Add compileFile logic

* Most tests run under playwright

* All tests runnable

* Update playwright, remove hack

Note that upgrading to latest failed due to a new test failure. This
might be due to a chrome update.

* Compile script on the fly for tests

* Minor refactor for compileAll

* es module for generate-variants.js

* Allow passing suffix to compilation script - this can be used to generate separate files for comparison

* Fix positionals

* Switch from 2 passes to 1 pass

Did some data analysis on this data:
- Compared to master, 1 pass increased brotli size by 0.7%, 2 passes 0.4%.

Given the change is insignificant enough, we can ignore it for now

The increase is likely due to order of operations in compilation and
some inlined functions getting lost.

* Move customEvents.js to plausible.js

* Clean up API

* Suffix default

* Rework variants.json, globals stored there

* Add more variants under test

* Distribute work across multiple worker threads

Compile time went on my machine from 60s -> 30s

* Fixup server

* Update canSkipCompile

* chore: Bump tracker_script_version to 7

* Update scripts

* Update node-version

* Experiment with adding a small delay to page

* Casing

* rename variable

* Update help text

* features -> compileIds, backport functionality from other branch
2025-05-08 07:05:09 +00:00
Karl-Aksel Puulmann 539f4a3f98
Tracker script version reported to /api/event (#5198)
* WIP

* tracker_script_version over reportedVersion

Will make it easier to grep for this thing

* CHANGELOG.md

* Only add tracker/package.json in workflow commit

* chore: Bump tracker_script_version to 1

* Show tracker_script_version is reported in tracker tests

* Track `engagement_time` while accounting for time page is blurred (#5206)

Consider this scenario:
1. User opens page /blog
2. 3 seconds later, alt-tabs to another window
3. minute later, alt-tabs to the page and closes it

Previously, this would be reported as 1m03s engagement_time. Now this
would be reported as 3s engagement_time.

* remove redundant engagement cooldown (#5199)

---------

Co-authored-by: RobertJoonas <56999674+RobertJoonas@users.noreply.github.com>
2025-03-18 07:30:17 +00:00
Uku Taht c85862e9ed
Access document more defensively (#5148)
* Access document more defensively

* Add test
2025-03-05 16:06:06 +00:00
Karl-Aksel Puulmann 63b732eb36
Tracker: Track only engagements (pageleave extension) (#5039)
* Tracker: Remove tracking pageleaves

* chore(tracker): rename html files

* Update comment
2025-02-06 11:35:10 +00:00
Karl-Aksel Puulmann 8e7520c944
Tracker: Run tests on safari (#5038) 2025-02-04 10:48:27 +00:00
Karl-Aksel Puulmann 334f8bbdfc
Tracker: Send `engagement` events on visibilitychange (if pageleave extension) (#5023)
* Separate `engagement` event triggered on visibilitychange

* Set up shared tests for engagement requests and pageleaves

* Store scroll_depth on engagement events

* Move test to be shared

* Update cache_store
2025-01-29 06:30:41 +00:00
RobertJoonas f262bea316
Average Scroll Depth Metric: Track custom props on pageleaves (#4964)
* improve tracker test util to handle custom props

* track pageleave props

* make test util more powerful

* also test with pageview-props extension

* add test for sending props on hash navigation

* simplify tracker logic around currentPageLeaveURL

* clarify the intent of a timeout by extracting a fn

* bugfix: stop sending pageleaves from ignored pages

+ fix the test to actually fail if this doesn't work.

* refactor: drop expectCustomEvent in favour of the new test util

* add test for pageleave props ingestion

* add query tests

* improve test util readability
2025-01-16 15:06:19 +00:00
RobertJoonas 2a7d02b6f0
Average Scroll Depth Metric: extracted tracker changes (#4826)
* (cherry-pick) implement scroll depth tracking under pageleave variant

* drop unnecessary vars

* remove unused require

* add scroll depth tests

* improve error messages in test util

* reevaluate currentDocumentHeight on page load

* account for dynamically loaded content when initializing documnent height

* remove all semicolons from tracker specs

* allow window and document globals in tracker eslint

* tweak global tracker dir eslint rules

* update comment

* reevaluate document height on scroll

* add test

* remove unneccessary timeout
2024-11-21 14:29:52 +00:00