Skip to content

feat(integrations): connect Google Analytics via Composio - #695

Merged
gkhngyk merged 1 commit into
mainfrom
feature/658-google-analytics-connection
Aug 10, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
feature/658-google-analytics-connection

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

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.js holds a PROVIDERS map (label + auth-config env var). initiateGscConnection / getActiveGscConnection became initiateConnection(provider, …) / getActiveConnection(provider, …).
  • Routes take :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.
  • The settings UI renders one IntegrationCard per 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 in server/.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 feature

How to test

Tested end to end against a real Composio auth config on a local instance:

  • Search Console regression (the main risk): the existing connection still reports Connected and its property mapping renders with the saved per-brand picks — the refactor left it untouched.
  • Analytics: the card shows Connect once COMPOSIO_GA_AUTH_CONFIG_ID is 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

  • Branch follows the naming convention (feature/, fix/, chore/, docs/)
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/) — warning count unchanged from main
  • yarn typecheck passes (run from web/)
  • yarn format:check passes
  • Changes are focused — one concern per PR

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
@gkhngyk
gkhngyk merged commit b0a24a4 into main Aug 10, 2026
5 checks passed
@gkhngyk
gkhngyk deleted the feature/658-google-analytics-connection branch August 10, 2026 19:07
@gkhngyk gkhngyk mentioned this pull request Aug 24, 2026
7 of 12 tasks
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.

Integrations: Google Analytics (GA4) connection via Composio — Phase 1

1 participant