Skip to content

Analytics: add OAuth authentication and guest access events #9541

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

Merged
merged 5 commits into from
Jul 18, 2025

Conversation

SasLord
Copy link
Member

@SasLord SasLord commented Jul 13, 2025

Added analytics events for tracking:

  • OAuth authentication start and completion via Google/GitHub
  • Guest login and workspace selection
  • Distinction between regular users and guests in metrics

Changes:

  • Extended AnalyticProvider interface with guest parameter
  • Added new events to LoginEvents
  • Updated Auth.svelte and Providers.svelte components
  • Enhanced analytics in guest-resources and workbench-resources

Copy link

Connected to Huly®: UBERF-12491

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR instruments analytics around OAuth flows and guest access, enriching event data and distinguishing guest versus regular user interactions.

  • Extended AnalyticProvider interface and implementations to include a guest flag in setWorkspace.
  • Added new LoginEvents for OAuth start, completion, and errors; wired them into Svelte components and utility functions.
  • Enhanced guest connect logic to send detailed event payloads (social_id, workspace URLs, UUIDs) and track guest visits.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
plugins/workbench-resources/src/connect.ts Added guestRole flag to workspace analytics calls and restructured event payloads.
plugins/login-resources/src/utils.ts Instrumented guest login/start/completion/error and workspace selection events; implemented trackOAuthCompletion.
plugins/login-resources/src/components/Providers.svelte Added click handler to track OAuth provider start events before navigation.
plugins/login-resources/src/components/Auth.svelte Detected OAuth provider from URL/referrer and tracked login/signup completion or error events.
plugins/login-resources/src/analytics.ts Defined new dot-separated event names for OAuth and guest flows in LoginEvents.
plugins/guest-resources/src/connect.ts Replaced literal guest login event, enriched payload, set guest workspace flag in analytics calls.
packages/analytics/src/index.ts Updated AnalyticProvider.setWorkspace signature to include a guest boolean.
packages/analytics-service/src/sentry.ts Updated Sentry provider to tag either workspace or visited-workspace based on guest flag.
packages/analytics-providers/src/sentry.ts Same update for Sentry under analytics-providers.
packages/analytics-providers/src/posthog.ts Adapted Posthog provider to only group non-guest workspaces and tag appropriately.
packages/analytics-providers/src/analyticsCollector.ts Extended analytics collector provider to emit $group_type and tag key based on guest flag.
dev/prod/.env Updated ANALYTICS_COLLECTOR_URL for production environment.
Comments suppressed due to low confidence (1)

plugins/guest-resources/src/connect.ts:200

  • [nitpick] The event name 'GUEST LOGIN' is a literal and doesn't follow the dot-separated naming convention (e.g., 'login.guest.started'). Consider adding a constant in your analytics events or using a consistent pattern for clarity and maintainability.
  Analytics.handleEvent('GUEST LOGIN', data)

Copy link
Member

@haiodo haiodo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lexiv0re Please check socialId stuff.

@SasLord SasLord requested review from haiodo and lexiv0re July 15, 2025 13:45
@SasLord SasLord force-pushed the analitycs-add-oauth-guest branch from 1193c60 to 6847181 Compare July 15, 2025 14:55
@SasLord SasLord force-pushed the analitycs-add-oauth-guest branch from 9039164 to 28c104a Compare July 16, 2025 11:30
@SasLord SasLord requested a review from haiodo July 16, 2025 14:03
@haiodo haiodo merged commit d806a54 into develop Jul 18, 2025
23 of 24 checks passed
@haiodo haiodo deleted the analitycs-add-oauth-guest branch July 18, 2025 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants