Connect the Google Analytics 4 API
Integrate the Google Analytics 4 API through Modiva’s unified REST API and hosted MCP server. Run GA4 reports through one unified API and MCP server — traffic by source, top pages, realtime users and any metrics × dimensions across your properties. OAuth, token refresh, rate limits and 8 typed tools are handled for you — connect once and call Google Analytics 4 from any agent or app through a single endpoint.
What you can do with the Google Analytics 4 API
- ✓ Reports
- ✓ Realtime
- ✓ Accounts & properties
- — Write operations
- ✓ Token refresh
Google Analytics 4 MCP tools & scopes
- accounts_
- list accounts · properties
- reports_
- metrics × dimensions · date ranges
- realtime_
- active users · events
- presets_
- traffic by source · top pages
OAuth scopes requested
- Read your Analytics accounts and properties
- Read reports, metrics and dimensions
- Read realtime activity
Connect Google Analytics 4 in your agent
# Add Modiva's MCP server to your agent
{
"mcpServers": {
"modiva": {
"url": "https://mcp.modiva.ai",
"headers": { "Authorization": "Bearer $MODIVA_MCP_KEY" }
}
}
}
# Then connect Google Analytics 4 and call its tools, e.g.
accounts_list(provider="ga4")Frequently asked questions
How do I connect the Google Analytics 4 API with Modiva?
Create a Modiva account, generate an MCP key, and connect Google Analytics 4 from your dashboard. Modiva runs the full OAuth flow and stores the encrypted token for you — no client secrets in your code.
What can I do with the Google Analytics 4 API through Modiva?
Run GA4 reports through one unified API and MCP server — traffic by source, top pages, realtime users and any metrics × dimensions across your properties. You get 8 typed tools grouped by resource (accounts_, reports_, realtime_, presets_), callable over REST or the MCP server.
Do I need to handle OAuth or token refresh myself?
No. Modiva handles the Google Analytics 4 OAuth handshake, token storage (envelope-encrypted) and automatic refresh. You call a single unified endpoint.
Can an AI agent use the Google Analytics 4 API?
Yes — that is the point. Modiva exposes Google Analytics 4 as Model Context Protocol (MCP) tools, so agents like Claude, Cursor or your own app can read and act on Google Analytics 4 through one endpoint.
Google Analytics 4 playbooks & guides
Free, step-by-step playbooks on growing with Google Analytics 4 — what works, plus how to run it with Modiva.