Skip to content

Release/4.0.0 - #1364

Merged
Matus Tomlein (matus-tomlein) merged 34 commits into
masterfrom
release/4.0.0
Oct 28, 2024
Merged

Release/4.0.0#1364
Matus Tomlein (matus-tomlein) merged 34 commits into
masterfrom
release/4.0.0

Conversation

@matus-tomlein

Copy link
Copy Markdown
Contributor

The release adopts the fetch API for making requests to the Snowplow collector which provides the keepalive option that enables requests to outlive the webpage they were made from.

Performance of the track calls has been improved by making cookie writes async. Our benchmarks show this improves the time it takes to track 100 events to a third of what it was in v3.

The tracker APIs have been significantly improved and simplified:

  • Form and link click tracking now support event delegation and don’t require the app to refresh the tracking after page changes.
  • It’s now easier to manage global context using named tags.
  • Plugins add a new filter function to enable skipping events.
  • The tracker API on Node.JS has been significantly revised and streamlined also thanks to the use of the fetch API.

Other changes include the YouTube and HTML5 media plugins adopting new media schemas, upgrades to the UUID package, revised defaults, and removal and deprecation of older plugins.

Enhancements

Removed deprecated functionality

Upgraded internals

Other improvements and fixes

@bundlemon

bundlemon Bot commented Oct 25, 2024

Copy link
Copy Markdown

BundleMon

Files added (6)
Status Path Size Limits
trackers/javascript-tracker/dist/sp.js
+24.43KB 30KB / +10%
libraries/browser-tracker-core/dist/index.mod
ule.js
+23.44KB 25KB / +10%
libraries/tracker-core/dist/index.module.js
+19.4KB 20KB / +10%
trackers/browser-tracker/dist/index.umd.min.j
s
+17.33KB 20KB / +10%
trackers/javascript-tracker/dist/sp.lite.js
+17.27KB 20KB / +10%
trackers/browser-tracker/dist/index.module.js
+3.49KB 5KB / +10%

Total files change +105.36KB 0%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history

Add deprecation warning on ecommerce, enhanced ecommerce, consent, optimizely and browser-features packages
* link-click-tracking: event delegation

- Global event listeners are now used instead of per-element listeners
- `refreshLinkClickTracking` is now deprecated and does nothing as it
  should no longer be required (but still exists for API compatibility)
- There is now a `disableLinkClickTracking` method to balance
  `enableLinkClickTracking`
- `trackLinkClick` can now optionally be passed a link element directly,
  rather than requiring manual construction of the event payload
- Event listeners now use the capture phase instead of bubble
- Link URIs are no longer unescaped
- Additional unit tests for link click tracking
- Global event listeners are now used instead of per-element listeners
- Event listeners now use the capture phase instead of bubble
- Forms added after the initial `enableFormTracking` call should
  automatically be tracked without needing additional calls
- Field value transform functions can now return `null` for all events
- Add unit tests for form tracking
- The new `targets` parameter allows listening for forms in only a
  subset of the document tree, or across multiple same-origin documents
  (e.g. iframes)
The `addGlobalContexts` API now accepts an `object` mapping "names" to context primitives or context generators, rather than just an array of "unnamed" global entities/generators.

Calling `addGlobalContexts` multiple times with values of the same "name" will overwrite the previous value for subsequent events, allowing "upserting" or updating of global context without having to remove the previous version first and introducing duplicates.

`removeGlobalContexts` can now also accept plain strings which are handled as names, so primitives/generators can be removed by name without having to own a reference to the generating function or an object that serializes to the same string.
…kers and refactor emitter and event store interfaces (close #1076)

PR #1337
The `error` event fires on the `window` both when an unhandled JavaScript
exception is thrown or a resource fails to load. Rather than track a message
presuming the former, attempt to detect the latter and specify the
failed resource.

See also:
- https://developer.mozilla.org/en-US/docs/Web/API/Window/error_event
- https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/error_event
…eprecate enhanced ecommerce and performance timing plugins and add web vitals by default (#1345)

Removed plugins
- browser-features
- optimizely
- ecommerce
- consent

Deprecated plugins
- enhanced ecommerce
- performance timing

Added default plugins in sp.js
- web vitals (needs configuration to be enabled)

Removed default plugins in sp.js
- optimizely-x
- timezone

 Other changes
- Add an option to enable performance navigation timing
In v3, `discoverRootDomain` was disabled by default, and enabling it
meant ignoring the `cookieDomain` configuration. If neither were set,
cookies would have no `Domain` attribute attached and would bind to the
current domain; cookies with no domain are unique in that they do not
get shared to subdomains.

In 257ddb3 we updated
the `discoverRootDomain` setting to default to enabled, and changed how it
interacted with the `cookieDomain` setting so that `discoverRootDomain`
is essentially always enabled, but gets ignored if `cookieDomain` is
also specified. This however made it impossible to use the 'no domain'
behaviour available in v3, because disabling `discoverRootDomain` would
have no effect without specifying `cookieDomain` as well.

This can be slightly confusing, so instead, this change allows
explicitly disabling `discoverRootDomain` even if no `cookieDomain` is
specified, allowing the same behaviour as all configurations available
in v3.
…1352)

In POST requests this usually results in a smaller payload size, and is easier to debug.
The node tracker shares this setting across multiple emitters that may not all use POST so we can't make this assumption there.
This changes the default behaviour of the GA Cookies plugin to look for GA4 cookies instead of Universal Analytics cookies.

This uses the iglu:com.google.ga4/cookies/jsonschema/1-0-0 schema instead of iglu:com.google.analytics/cookies/jsonschema/1-0-0, so it is a breaking change.
In v4 we switched the Form Tracking (#1329) and Link Click Tracking (#1325) plugins to using capture-phase event listeners instead of bubble-phase.

This makes the same change for the Button Click Tracking plugin to make it consistent.

This has caused issues for some clients historically, e.g. BCPF-1421 where pages stopping propagation of event bubbling prevented buttons being tracked.
* Support clicks on buttons/links in ShadowDOMs

* Detect form events within ShadowRoots
Include some Snowtype-generated code as tests.
* Migrate to v2 schemas for youtube-tracking plugin

See PE-5753.

* Run rush change

* Remove unneeded license headers

* Add return type for buildYouTubeEntity

* Change evaluation of paused state

* Add (start/end)YouTubeTracking APIs

* Always poll and call updateMediaTracking

* Fix seek timestamps

* Fix YT e2e tests

* rush update

* Fix build

* Make default ping state explicit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants