* Do not send duplicate tagged form events
* Update changelog
* chore: Bump tracker_script_version to 22
* Share HTML fixture
---------
Co-authored-by: apata <apata@users.noreply.github.com>
* Make delays conditional on COMPILE_COMPAT, otherwise rely on keepalive fetch
* Add tests
* Fix webkit related test file-download feature tests issues
* Remove ternaries for scriptConfig in tests
* Make sure .compat scripts don't contain unreachable code blocks
* Test legacy .compat extension in a separate block
* Tests for tagged events
* Remove extraneous tests, add needed tests
* Add tests for v2 features overlap and outbound link clicks
* Add changelog, add current behaviour test for outbound links
* Remove mockRequest, unify API
* Fix coverage of legacy compat navigation, add back interactive event test
* chore: Bump tracker_script_version to 21
* Update specs
* Fix issues with _ variable
* Fix args
* Types and formatting cleanup
---------
Co-authored-by: apata <apata@users.noreply.github.com>
* 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>
* Track form submissions
* chore: Bump tracker_script_version to 11
* Check that script loadedin tests
* Track form submissions
* Fix format
* Fix missing form submit handler
* Make id casing consistent
* Automatically sync compiled script snippet in dynamic test pages
* Enforce format manually
* Skip one test on Firefox, explain reason for stub
* Revert "Automatically sync compiled script snippet in dynamic test pages"
This reverts commit 7622b23f31.
---------
Co-authored-by: apata <apata@users.noreply.github.com>
* 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
* 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>
* Track engagement time in plausible.js
* Test page going between background and foreground without sending
* Rename some variables
* Add comment on when we send information or not
* Extract a function
* Test SPA navigation
* Raise threshold
* Update tracker/src/plausible.js
Co-authored-by: RobertJoonas <56999674+RobertJoonas@users.noreply.github.com>
---------
Co-authored-by: RobertJoonas <56999674+RobertJoonas@users.noreply.github.com>
* 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
* Register `pageleave` listener earlier
Currently, pageleave listener is only registered when a successful
response is received from plausible API.
After this change pageleave listener is registered immediately when
pageview is triggered, hopefully increasing capture rate.
* Codespell
* 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
* move util function to util module
* move playwright config file to tracker dir root
* update Playwright + add gitignores
* Playwright: enable reuseExistingServer (non-CI env)
* store tracker src copies to avoid re-compilation in dev env
* test pageleave on simple navigation
* fix test util fn
* rename local_test npm script
* make test util able to expect multiple requests
* test pageleaves in SPAs
* test pageleave with manual URL
* test pageleave not sent in manual when pageview not triggered
* extend util fn to refute event requests
* test pageleaves not sent in excluded hash pages
* store hashes instead of file copies to detect /tracker/src changes
* drop async
* speed up test suite
* Use user-agent instead of screen_width to get device type
Co-authored-by: eriknakata <erik.nakata5@gmail.com>
* Fix credo
* Log on unhandled UAInspector device type
* Make 'browser' the default tab in devices report
* Remove device tooltip
* Remove screen_width from ingestion completely
* Remove browserstack harness, run playwright directly
* Select meta key based on OS platform
* Run CI tests in parallel
* Improve device match readability
* Add changelog
---------
Co-authored-by: eriknakata <erik.nakata5@gmail.com>
* moved custom event code to the bottom + fix indentation
* add handlebars helper fn + extract getLinkEl fn
* extract isOutboundLink function
* extract shouldFollowLink function
* remove middle and click variables
* use only one click handler for outbounds and downloads
* extract sendLinkClickEvent function
* add error handling when script compilation fails
* use callback instead of fixed timeout
* do not prevent default if externally prevented + test
* add more tests
* generate tracker files in priv/tracker/js
* update changelog
* requested changes after review
* regenerate tracker files
* use return instead of else if
* move middleMouseButton outside the function
* Add basic test harness for browserstack/playwright
* Refactor the tests
* added the first test for outbound links
* tests for outbound-links and file-downloads
* added more browser versions to test on
* Lint tracker test files
* Update harness.js with BrowserStack example
* Fix Playwright request mocks
* Add test harness to CI
* Remove Safari on Windows from browsers list
Co-authored-by: Robert <robertjoonas16@gmail.com>
Co-authored-by: Vinicius Brasil <vini@hey.com>