Repository navigation
feat(integrations): connect Google Analytics via Composio - #695
Merged
Merged
Conversation
Adds Google Analytics as a second provider in Settings → Integrations: connect, connected status, disconnect. Choosing which GA4 property feeds each brand, and pulling data from it, are the following phases (#694). The connect/status/disconnect lifecycle is identical for every OAuth source, so rather than copy the Search Console route set, providers are now described by a map holding their label and auth-config env var. Routes take :provider and reject anything not in that map, and the settings UI renders one card component per provider with its own labels and optional post-connection block. Configuration stays per provider: isComposioConfigured(provider) requires the shared API key AND that provider's own auth config id, so enabling Search Console never implies Analytics is available. Instances with neither keep rendering "not configured" cards and are otherwise unaffected. Closes #658
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.
Summary
Adds Google Analytics as a second provider in Settings → Integrations — connect, connected status, disconnect. Property mapping and data sync are deliberately out of scope and tracked as #694.
Rather than copy the Search Console route set for a second provider, the shared parts are now generic:
composio.jsholds aPROVIDERSmap (label + auth-config env var).initiateGscConnection/getActiveGscConnectionbecameinitiateConnection(provider, …)/getActiveConnection(provider, …).:provider(/status,/connect,DELETE) and 404 anything not in the map, so the URL space stays closed. The two Search Console endpoints with no Analytics equivalent yet (/properties,/sync) keep explicit paths.IntegrationCardper provider — the OAuth popup, polling and disconnect logic exist once — with each provider supplying its labels and any post-connection block (GSC passes its property mapping).Configuration is per provider:
isComposioConfigured(provider)requires the shared API key and that provider's own auth config id, so having Search Console configured never makes Analytics look available. Instances with neither keep rendering "not configured" and are otherwise untouched.New env:
COMPOSIO_GA_AUTH_CONFIG_ID, documented inserver/.env.example. No toolkit version is needed yet — that requirement only appears with manual tool execution in #694.Related issue
Closes #658 · Phase 2 tracked in #694
Type of change
feat— New featureHow to test
Tested end to end against a real Composio auth config on a local instance:
COMPOSIO_GA_AUTH_CONFIG_IDis set (and Not configured without it), the OAuth popup completes, and the card flips to Connected with a Disconnect action.A build error was caught during that pass and fixed: every export in a
'use server'module must be an async function, which the initial Search Console wrapper aliases violated. Those aliases turned out to be unused once the UI became provider-generic, so they were removed rather than patched.Note for reviewers
Connecting Analytics currently has no visible effect beyond the badge, since nothing yet knows which GA4 property belongs to which brand. If #694 does not follow closely, consider hiding the Analytics card until it does, so customers don't connect an account that does nothing.
Checklist
feature/,fix/,chore/,docs/)yarn lintpasses (run fromweb/) — warning count unchanged from mainyarn typecheckpasses (run fromweb/)yarn format:checkpasses