All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Bump
@metamask/utilsfrom^12.0.2to^12.1.0(#11796)
- Add
marketingConsentSyncPendingstate toAnalyticsControllerto record a marketing consent choice made on this device that has not been saved to the user's account yet (#11469)- The field is persisted, defaults to
false, and can be read with the newselectMarketingConsentSyncPendingselector.
- The field is persisted, defaults to
- Add
applyRemoteMarketingConsentmethod andAnalyticsController:applyRemoteMarketingConsentaction (#11469)- Applies a marketing consent value read from the user's account, with the same side effects as
optInToMarketing/optOutOfMarketing, without marking it as waiting to be saved. - Does nothing while a local choice is waiting to be saved, or if the same value is already decided.
- Applies a marketing consent value read from the user's account, with the same side effects as
- Add
clearMarketingConsentSyncPendingmethod andAnalyticsController:clearMarketingConsentSyncPendingaction (#11469)- Clears
marketingConsentSyncPendingif local marketing consent still matches the given value, so a newer local choice stays pending.
- Clears
- Bump
@metamask/utilsfrom^12.0.1to^12.0.2(#11474) optInToMarketingandoptOutOfMarketingnow setmarketingConsentSyncPendingtotruein the same state update as the consent change (#11469)resetMarketingConsentDecisionnow setsmarketingConsentSyncPendingtofalse(#11469)- Bump
uuidfrom^14.0.2to^14.0.3(#11645)
- Bump
@metamask/config-registry-controllerfrom^5.0.0to^6.0.0(#11447)
- Allow an optional
propertiesargument ontrackErrorAsAnalyticsso callers can attach extra payload fields such asanonymous: truewhile keeping sanitizedsourceanderror_message(#11355)
- Add
trackErrorAsAnalyticsonAnalyticsControllerto report caught errors asError Occurredevents with a uniquesourceand a sanitizederror_message, bounded by sampling, deduplication, and a per-session cap (#11051)
- Bump
@metamask/utilsfrom^12.0.0to^12.0.1(#11107) - Bump
uuidfrom^11.1.1to^14.0.2(#10941, #11179, #11305)
- Add support for Node.js 26 (#10981)
- Accept partial initial
stateas long asanalyticsIdis provided (#10901) - Bump
@metamask/base-controllerfrom^10.0.0to^10.1.0(#10864)
- BREAKING:
AnalyticsControllerMessengerrequiresConfigRegistryController:getStatein its allowed actions andConfigRegistryController:stateChangedin its allowed events (#10448) - Update
AnalyticsController.initto listen for ConfigRegistryController state changes and update in-memory event-purpose classification when the version differs (#10448) - Add
@metamask/config-registry-controller^4.0.0as a dependency (#10448) - Bump
lodash-esfrom^4.17.21to^4.18.1(#10447) - Bump
@metamask/config-registry-controllerfrom^4.0.0to^5.0.0(#10658)
- Add
marketingCampaignCookieIdstate field andsetMarketingCampaignCookieIdaction toAnalyticsController; the field is automatically set tonullwhen the user callsoptOutOfMarketingorresetMarketingConsentDecision(#10373)
- Add independent marketing consent and purpose-aware event classification (#10232)
- Adds
optedInToMarketing,optInToMarketing/optOutOfMarketing/resetMarketingConsentDecision, and a persistedeventsConfigwhose unlisted events default to product-only - Named
trackandviewpayloads are delivered once with their allowed purposes incontext.consent.categoryPreferencesand their capture-time config version incontext.eventsConfigVersion - Queues and fragments retain capture-time purpose classification so config changes cannot reclassify captured events. Mixed-purpose fragments classify each declared lifecycle event independently
- Adds
- Bump
uuidfrom^8.3.2to^11.1.1(#10117, #10243) - Bump
@metamask/utilsfrom^11.12.0to^12.0.0(#10192)
- BREAKING: Drop CommonJS support (#9536)
- This package is now ESM-only, but can still be used in CommonJS projects via
require(esm)in modern Node.js versions (22+), or dynamic imports in older Node.js versions.
- This package is now ESM-only, but can still be used in CommonJS projects via
- BREAKING: Bump minimum Node.js version to 22 (#9976)
- BREAKING: Bump TypeScript target to ES2022 (#10019)
- This package now ships ES2022 code, requiring a compatible modern environment or bundler configuration to consume.
- Bump
@metamask/base-controllerfrom^9.1.0to^10.0.0(#10160) - Bump
@metamask/geolocation-controllerfrom^1.0.0to^2.0.0(#10160) - Bump
@metamask/messengerfrom^2.0.0to^3.0.0(#10160)
- Add optional event fragments to
AnalyticsController(disabled by default viaisEventFragmentsEnabled), letting clients accumulate analytics properties across a user journey and optionally emit an initial, success, or failure event for it (#10055)
- Bump
@metamask/utilsfrom^11.11.0to^11.12.0(#10076)
- BREAKING: Optionally enrich non-anonymous track, identify, and view payloads with the user's
country_code,region, andtimezoneundercontext.location, gated behind the newisGeolocationEnabledconstructor option (defaultfalse) (#9691, #9728)AnalyticsController.initandAnalyticsController.optInare now asynchronous and return aPromise<void>, so await them before tracking events- When enabled, geolocation is resolved via
GeolocationController:getGeolocationData(which compositions must register) only after the user opts in, so location is never requested before they consent to analytics; queued pre-consent events are then enriched on replay (anonymous payloads excluded) - Adds
@metamask/geolocation-controller^0.1.3as a dependency
- Bump
@metamask/messengerfrom^1.2.0to^2.0.0(#9392) - Bump
@metamask/geolocation-controllerfrom^0.1.3to^1.0.0(#9735)
- Preserve the pre-consent event queue when calling
resetConsentDecision, matching extension behavior for undecided consent resets during onboarding restarts (#9284)
- Add optional pre-consent event queue to
AnalyticsController(disabled by default viaisPreConsentQueueEnabled), with aconsentDecisionMadestate field,selectConsentDecisionMadeselector, andresetConsentDecisionaction (#9252)
- Bump
@metamask/utilsfrom^11.9.0to^11.11.0(#9074)
- Clear persisted analytics event queue entries after the delivery callback runs, including when the callback reports an error. (#8934)
- Optional persisted event queue support in
AnalyticsController, disabled by default. (#8797) - Add optional analytics context on
trackEvent,identify, andtrackViewto forward platform-specific context toAnalyticsPlatformAdapterimplementations (#8835) - Optional
skipUUIDv4CheckonAnalyticsPlatformAdapterto allow non-UUIDv4analyticsIdstrings when constructingAnalyticsController(#8543)
- Mark
analyticsIdas persisted (persist: true) inAnalyticsControllerstate metadata so it is saved and restored withoptedInwhen using a persisted controller composition (#8542) - Bump
@metamask/messengerfrom^1.0.0to^1.2.0(#8364, #8373, #8632) - Bump
@metamask/base-controllerfrom^9.0.1to^9.1.0(#8457)