Repository navigation
feat(analytics): add anonymous Mixpanel product analytics - #85
Merged
Merged
Conversation
…ation - Install analytics through instrumentProductAnalytics, which wraps only the typed tools/call handler; telemetry.ts no longer imports or calls analytics. - Report sessions explicitly from the plugin's oninitialized instead of as a side effect of setServerTelemetryHost. - Decide once at startup whether analytics is on; off servers install nothing. - Count a batch as delivered only when Mixpanel's verbose reply accepts it. - Stop dropping mobile_repair_input and other *_input feature tools. - Move the Mixpanel token and endpoint next to the Sentry constants and the flush counter next to the other server metrics.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds basic product analytics so we can see how many installations use Mobile Dev and which tools they use most.
What's tracked
Session Started: once each time a host connects. Mixpanel's unique-user count on this event gives installations per host.Tool Called: the tool name and asuccessorerroroutcome. Tools that poll or send input many times a second are skipped.host,plugin_version,os, a timestamp, an insert ID, and the existing installation ID asdistinct_id.Privacy
instrumentProductAnalyticsinpackages/core/src/analytics.ts, which wraps thetools/callhandler. Requests go toapi-eu.mixpanel.com/track?ip=0&verbose=1, so no IPs are stored and no locations are derived;verbose=1makes Mixpanel report rejected batches, whichanalytics.flushcounts asfailed.MOBILE_DEV_TELEMETRY=offturns analytics off along with Sentry.MOBILE_DEV_ANALYTICS=offorDO_NOT_TRACK=1turns off only analytics.Telemetry
analytics.flushbyoutcome, so Mixpanel delivery failures show up. Existing Sentry coverage is unchanged.Tests
packages/core/test/analytics.test.tspasses, along with the existing telemetry tests.npm test: 962 passed, 5 failed. All 5 are inagent-device-catalog.test.tsand fail the same way onmain.Before release