feat: integrating analytics and capturing event paired#450
Conversation
407182a to
b28b0be
Compare
84da497 to
bc5eb7d
Compare
There was a problem hiding this comment.
Even if we send an event from UI to the main process to set this property, we still need to read it once the desktop-app is restarted.
Rather than doing that, we could use a sync operation called readPersistedSettingFromAppState and read metametricsOptIn value. This will return the value stored in the UI (redux store)
By the way, readPersistedSettingFromAppState is not working as expected today, it returns the stringified value of the property, it's an easy fix but just for the heads up.
Please see this thread: https://consensys.slack.com/archives/C03RV0Q4TGB/p1674563207800129
And the task: https://github.com/orgs/MetaMask/projects/37?pane=issue&itemId=18772949
There was a problem hiding this comment.
Maybe the event approach could work for the 'initial events' before chosing metametrics opt-in/out.
There was a problem hiding this comment.
I saw that Bernardo used it on the Sentry PR. Initially, I thought of using the context bridge to fire an event from the UI to update this property but as UI also need that and we have readPersistedSettingFromAppState I will change it on the ticket that I'm currently working on.
Just one detail that we can discuss further in the meeting today is to contemplate the case where a user has not optIn/optOut using the UI but we already fire an initial event that should be stored and flushed if the user optIn. In this case, what about metametricsOptIn accepting undefined and whenever is undefined it reflects that the user has not optIn/optOut using the UI yet?
packages/app/package.json
Outdated
There was a problem hiding this comment.
It's hard to understand why they choose this package name 😂
There was a problem hiding this comment.
😆 this looks like a rebranding that is ongoing.
bc5eb7d to
a01ebe8
Compare
Overview
The aim of this PR is to integrate Segment into the desktop app and send/capture events whenever the desktop app is paired with the extension.
Changes
analytics-nodeand types.analytics.tsprovides an instance tometrics-service.tsand allows the usage of Segment SDKmetrics-service.tsuses the electron store to save events sent and buffer events in case users didn't opt in as a participant to send metrics.desktop-appbyMetricsService.trackan event is emitted to Segment every time the desktop app receives apairedevent from the extension.Others
In order to test Sentry locally:
Create a Sentry account using your consensys email address.
Add a new electron/node project.
Access project Settings -> API Keys
Copy the write key into environment variables in .metamaskrc called
SEGMENT_WRITE_KEY.Issues
resolves: #415