feat: add GA4 login event tracking#916
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds GA4-recommended login analytics tracking to the @databiosphere/findable-ui auth flows so consuming apps automatically emit a login event when authentication completes (without firing on initial mount for persisted sessions).
Changes:
- Added
EVENT_NAME.LOGINandEVENT_PARAM.METHOD(plus typed params) to the analytics entities. - Introduced
useLoginTracking(isAuthenticated)hook to detectfalse → trueauthentication transitions and sendtrack("login", { method: "google" }). - Wired
useLoginTrackinginto bothGoogleSignInAuthenticationProviderandNextAuthAuthenticationProvider, and added unit tests for the hook.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/useLoginTracking.test.ts | Adds unit coverage for initial mount vs. auth transitions for the login tracking hook. |
| src/nextauth/provider.tsx | Invokes login tracking based on authState.isAuthenticated in the NextAuth provider. |
| src/hooks/authentication/useLoginTracking.ts | New hook that tracks GA4 login on false → true isAuthenticated transitions. |
| src/google/provider.tsx | Invokes login tracking based on authState.isAuthenticated in the Google Sign-In provider. |
| src/common/analytics/entities.ts | Extends analytics enums and event-param typing to include GA4 login with method. |
…tant for login event #913 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…false positives #913 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
NoopDog
approved these changes
May 12, 2026
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.
Ticket
Closes #913
Summary
loginevent (recommended event) that fires when a user authenticates via Google Sign-Infalse→truetransition ofisAuthenticatedin both auth providers (GoogleSignInAuthenticationProviderandNextAuthAuthenticationProvider)AUTH_STATUS.SETTLEDto prevent false positives during session hydrationtool_namecustom dimension (instead ofmethod) to avoid provisioning a new GA4 dimensionTest plan
useLoginTracking.test.ts— 6 cases covering mount, transition, logout, and hydration scenarios)window.dataLayercontains{ event: "login", params: { tool_name: "google" } }🤖 Generated with Claude Code