analytics icon indicating copy to clipboard operation
analytics copied to clipboard

Script v2: Remove delays except when using .compat extension

Open apata opened this issue 6 months ago • 2 comments

Changes

Removes delays and navigation related overrides from tracker script, except when using .compat extension. This is possible because fetch with keepalive: true reliably sends events that happen during navigating away.

Tests

  • [ ] Automated tests have been added
  • [ ] This PR does not require tests

Changelog

  • [ ] Entry has been added to changelog
  • [ ] This PR does not make a user-facing change

Documentation

  • [ ] Docs have been updated
  • [ ] This change does not need a documentation update

Dark mode

  • [ ] The UI has been tested both in dark and light mode
  • [ ] This PR does not change the UI

apata avatar Jun 03 '25 13:06 apata

Analyzed 1026 tracker script variants for size changes. The following tables summarize the results, with comparison with the baseline version in parentheses.

Main variants:

Brotli Gzip Uncompressed
npm_package/plausible.js (new variant) 2340B 2665B 6277B
plausible-web.js 2184B (-149B / -6.4%) 2497B (-178B / -6.7%) 5903B (-436B / -6.9%)

Important legacy variants:

Brotli Gzip Uncompressed
plausible.js 1158B (+3B / +0.3%) 1346B (-4B / -0.3%) 2944B (+0B / 0%)
plausible.hash.js 1119B (+0B / 0%) 1312B (-4B / -0.3%) 2830B (+0B / 0%)
plausible.pageview-props.tagged-events.js 1696B (-164B / -8.8%) 1970B (-196B / -9%) 4435B (-423B / -8.7%)
plausible.file-downloads.hash.pageview-props.revenue.js 1553B (-127B / -7.6%) 1828B (-150B / -7.6%) 3847B (-357B / -8.5%)
plausible.compat.exclusions.file-downloads.outbound-links.pageview-props.revenue.tagged-events.js 2285B (+2B / +0.1%) 2703B (+1B / +0%) 6042B (+4B / +0.1%)

Summary:

Brotli Gzip Uncompressed
Largest variant (plausible.compat.exclusions.file-downloads.outbound-links.pageview-props.revenue.tagged-events.js) 2285B (+2B / +0.1%) 2703B (+1B / +0%) 6042B (+4B / +0.1%)
Max change (plausible.exclusions.local.manual.pageview-props.js) 1156B (+23B / +2%) 1356B (-4B / -0.3%) 2745B (+0B / 0%)
Min change (plausible.hash.local.manual.outbound-links.js) 1089B (-130B / -10.7%) 1309B (-155B / -10.6%) 2670B (-338B / -11.2%)
Median change 1646.5B (-4B / -0.2%) 1951B (-5B / -0.3%) 4198B (+0B / 0%)

In total, 307 variants brotli size increased and 616 variants brotli size decreased.

github-actions[bot] avatar Jun 03 '25 13:06 github-actions[bot]

Preview environment👷🏼‍♀️🏗️
PR-5465

github-actions[bot] avatar Jun 11 '25 08:06 github-actions[bot]

Preview environment👷🏼‍♀️🏗️
PR-5465

github-actions[bot] avatar Jun 18 '25 15:06 github-actions[bot]

Preview environment👷🏼‍♀️🏗️
PR-5465

github-actions[bot] avatar Jun 18 '25 15:06 github-actions[bot]

Preview environment👷🏼‍♀️🏗️
PR-5465

github-actions[bot] avatar Jun 18 '25 15:06 github-actions[bot]