@metamask-previews/analytics-controller 4.1.0-preview-9b251c589 → 4.1.0-preview-6ebaf4e52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,10 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ### Added
11
-
12
- - Add `trackErrorAsAnalytics` on `AnalyticsController` to report caught errors as `Error Occurred` events with a unique `source` and a sanitized `error_message`, bounded by sampling, deduplication, and a per-session cap ([#11051](https://github.com/MetaMask/core/pull/11051))
13
-
14
10
  ### Changed
15
11
 
16
12
  - Bump `@metamask/utils` from `^12.0.0` to `^12.0.1` ([#11107](https://github.com/MetaMask/core/pull/11107))
package/README.md CHANGED
@@ -115,26 +115,6 @@ Fragments are removed when they are finalized, deleted, or when no eligible purp
115
115
 
116
116
  This feature is disabled by default. When disabled, every fragment method is a logged no-op and no fragment is written to state.
117
117
 
118
- ## Error events
119
-
120
- `trackErrorAsAnalytics` reports a caught error as an `Error Occurred` event. The properties are `source` and `error_message`. The message is whitespace-normalized and capped at 500 characters. Stack traces are not included.
121
-
122
- `source` must uniquely identify the error case (for example `swap-quote-fetch`). Do not reuse one value for every error in a file or package.
123
-
124
- The call is fail-safe and returns without throwing. Events use the same consent gate as `trackEvent`. An opted-out user does not emit an event and does not consume the session budget.
125
-
126
- Volume is bounded per controller instance:
127
-
128
- - `samplingRate` defaults to `1` and is clamped to the range 0 through 1. A rate of `0` never emits.
129
- - `dedupWindowMs` defaults to `10000`. The same source and message are suppressed inside that window.
130
- - `sessionCap` defaults to `50`. A caller can only lower that ceiling.
131
-
132
- ```ts
133
- controller.trackErrorAsAnalytics(error, {
134
- source: 'swap-quote-fetch',
135
- });
136
- ```
137
-
138
118
  ## Lifecycle Hooks
139
119
 
140
120
  ### `onSetupCompleted`
@@ -15,39 +15,6 @@ export type AnalyticsControllerTrackEventAction = {
15
15
  type: `AnalyticsController:trackEvent`;
16
16
  handler: AnalyticsController['trackEvent'];
17
17
  };
18
- /**
19
- * Report a caught error as an `Error Occurred` analytics event.
20
- *
21
- * Properties are `source` and a sanitized `error_message`. Whitespace is
22
- * collapsed and the message is capped at 500 characters. Stack traces are
23
- * never included.
24
- *
25
- * `source` must uniquely identify the error case (for example
26
- * `swap-quote-fetch`). Do not reuse one value for every error in a file
27
- * or package.
28
- *
29
- * Sampling, a deduplication window, and a per-session cap bound volume.
30
- * Those controls default to always emitting, 10 seconds, and 50 events.
31
- * A caller can only lower the session cap. The budget belongs to this
32
- * controller instance and is not persisted.
33
- *
34
- * Delivery goes through {@link trackEvent}, so consent gating, the
35
- * pre-consent queue, and geolocation enrichment all apply. Opted-out
36
- * calls return before the volume controls run, so they do not consume
37
- * the session budget.
38
- *
39
- * Fail-safe: this method never throws. If delivery throws, the session
40
- * reservation is released.
41
- *
42
- * @param error - The caught value to report.
43
- * @param options - Source and optional volume controls.
44
- * @param options.source - Unique discriminator for this error case.
45
- * @param options.volumeControls - Optional sampling, dedup, and session cap.
46
- */
47
- export type AnalyticsControllerTrackErrorAsAnalyticsAction = {
48
- type: `AnalyticsController:trackErrorAsAnalytics`;
49
- handler: AnalyticsController['trackErrorAsAnalytics'];
50
- };
51
18
  /**
52
19
  * Identify a user for analytics.
53
20
  *
@@ -259,5 +226,5 @@ export type AnalyticsControllerSetMarketingCampaignCookieIdAction = {
259
226
  /**
260
227
  * Union of all AnalyticsController action types.
261
228
  */
262
- export type AnalyticsControllerMethodActions = AnalyticsControllerTrackEventAction | AnalyticsControllerTrackErrorAsAnalyticsAction | AnalyticsControllerIdentifyAction | AnalyticsControllerTrackViewAction | AnalyticsControllerCreateEventFragmentAction | AnalyticsControllerUpsertEventFragmentAction | AnalyticsControllerUpdateEventFragmentAction | AnalyticsControllerGetEventFragmentByIdAction | AnalyticsControllerDeleteEventFragmentAction | AnalyticsControllerFinalizeEventFragmentAction | AnalyticsControllerOptInAction | AnalyticsControllerOptOutAction | AnalyticsControllerResetConsentDecisionAction | AnalyticsControllerOptInToMarketingAction | AnalyticsControllerOptOutOfMarketingAction | AnalyticsControllerResetMarketingConsentDecisionAction | AnalyticsControllerSetMarketingCampaignCookieIdAction;
229
+ export type AnalyticsControllerMethodActions = AnalyticsControllerTrackEventAction | AnalyticsControllerIdentifyAction | AnalyticsControllerTrackViewAction | AnalyticsControllerCreateEventFragmentAction | AnalyticsControllerUpsertEventFragmentAction | AnalyticsControllerUpdateEventFragmentAction | AnalyticsControllerGetEventFragmentByIdAction | AnalyticsControllerDeleteEventFragmentAction | AnalyticsControllerFinalizeEventFragmentAction | AnalyticsControllerOptInAction | AnalyticsControllerOptOutAction | AnalyticsControllerResetConsentDecisionAction | AnalyticsControllerOptInToMarketingAction | AnalyticsControllerOptOutOfMarketingAction | AnalyticsControllerResetMarketingConsentDecisionAction | AnalyticsControllerSetMarketingCampaignCookieIdAction;
263
230
  //# sourceMappingURL=AnalyticsController-method-action-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnalyticsController-method-action-types.d.ts","sourceRoot":"","sources":["../src/AnalyticsController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE;;;;;;;GAOG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;CAC5C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,MAAM,8CAA8C,GAAG;IAC3D,IAAI,EAAE,2CAA2C,CAAC;IAClD,OAAO,EAAE,mBAAmB,CAAC,uBAAuB,CAAC,CAAC;CACvD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C,IAAI,EAAE,8BAA8B,CAAC;IACrC,OAAO,EAA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"}
1
+ {"version":3,"file":"AnalyticsController-method-action-types.d.ts","sourceRoot":"","sources":["../src/AnalyticsController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE;;;;;;;GAOG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;CAC5C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C,IAAI,EAAE,8BAA8B,CAAC;IACrC,OAAO,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;CAC1C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,6CAA6C,GAAG;IAC1D,IAAI,EAAE,0CAA0C,CAAC;IACjD,OAAO,EAAE,mBAAmB,CAAC,sBAAsB,CAAC,CAAC;CACtD,CAAC;AAE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,qDAAqD,GAAG;IAClE,IAAI,EAAE,kDAAkD,CAAC;IACzD,OAAO,EAAE,mBAAmB,CAAC,8BAA8B,CAAC,CAAC;CAC9D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gCAAgC,GACxC,mCAAmC,GACnC,iCAAiC,GACjC,kCAAkC,GAClC,4CAA4C,GAC5C,4CAA4C,GAC5C,4CAA4C,GAC5C,6CAA6C,GAC7C,4CAA4C,GAC5C,8CAA8C,GAC9C,8BAA8B,GAC9B,+BAA+B,GAC/B,6CAA6C,GAC7C,yCAAyC,GACzC,0CAA0C,GAC1C,sDAAsD,GACtD,qDAAqD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"AnalyticsController-method-action-types.js","sourceRoot":"","sources":["../src/AnalyticsController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { AnalyticsController } from './AnalyticsController.js';\n\n/**\n * Track an analytics event.\n *\n * Events are only tracked if analytics is enabled.\n *\n * @param event - Analytics event with properties and sensitive properties\n * @param context - Optional platform-specific context forwarded to the platform adapter.\n */\nexport type AnalyticsControllerTrackEventAction = {\n type: `AnalyticsController:trackEvent`;\n handler: AnalyticsController['trackEvent'];\n};\n\n/**\n * Report a caught error as an `Error Occurred` analytics event.\n *\n * Properties are `source` and a sanitized `error_message`. Whitespace is\n * collapsed and the message is capped at 500 characters. Stack traces are\n * never included.\n *\n * `source` must uniquely identify the error case (for example\n * `swap-quote-fetch`). Do not reuse one value for every error in a file\n * or package.\n *\n * Sampling, a deduplication window, and a per-session cap bound volume.\n * Those controls default to always emitting, 10 seconds, and 50 events.\n * A caller can only lower the session cap. The budget belongs to this\n * controller instance and is not persisted.\n *\n * Delivery goes through {@link trackEvent}, so consent gating, the\n * pre-consent queue, and geolocation enrichment all apply. Opted-out\n * calls return before the volume controls run, so they do not consume\n * the session budget.\n *\n * Fail-safe: this method never throws. If delivery throws, the session\n * reservation is released.\n *\n * @param error - The caught value to report.\n * @param options - Source and optional volume controls.\n * @param options.source - Unique discriminator for this error case.\n * @param options.volumeControls - Optional sampling, dedup, and session cap.\n */\nexport type AnalyticsControllerTrackErrorAsAnalyticsAction = {\n type: `AnalyticsController:trackErrorAsAnalytics`;\n handler: AnalyticsController['trackErrorAsAnalytics'];\n};\n\n/**\n * Identify a user for analytics.\n *\n * @param traits - User traits/properties\n * @param context - Optional platform-specific context forwarded to the platform adapter.\n */\nexport type AnalyticsControllerIdentifyAction = {\n type: `AnalyticsController:identify`;\n handler: AnalyticsController['identify'];\n};\n\n/**\n * Track a page or screen view.\n *\n * @param name - The identifier/name of the page or screen being viewed (e.g., \"home\", \"settings\", \"wallet\")\n * @param properties - Optional properties associated with the view\n * @param context - Optional platform-specific context forwarded to the platform adapter.\n */\nexport type AnalyticsControllerTrackViewAction = {\n type: `AnalyticsController:trackView`;\n handler: AnalyticsController['trackView'];\n};\n\n/**\n * Create an event fragment.\n *\n * A fragment accumulates properties across a user journey so that several\n * parts of a client can contribute to the same set of events without\n * re-deriving them. Declaring `successEvent` and `failureEvent` turns the\n * fragment into a funnel that {@link finalizeEventFragment} closes. Declaring\n * none of the event names makes it a pure property bag that the client reads\n * back with {@link getEventFragmentById} when it emits its own events.\n *\n * Any existing fragment with the same ID is replaced, so a new journey never\n * inherits properties from a stale one.\n *\n * Nothing is created unless the user is opted in, or undecided with the\n * pre-consent queue enabled, so an opted-out user accumulates no fragment\n * data.\n *\n * @param options - The fragment definition. An ID is generated when one is\n * not supplied.\n * @returns A read-only copy of the created fragment, or `undefined` when the\n * event fragments feature is disabled or the consent state does not allow\n * capture. Mutating the returned object does not change controller state.\n * Use {@link updateEventFragment} or {@link upsertEventFragment} to write.\n */\nexport type AnalyticsControllerCreateEventFragmentAction = {\n type: `AnalyticsController:createEventFragment`;\n handler: AnalyticsController['createEventFragment'];\n};\n\n/**\n * Write to an event fragment, creating a property bag if none exists.\n *\n * This is the ergonomic entry point for contributors that do not know\n * whether the journey has been started yet, and it avoids the read then\n * write race a caller would otherwise have to implement itself.\n *\n * @param id - The fragment ID.\n * @param payload - The properties and context to merge in.\n */\nexport type AnalyticsControllerUpsertEventFragmentAction = {\n type: `AnalyticsController:upsertEventFragment`;\n handler: AnalyticsController['upsertEventFragment'];\n};\n\n/**\n * Write to an existing event fragment.\n *\n * @param id - The fragment ID.\n * @param payload - The properties and context to merge in.\n * @throws Error if no fragment has that ID when the call is not ignored.\n * Use {@link upsertEventFragment} when the fragment may not exist yet.\n * When the event fragments feature is disabled or the consent state does not\n * allow capture, the call is a logged no-op and does not throw.\n */\nexport type AnalyticsControllerUpdateEventFragmentAction = {\n type: `AnalyticsController:updateEventFragment`;\n handler: AnalyticsController['updateEventFragment'];\n};\n\n/**\n * Read an event fragment.\n *\n * @param id - The fragment ID.\n * @returns A read-only copy of the fragment, or `undefined` when no fragment\n * has that ID, the event fragments feature is disabled, or the consent state\n * does not allow capture. Mutating the returned object does not change\n * controller state. Use {@link updateEventFragment} or\n * {@link upsertEventFragment} to write.\n */\nexport type AnalyticsControllerGetEventFragmentByIdAction = {\n type: `AnalyticsController:getEventFragmentById`;\n handler: AnalyticsController['getEventFragmentById'];\n};\n\n/**\n * Discard an event fragment without emitting anything.\n *\n * @param id - The fragment ID.\n */\nexport type AnalyticsControllerDeleteEventFragmentAction = {\n type: `AnalyticsController:deleteEventFragment`;\n handler: AnalyticsController['deleteEventFragment'];\n};\n\n/**\n * Close an event fragment, emitting its closing event and discarding it.\n *\n * The event emitted is `failureEvent` when the journey was abandoned and\n * `successEvent` otherwise. A fragment that does not declare the relevant\n * event name is discarded silently, which is what makes a pure property bag\n * possible.\n *\n * @param id - The fragment ID.\n * @param options - Finalization options.\n * @param options.abandoned - Whether the journey was abandoned.\n * @param options.context - Context merged over the fragment's own context.\n * @throws Error if no fragment has that ID when the call is not ignored.\n * When the event fragments feature is disabled or the consent state does not\n * allow capture, the call is a logged no-op and does not throw.\n */\nexport type AnalyticsControllerFinalizeEventFragmentAction = {\n type: `AnalyticsController:finalizeEventFragment`;\n handler: AnalyticsController['finalizeEventFragment'];\n};\n\n/**\n * Opt in to analytics.\n *\n * Records that a consent decision has been made and replays any events that\n * were queued while the user was undecided.\n *\n * When geolocation enrichment is enabled, geolocation is resolved here (once\n * the user has consented) and awaited before the queued events are replayed,\n * so those events are enriched with the resolved location as they are sent.\n *\n * @returns A promise that resolves once opt-in processing has completed.\n */\nexport type AnalyticsControllerOptInAction = {\n type: `AnalyticsController:optIn`;\n handler: AnalyticsController['optIn'];\n};\n\n/**\n * Opt out of analytics.\n *\n * Records that a consent decision has been made and discards any persisted\n * events and in-progress event fragments so nothing captured before the\n * decision is ever delivered.\n */\nexport type AnalyticsControllerOptOutAction = {\n type: `AnalyticsController:optOut`;\n handler: AnalyticsController['optOut'];\n};\n\n/**\n * Reset the consent decision back to undecided.\n *\n * Intended for client flows that restart onboarding. Clears the opt-in\n * preference and discards the delivery queue, but preserves any pre-consent\n * events so they can still be replayed if the user opts in again. The user is\n * treated as undecided again.\n *\n * In-progress event fragments are kept only while the undecided user can\n * still accumulate them, and discarded otherwise, so no fragment outlives the\n * consent state that allowed it.\n */\nexport type AnalyticsControllerResetConsentDecisionAction = {\n type: `AnalyticsController:resetConsentDecision`;\n handler: AnalyticsController['resetConsentDecision'];\n};\n\n/**\n * Opt in to marketing analytics.\n *\n * Independent of {@link optIn}. Replays queued marketing events.\n *\n * @returns A promise that resolves once opt-in processing has completed.\n */\nexport type AnalyticsControllerOptInToMarketingAction = {\n type: `AnalyticsController:optInToMarketing`;\n handler: AnalyticsController['optInToMarketing'];\n};\n\n/**\n * Opt out of marketing analytics.\n *\n * Independent of {@link optOut}. Discards queued marketing events and\n * marketing event fragments.\n */\nexport type AnalyticsControllerOptOutOfMarketingAction = {\n type: `AnalyticsController:optOutOfMarketing`;\n handler: AnalyticsController['optOutOfMarketing'];\n};\n\n/**\n * Reset the marketing consent decision back to undecided.\n *\n * Independent of {@link resetConsentDecision}.\n */\nexport type AnalyticsControllerResetMarketingConsentDecisionAction = {\n type: `AnalyticsController:resetMarketingConsentDecision`;\n handler: AnalyticsController['resetMarketingConsentDecision'];\n};\n\n/**\n * Set the marketing campaign cookie ID.\n *\n * Stores the ID of the marketing campaign cookie (e.g. a Google Analytics\n * client ID) that was active when the user arrived. Pass `null` to clear it.\n * The value is automatically cleared by {@link optOutOfMarketing} and\n * {@link resetMarketingConsentDecision}.\n *\n * @param marketingCampaignCookieId - The marketing campaign cookie ID, or\n * `null` to clear it.\n */\nexport type AnalyticsControllerSetMarketingCampaignCookieIdAction = {\n type: `AnalyticsController:setMarketingCampaignCookieId`;\n handler: AnalyticsController['setMarketingCampaignCookieId'];\n};\n\n/**\n * Union of all AnalyticsController action types.\n */\nexport type AnalyticsControllerMethodActions =\n | AnalyticsControllerTrackEventAction\n | AnalyticsControllerTrackErrorAsAnalyticsAction\n | AnalyticsControllerIdentifyAction\n | AnalyticsControllerTrackViewAction\n | AnalyticsControllerCreateEventFragmentAction\n | AnalyticsControllerUpsertEventFragmentAction\n | AnalyticsControllerUpdateEventFragmentAction\n | AnalyticsControllerGetEventFragmentByIdAction\n | AnalyticsControllerDeleteEventFragmentAction\n | AnalyticsControllerFinalizeEventFragmentAction\n | AnalyticsControllerOptInAction\n | AnalyticsControllerOptOutAction\n | AnalyticsControllerResetConsentDecisionAction\n | AnalyticsControllerOptInToMarketingAction\n | AnalyticsControllerOptOutOfMarketingAction\n | AnalyticsControllerResetMarketingConsentDecisionAction\n | AnalyticsControllerSetMarketingCampaignCookieIdAction;\n"]}
1
+ {"version":3,"file":"AnalyticsController-method-action-types.js","sourceRoot":"","sources":["../src/AnalyticsController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { AnalyticsController } from './AnalyticsController.js';\n\n/**\n * Track an analytics event.\n *\n * Events are only tracked if analytics is enabled.\n *\n * @param event - Analytics event with properties and sensitive properties\n * @param context - Optional platform-specific context forwarded to the platform adapter.\n */\nexport type AnalyticsControllerTrackEventAction = {\n type: `AnalyticsController:trackEvent`;\n handler: AnalyticsController['trackEvent'];\n};\n\n/**\n * Identify a user for analytics.\n *\n * @param traits - User traits/properties\n * @param context - Optional platform-specific context forwarded to the platform adapter.\n */\nexport type AnalyticsControllerIdentifyAction = {\n type: `AnalyticsController:identify`;\n handler: AnalyticsController['identify'];\n};\n\n/**\n * Track a page or screen view.\n *\n * @param name - The identifier/name of the page or screen being viewed (e.g., \"home\", \"settings\", \"wallet\")\n * @param properties - Optional properties associated with the view\n * @param context - Optional platform-specific context forwarded to the platform adapter.\n */\nexport type AnalyticsControllerTrackViewAction = {\n type: `AnalyticsController:trackView`;\n handler: AnalyticsController['trackView'];\n};\n\n/**\n * Create an event fragment.\n *\n * A fragment accumulates properties across a user journey so that several\n * parts of a client can contribute to the same set of events without\n * re-deriving them. Declaring `successEvent` and `failureEvent` turns the\n * fragment into a funnel that {@link finalizeEventFragment} closes. Declaring\n * none of the event names makes it a pure property bag that the client reads\n * back with {@link getEventFragmentById} when it emits its own events.\n *\n * Any existing fragment with the same ID is replaced, so a new journey never\n * inherits properties from a stale one.\n *\n * Nothing is created unless the user is opted in, or undecided with the\n * pre-consent queue enabled, so an opted-out user accumulates no fragment\n * data.\n *\n * @param options - The fragment definition. An ID is generated when one is\n * not supplied.\n * @returns A read-only copy of the created fragment, or `undefined` when the\n * event fragments feature is disabled or the consent state does not allow\n * capture. Mutating the returned object does not change controller state.\n * Use {@link updateEventFragment} or {@link upsertEventFragment} to write.\n */\nexport type AnalyticsControllerCreateEventFragmentAction = {\n type: `AnalyticsController:createEventFragment`;\n handler: AnalyticsController['createEventFragment'];\n};\n\n/**\n * Write to an event fragment, creating a property bag if none exists.\n *\n * This is the ergonomic entry point for contributors that do not know\n * whether the journey has been started yet, and it avoids the read then\n * write race a caller would otherwise have to implement itself.\n *\n * @param id - The fragment ID.\n * @param payload - The properties and context to merge in.\n */\nexport type AnalyticsControllerUpsertEventFragmentAction = {\n type: `AnalyticsController:upsertEventFragment`;\n handler: AnalyticsController['upsertEventFragment'];\n};\n\n/**\n * Write to an existing event fragment.\n *\n * @param id - The fragment ID.\n * @param payload - The properties and context to merge in.\n * @throws Error if no fragment has that ID when the call is not ignored.\n * Use {@link upsertEventFragment} when the fragment may not exist yet.\n * When the event fragments feature is disabled or the consent state does not\n * allow capture, the call is a logged no-op and does not throw.\n */\nexport type AnalyticsControllerUpdateEventFragmentAction = {\n type: `AnalyticsController:updateEventFragment`;\n handler: AnalyticsController['updateEventFragment'];\n};\n\n/**\n * Read an event fragment.\n *\n * @param id - The fragment ID.\n * @returns A read-only copy of the fragment, or `undefined` when no fragment\n * has that ID, the event fragments feature is disabled, or the consent state\n * does not allow capture. Mutating the returned object does not change\n * controller state. Use {@link updateEventFragment} or\n * {@link upsertEventFragment} to write.\n */\nexport type AnalyticsControllerGetEventFragmentByIdAction = {\n type: `AnalyticsController:getEventFragmentById`;\n handler: AnalyticsController['getEventFragmentById'];\n};\n\n/**\n * Discard an event fragment without emitting anything.\n *\n * @param id - The fragment ID.\n */\nexport type AnalyticsControllerDeleteEventFragmentAction = {\n type: `AnalyticsController:deleteEventFragment`;\n handler: AnalyticsController['deleteEventFragment'];\n};\n\n/**\n * Close an event fragment, emitting its closing event and discarding it.\n *\n * The event emitted is `failureEvent` when the journey was abandoned and\n * `successEvent` otherwise. A fragment that does not declare the relevant\n * event name is discarded silently, which is what makes a pure property bag\n * possible.\n *\n * @param id - The fragment ID.\n * @param options - Finalization options.\n * @param options.abandoned - Whether the journey was abandoned.\n * @param options.context - Context merged over the fragment's own context.\n * @throws Error if no fragment has that ID when the call is not ignored.\n * When the event fragments feature is disabled or the consent state does not\n * allow capture, the call is a logged no-op and does not throw.\n */\nexport type AnalyticsControllerFinalizeEventFragmentAction = {\n type: `AnalyticsController:finalizeEventFragment`;\n handler: AnalyticsController['finalizeEventFragment'];\n};\n\n/**\n * Opt in to analytics.\n *\n * Records that a consent decision has been made and replays any events that\n * were queued while the user was undecided.\n *\n * When geolocation enrichment is enabled, geolocation is resolved here (once\n * the user has consented) and awaited before the queued events are replayed,\n * so those events are enriched with the resolved location as they are sent.\n *\n * @returns A promise that resolves once opt-in processing has completed.\n */\nexport type AnalyticsControllerOptInAction = {\n type: `AnalyticsController:optIn`;\n handler: AnalyticsController['optIn'];\n};\n\n/**\n * Opt out of analytics.\n *\n * Records that a consent decision has been made and discards any persisted\n * events and in-progress event fragments so nothing captured before the\n * decision is ever delivered.\n */\nexport type AnalyticsControllerOptOutAction = {\n type: `AnalyticsController:optOut`;\n handler: AnalyticsController['optOut'];\n};\n\n/**\n * Reset the consent decision back to undecided.\n *\n * Intended for client flows that restart onboarding. Clears the opt-in\n * preference and discards the delivery queue, but preserves any pre-consent\n * events so they can still be replayed if the user opts in again. The user is\n * treated as undecided again.\n *\n * In-progress event fragments are kept only while the undecided user can\n * still accumulate them, and discarded otherwise, so no fragment outlives the\n * consent state that allowed it.\n */\nexport type AnalyticsControllerResetConsentDecisionAction = {\n type: `AnalyticsController:resetConsentDecision`;\n handler: AnalyticsController['resetConsentDecision'];\n};\n\n/**\n * Opt in to marketing analytics.\n *\n * Independent of {@link optIn}. Replays queued marketing events.\n *\n * @returns A promise that resolves once opt-in processing has completed.\n */\nexport type AnalyticsControllerOptInToMarketingAction = {\n type: `AnalyticsController:optInToMarketing`;\n handler: AnalyticsController['optInToMarketing'];\n};\n\n/**\n * Opt out of marketing analytics.\n *\n * Independent of {@link optOut}. Discards queued marketing events and\n * marketing event fragments.\n */\nexport type AnalyticsControllerOptOutOfMarketingAction = {\n type: `AnalyticsController:optOutOfMarketing`;\n handler: AnalyticsController['optOutOfMarketing'];\n};\n\n/**\n * Reset the marketing consent decision back to undecided.\n *\n * Independent of {@link resetConsentDecision}.\n */\nexport type AnalyticsControllerResetMarketingConsentDecisionAction = {\n type: `AnalyticsController:resetMarketingConsentDecision`;\n handler: AnalyticsController['resetMarketingConsentDecision'];\n};\n\n/**\n * Set the marketing campaign cookie ID.\n *\n * Stores the ID of the marketing campaign cookie (e.g. a Google Analytics\n * client ID) that was active when the user arrived. Pass `null` to clear it.\n * The value is automatically cleared by {@link optOutOfMarketing} and\n * {@link resetMarketingConsentDecision}.\n *\n * @param marketingCampaignCookieId - The marketing campaign cookie ID, or\n * `null` to clear it.\n */\nexport type AnalyticsControllerSetMarketingCampaignCookieIdAction = {\n type: `AnalyticsController:setMarketingCampaignCookieId`;\n handler: AnalyticsController['setMarketingCampaignCookieId'];\n};\n\n/**\n * Union of all AnalyticsController action types.\n */\nexport type AnalyticsControllerMethodActions =\n | AnalyticsControllerTrackEventAction\n | AnalyticsControllerIdentifyAction\n | AnalyticsControllerTrackViewAction\n | AnalyticsControllerCreateEventFragmentAction\n | AnalyticsControllerUpsertEventFragmentAction\n | AnalyticsControllerUpdateEventFragmentAction\n | AnalyticsControllerGetEventFragmentByIdAction\n | AnalyticsControllerDeleteEventFragmentAction\n | AnalyticsControllerFinalizeEventFragmentAction\n | AnalyticsControllerOptInAction\n | AnalyticsControllerOptOutAction\n | AnalyticsControllerResetConsentDecisionAction\n | AnalyticsControllerOptInToMarketingAction\n | AnalyticsControllerOptOutOfMarketingAction\n | AnalyticsControllerResetMarketingConsentDecisionAction\n | AnalyticsControllerSetMarketingCampaignCookieIdAction;\n"]}
@@ -7,7 +7,6 @@ import type { Json } from '@metamask/utils';
7
7
  import type { AnalyticsControllerMethodActions } from './AnalyticsController-method-action-types.js';
8
8
  import type { AnalyticsPlatformAdapter, AnalyticsContext, AnalyticsEventProperties, AnalyticsUserTraits, AnalyticsTrackingEvent } from './AnalyticsPlatformAdapter.types.js';
9
9
  import type { AnalyticsEventFragmentFinalizeOptions, AnalyticsEventFragmentOptions, AnalyticsEventFragmentPayload, AnalyticsEventFragments, ReadonlyAnalyticsEventFragment } from './EventFragment.types.js';
10
- import type { TrackErrorAsAnalyticsOptions } from './track-error-as-analytics.js';
11
10
  /**
12
11
  * The name of the {@link AnalyticsController}, used to namespace the
13
12
  * controller's actions and events and to namespace the controller's state data
@@ -365,36 +364,6 @@ export declare class AnalyticsController extends BaseController<'AnalyticsContro
365
364
  * @param context - Optional platform-specific context forwarded to the platform adapter.
366
365
  */
367
366
  trackEvent(event: AnalyticsTrackingEvent, context?: AnalyticsContext): void;
368
- /**
369
- * Report a caught error as an `Error Occurred` analytics event.
370
- *
371
- * Properties are `source` and a sanitized `error_message`. Whitespace is
372
- * collapsed and the message is capped at 500 characters. Stack traces are
373
- * never included.
374
- *
375
- * `source` must uniquely identify the error case (for example
376
- * `swap-quote-fetch`). Do not reuse one value for every error in a file
377
- * or package.
378
- *
379
- * Sampling, a deduplication window, and a per-session cap bound volume.
380
- * Those controls default to always emitting, 10 seconds, and 50 events.
381
- * A caller can only lower the session cap. The budget belongs to this
382
- * controller instance and is not persisted.
383
- *
384
- * Delivery goes through {@link trackEvent}, so consent gating, the
385
- * pre-consent queue, and geolocation enrichment all apply. Opted-out
386
- * calls return before the volume controls run, so they do not consume
387
- * the session budget.
388
- *
389
- * Fail-safe: this method never throws. If delivery throws, the session
390
- * reservation is released.
391
- *
392
- * @param error - The caught value to report.
393
- * @param options - Source and optional volume controls.
394
- * @param options.source - Unique discriminator for this error case.
395
- * @param options.volumeControls - Optional sampling, dedup, and session cap.
396
- */
397
- trackErrorAsAnalytics(error: unknown, options: TrackErrorAsAnalyticsOptions): void;
398
367
  /**
399
368
  * Identify a user for analytics.
400
369
  *
@@ -1 +1 @@
1
- {"version":3,"file":"AnalyticsController.d.ts","sourceRoot":"","sources":["../src/AnalyticsController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAE3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EACV,sCAAsC,EACtC,yCAAyC,EAC1C,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EACV,6CAA6C,EAE9C,MAAM,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,MAAM,EACZ,UAAU,CAAC,EAAE,wBAAwB,EACrC,OAAO,CAAC,EAAE,gBAAgB,GACzB,IAAI,CAeN;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,mBAAmB,CACjB,OAAO,GAAE,6BAAkC,GAC1C,8BAA8B,GAAG,SAAS,CA6C5C;IAED;;;;;;;;;OASG;IACH,mBAAmB,CACjB,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,6BAAkC,GAC1C,IAAI,CAcN;IAED;;;;;;;;;OASG;IACH,mBAAmB,CACjB,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,6BAAkC,GAC1C,IAAI,CAWN;IAED;;;;;;;;;OASG;IACH,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,8BAA8B,GAAG,SAAS,CAO3E;IAED;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAOpC;IAED;;;;;;;;;;;;;;;OAeG;IACH,qBAAqB,CACnB,EAAE,EAAE,MAAM,EACV,EAAE,SAAiB,EAAE,OAAO,EAAE,GAAE,qCAA0C,GACzE,IAAI,CAuBN;IAED;;;;;;;;;;;OAWG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAe3B;IAED;;;;;;OAMG;IACH,MAAM,IAAI,IAAI,CAOb;IAED;;;;;;;;;;;OAWG;IACH,oBAAoB,IAAI,IAAI,CAO3B;IAED;;;;;;OAMG;IACG,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAQtC;IAED;;;;;OAKG;IACH,iBAAiB,IAAI,IAAI,CAQxB;IAED;;;;OAIG;IACH,6BAA6B,IAAI,IAAI,CAQpC;IAED;;;;;;;;;;OAUG;IACH,4BAA4B,CAAC,yBAAyB,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAI3E;CACF"}
1
+ {"version":3,"file":"AnalyticsController.d.ts","sourceRoot":"","sources":["../src/AnalyticsController.ts"],"names":[],"mappings":"AAAA,OAAO,KAA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AnalyticsControllerState } from './analyticsControllerStateValidator.js';
5
5
  import { projectLogger as log } from './AnalyticsLogger.js';
6
6
  import { analyticsControllerSelectors } from './selectors.js';
7
- import { ERROR_OCCURRED_EVENT_NAME, releaseErrorTrackingReservation, reserveErrorOccurredEvent, } from './track-error-as-analytics.js';
8
7
  // === GENERAL ===
9
8
  /**
10
9
  * The name of the {@link AnalyticsController}, used to namespace the
@@ -124,7 +123,6 @@ const analyticsControllerMetadata = {
124
123
  // === MESSENGER ===
125
124
  const MESSENGER_EXPOSED_METHODS = [
126
125
  'trackEvent',
127
- 'trackErrorAsAnalytics',
128
126
  'identify',
129
127
  'trackView',
130
128
  'optIn',
@@ -335,14 +333,6 @@ export class AnalyticsController extends BaseController {
335
333
  */
336
334
  #locationResolvePromise;
337
335
  #locationContext;
338
- /**
339
- * In-memory sampling, deduplication, and session-cap state for
340
- * {@link trackErrorAsAnalytics}. Not persisted.
341
- */
342
- #errorTrackingSession = {
343
- emittedCount: 0,
344
- lastEmittedAtBySignature: new Map(),
345
- };
346
336
  /**
347
337
  * Constructs an AnalyticsController instance.
348
338
  *
@@ -1218,55 +1208,6 @@ export class AnalyticsController extends BaseController {
1218
1208
  trackEvent(event, context) {
1219
1209
  this.#trackEvent(event, context, this.#purposesFromName(event.name), this.#eventsConfigVersion);
1220
1210
  }
1221
- /**
1222
- * Report a caught error as an `Error Occurred` analytics event.
1223
- *
1224
- * Properties are `source` and a sanitized `error_message`. Whitespace is
1225
- * collapsed and the message is capped at 500 characters. Stack traces are
1226
- * never included.
1227
- *
1228
- * `source` must uniquely identify the error case (for example
1229
- * `swap-quote-fetch`). Do not reuse one value for every error in a file
1230
- * or package.
1231
- *
1232
- * Sampling, a deduplication window, and a per-session cap bound volume.
1233
- * Those controls default to always emitting, 10 seconds, and 50 events.
1234
- * A caller can only lower the session cap. The budget belongs to this
1235
- * controller instance and is not persisted.
1236
- *
1237
- * Delivery goes through {@link trackEvent}, so consent gating, the
1238
- * pre-consent queue, and geolocation enrichment all apply. Opted-out
1239
- * calls return before the volume controls run, so they do not consume
1240
- * the session budget.
1241
- *
1242
- * Fail-safe: this method never throws. If delivery throws, the session
1243
- * reservation is released.
1244
- *
1245
- * @param error - The caught value to report.
1246
- * @param options - Source and optional volume controls.
1247
- * @param options.source - Unique discriminator for this error case.
1248
- * @param options.volumeControls - Optional sampling, dedup, and session cap.
1249
- */
1250
- trackErrorAsAnalytics(error, options) {
1251
- try {
1252
- if (!this.#isCaptureAllowed(this.#purposesFromName(ERROR_OCCURRED_EVENT_NAME))) {
1253
- return;
1254
- }
1255
- const reserved = reserveErrorOccurredEvent(this.#errorTrackingSession, error, options);
1256
- if (reserved === undefined) {
1257
- return;
1258
- }
1259
- try {
1260
- this.trackEvent(reserved.event);
1261
- }
1262
- catch {
1263
- releaseErrorTrackingReservation(this.#errorTrackingSession, reserved.reservation);
1264
- }
1265
- }
1266
- catch {
1267
- // Fail-safe: telemetry must never break the calling flow.
1268
- }
1269
- }
1270
1211
  #trackEvent(event, context, purposes, version) {
1271
1212
  // An event captured while the user is still undecided is held in the
1272
1213
  // pre-consent queue (see #sendOrQueueTrackEvent) instead of being