-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Persisting segment events in MetaMetricsController store #16198
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Test failures look legit. |
… segment_event_storage
…extension into segment_event_storage
Builds ready [0f5067f]
Page Load Metrics (2552 ± 77 ms)
highlights:storybook
|
Builds ready [0a6e834]
Page Load Metrics (2606 ± 224 ms)
highlights:storybook
|
Builds ready [c0889b9]
Page Load Metrics (2089 ± 118 ms)
highlights:storybook
|
Builds ready [9bfdae5]
Page Load Metrics (2573 ± 190 ms)
highlights:storybook
|
…extension into segment_event_storage
|
||
this.store = new ObservableStore({ | ||
participateInMetaMetrics: null, | ||
participateInMetaMetrics: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs to be null to start or we will track events before they opt in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ops my bad, thanks for catching this
… segment_event_storage
Builds ready [ef5ae4a]
Page Load Metrics (2419 ± 83 ms)
highlights:storybook
|
@jpuri from QA looks good! I'm re-running Firefox e2e tests, as the installation script failed. Hopefully this fixes it! |
Builds ready [1805f8c]
Page Load Metrics (2055 ± 94 ms)
highlights:storybook
|
// and pass a callback to remove it from store once request is submitted to segment | ||
// Saving segmentApiCalls in controller store in MV3 ensures that events are tracked | ||
// even if service worker terminates before events are submiteed to segment. | ||
_submitSegmentAPICall(eventType, payload, callback) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: in regards to eventType
, why use event
over method
? I'm thinking events mean something different for data analytics and JavaScript
It could be helpful to add a description for eventType
here. e.g.
@param {string} eventType - Segment API call name
@see {@link https://segment.com/docs/connections/spec/}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes #16173
PR address issue of segment events being lost in MV3 due to service worker restart. Events are now saved in MetaMetricsController store and resend to segment SDK till they are successfully submitted to segment.