MC:4112 add utm source and utm medium for plugin and track users activity for mixpanel #3
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.
This pull request introduces a new analytics tracking system for the Google Docs plugin, enabling event logging for key user actions. It adds a dedicated analytics module that sends events to a remote endpoint, integrates analytics calls throughout the client UI, and enhances OAuth flow tracking with additional parameters. The main changes are grouped below:
Analytics Tracking System Implementation:
Analyticsclass insrc/analytics/analytics.tsto handle event tracking, including methods for login, logout, browsing, creating, editing, and updating diagrams. Events are sent to a backend endpoint with relevant metadata, and a persistent analytics ID is generated and stored in local storage.httpClient.tsusing Axios to handle HTTP requests for analytics, including error handling for network issues.Client Integration of Analytics:
Sidebar.tsxanduseAuth.ts), ensuring that user actions like login, logout, browsing, creating, editing, and updating diagrams trigger the appropriate analytics events. [1] [2] [3] [4] [5] [6] [7] [8]OAuth Flow and URL Enhancements:
src/server/ui.jsto include UTM parameters (utm_source,utm_medium,utm_campaign) for better tracking of plugin usage in authentication flows.edit-diagram-dialog.tsxto append thepluginSource=googledocsquery parameter, allowing backend analytics to attribute actions to the correct source.