reactotron
reactotron copied to clipboard
feat(reactotron-app): Add basic analytics to Reactotron app with `react-ga4`
This adds google analytics to the reactotron app for basic feature and usage metrics. It's implemented using react-ga4
but the codebase can easily be switched to another service is we want.
The first time the user opens the app after upgrading to this version, they'll be presented with this screen:
Clicking the red "NO" button changes their user setting to opt-out of anonymous analytics. A user that opens the app and clicks "NO" should have zero analytics calls send to google-analytics.
Clicking the green "YES" button saves the user setting and starts allowing tracking calls to be sent to google analytics.
We are tracking the following things:
- Screen views (with a hook that just listens to the path of
react-router
) - Interface button click events
- Keyboard shortcut usage
- Custom command usage statistics including the title of the custom command that was run.
Users can opt in or out of this feature by going to Reactotron -> Settings (which opens the settings json file in their default editor.
Editing this file to have the analyticsOptOut
be true
or false
and then restarting the app will turn this setting on and off.
Things that we need to do before this can move out of draft status:
- [ ] Create a new google analytics property for Reactotron in our master InfiniteRed account and change the
GA4_KEY
variable. - [ ] Look for other things that could benefit from usage tracking
- [ ] Brainstorm a way to track plugin usage (redux, mst, mmkv, etc)
- [ ] Validate verbiage for the Opt-in/out screen.
I also found this discussion from a VERY long time ago #723 where @jamonholmgren had already mocked up a screen and verbiage.
@markrickert I rebased this on top of master
. One thing I noticed when I was working with it was that setting the analyticsOptOut: "unknown"
causes the application to break. It appears that's the default value and what should trigger the dialog to appear. Instead I get errors in console and a blank screen. I tested this both before and after rebasing master into this branch.