Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix removal of context generator functions (v4) #1362

Closed

Conversation

jethron
Copy link
Contributor

@jethron jethron commented Oct 25, 2024

This is the same as #1361 but for v4.

igneel64 and others added 30 commits July 26, 2024 08:28
)

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 snowplow#1076)

PR snowplow#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 (snowplow#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.
…nowplow#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 (snowplow#1329) and Link Click Tracking (snowplow#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
Copy link

bundlemon bot commented Oct 25, 2024

BundleMon

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

Total files change +105.31KB 0%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history

@matus-tomlein
Copy link
Contributor

I have rebased the release/4.0.0 branch on top of master, so I think this PR is not necessary since we got the change from the v3 release in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants