Google Analytics
Google Analytics 4 Admin and Data API for property configuration and reporting
15 tools available
Installation
Claude Desktop
{
"mcpServers": {
"hopkin-ga4": {
"url": "https://ga4.mcp.hopkin.ai",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}
CLI
npm install -g @hopkin/cli
hopkin auth set-key hpk_live_...
hopkin ga4 ping
Tools
-account-summaries
ga4_list_account_summaries List GA4 Accounts & Properties
List every GA4 account and property visible to the connected Google account (Admin API accountSummaries). Use this tool first to discover which properties are available before calling other GA4 tools. Results are cached; pass refresh=true only when you need the latest list. Args: limit (number, optional): Max accounts per page (default 20, max 200). cursor (string, optional): Opaque pagination cursor from a previous response's top-level nextCursor. refresh (bool, optional): Force a fresh fetch from the API, bypassing cache. Default: false. Returns: data: accounts (each with account resource name, display_name, and properties[] of { property_id, display_name, property_type, parent }). data (the accounts), count (total accounts), property_count (total properties), cached, synced_at, and nextCursor — present only when another page exists.
| Parameter | Type | Description |
|---|---|---|
reason required | string | Why this tool call is needed |
4 optional parameters
| Parameter | Type | Description |
|---|---|---|
limit | integer | Max accounts per page (default 20). |
cursor | string | Opaque pagination cursor from a previous response's pagination.nextCursor. Do not construct by hand. |
refresh | boolean | Force a fresh fetch from the Admin API, bypassing the cache. Default: false. |
connection_id | string | Optional ID of a specific connection to use for this call. Omit to use the actor's default connection for this network. Call <platform>_list_connections to discover available connection IDs. |
k-auth-status
ga4_check_auth_status Check GA4 Auth Status
Troubleshoot authentication issues. Only use this when another tool fails with a permission or auth error — do NOT call proactively. Returns: authenticated status, user_id, email, and a human-readable message.
| Parameter | Type | Description |
|---|---|---|
reason required | string | Why this tool call is needed |
1 optional parameter
| Parameter | Type | Description |
|---|---|---|
connection_id | string | Optional ID of a specific connection to use for this call. Omit to use the actor's default connection for this network. Call <platform>_list_connections to discover available connection IDs. |
-connections
ga4_list_connections List Google Analytics Connections
List the Google Analytics connections available to you — both ones you own and ones shared with you via an organization. Only Google connections with Google Analytics (analytics.readonly) scope are returned. Use this to discover connection IDs for set_default / share / rename / revoke.
| Parameter | Type | Description |
|---|---|---|
reason required | string | Why this tool call is needed |
default-connection
ga4_set_default_connection Set Default Google Analytics Connection
Set the Google Analytics connection that should be used by default for subsequent GA4 tool calls. The default is scoped to the calling actor (your user account, or the API key being used).
| Parameter | Type | Description |
|---|---|---|
connection_id required | string | UUID of the connection to mark as the actor's default Google Analytics connection. |
reason required | string | Why this tool call is needed |
e-connection
are-connection
me-connection
ga4_rename_connection Rename Google Analytics Connection
Rename the display name of an owned Google Analytics connection. The OAuth grant and underlying account are unaffected — this only changes the human-readable label. You must be the owner.
| Parameter | Type | Description |
|---|---|---|
connection_id required | string | UUID of the connection to mark as the actor's default Google Analytics connection. |
reason required | string | Why this tool call is needed |
ke-connection
ga4_revoke_connection Revoke Google Analytics Connection
Revoke (soft-delete) an owned Google Analytics connection. Any defaults pointing to it are invalidated and shared org members lose access. The OAuth grant at Google is NOT revoked by this tool — the user must disconnect via the dashboard if they want to fully revoke at Google. You must be the owner.
| Parameter | Type | Description |
|---|---|---|
connection_id required | string | UUID of the connection to mark as the actor's default Google Analytics connection. |
reason required | string | Why this tool call is needed |
loper-feedback
ga4_developer_feedback Submit Developer Feedback
Submit feedback about missing tools, improvements, bugs, or workflow gaps in the GA4 MCP toolset. Not for user-facing issues (auth errors, API errors). Args: feedback_type: new_tool, improvement, bug, workflow_gap title: Short description (5-200 chars) description: What is needed and why (20-2000 chars) current_workaround (optional): How you're working around the gap priority (optional): low, medium (default), high Returns: confirmation that feedback was recorded.
| Parameter | Type | Description |
|---|---|---|
feedback_type required | string | Feedback category: new_tool (request new capability), improvement (enhance existing tool), bug (report issue), workflow_gap (missing workflow) |
title required | string | Concise title summarizing the feedback |
description required | string | What is needed and why |
reason required | string | Why this tool call is needed |
3 optional parameters
| Parameter | Type | Description |
|---|---|---|
current_workaround | string | Current workaround, if any |
priority | string | Impact level: low (nice-to-have), medium (improves workflow), high (blocking issue) |
interface | string | Interface the feedback originated from: MCP (default) or CLI |
funnel-report
ga4_run_funnel_report Run GA4 Funnel Report
Run an ordered, multi-step funnel (Data API v1alpha runFunnelReport) — the only way to measure step sequence, "no intervening events", and time-bounded steps. For non-sequential dimension x metric reporting use ga4_run_report instead. Each step matches either an event or a dimension value, or a depth-1 and_group/or_group of both — e.g. "a page_view AND hostName = app.example.com". Cross-domain journeys are expressed by filtering hostName per step. Args: property_id (string, required): GA4 property ID (numeric) or full resource name. date_ranges (array, required): 1-4 ranges of { start_date, end_date, name? }. Use several to compare periods (e.g. week over week) in ONE call — this is the cheapest way to do it. steps (array, required): 2-10 ordered steps. Each is { name?, filter_expression, is_directly_followed_by?, within_duration_seconds? }. filter_expression is exactly one of: { funnel_event_filter: { event_name } } { funnel_field_filter: { field_name, string_filter | in_list_filter | numeric_filter | between_filter } } { and_group: { expressions: [...] } } | { or_group: { expressions: [...] } } { not_expression: <single condition> } is_directly_followed_by: true means NO intervening events at all, not merely ordering. within_duration_seconds: complete this step within N seconds of the previous one. is_open_funnel (bool, optional): false (default) = users must enter at step 1; true = users may enter at any step. This changes the numbers a lot — the value actually used is echoed back as is_open_funnel. visualization_type (string, optional): STANDARD_FUNNEL (default) or TRENDED_FUNNEL. TRENDED_FUNNEL adds a date dimension to funnel_visualization, which carries activeUsers ONLY — completion and abandonment rates live in funnel_table. funnel_breakdown (object, optional): { breakdown_dimension, limit? } splits each step by a dimension. limit caps at 15. Adds a RESERVED_TOTAL row per step which is the across-all-values total, NOT a data row. funnel_next_action (object, optional): { next_action_dimension, limit? } — what users did next; appears in funnel_visualization. limit caps at 5. limit (number, optional): caps rows returned. There is no pagination and no total row count, so if you get back exactly that many rows the result may be silently truncated — raise the limit or narrow the funnel rather than assuming that is all the data. Defaults to 250; GA4 itself would return up to 10,000. Row count multiplies across steps x breakdown values x date ranges. return_property_quota (bool, optional). Field names: funnel steps validate against GA4's exploration schema, which is NOT the same list ga4_get_metadata returns. Common valid dimensions include hostName, pagePath, sessionSource, sessionMedium, deviceCategory, country. Returns: property_id and date_ranges — echoed back, so multi-range rows (which GA4 labels date_range_0, date_range_1, ...) can be mapped to the windows you asked for. is_open_funnel — which semantics produced these numbers. funnel_table — { returned_rows, data } with funnelStepName, any breakdown dimension, activeUsers, funnelStepCompletionRate, funnelStepAbandonments, funnelStepAbandonmentRate. funnel_visualization — { returned_rows, data } with activeUsers only. Always present; for a STANDARD_FUNNEL with no next-action it is a subset of funnel_table, so read funnel_table for rates, plus date under TRENDED_FUNNEL. warnings — present when the funnel spans hostnames (GA4 stitches identity across domains only if cross-domain measurement was configured at collection time; it cannot be fixed at query time). Notes: steps no user reached are omitted entirely, so rows may be fewer than steps. There is no pagination — runFunnelReport has no offset.
| Parameter | Type | Description |
|---|---|---|
property_id required | string | GA4 property ID (numeric) or full resource name. |
date_ranges required | array | One to 4 date ranges. Use several to compare periods (e.g. week over week) in a single call. |
steps required | array | Ordered funnel steps (2-10). |
reason required | string | Why this tool call is needed |
7 optional parameters
| Parameter | Type | Description |
|---|---|---|
is_open_funnel | boolean | Open funnel: users may enter at any step. Closed (default): users must enter at step 1. This changes the numbers substantially; the resolved value is echoed in the response. |
visualization_type | string | TRENDED_FUNNEL adds a date dimension to funnel_visualization (activeUsers only). |
funnel_breakdown | object | |
funnel_next_action | object | |
limit | integer | Max rows returned. |
return_property_quota | boolean | Include the property quota state in the response. |
connection_id | string | Optional ID of a specific connection to use for this call. Omit to use the actor's default connection for this network. Call <platform>_list_connections to discover available connection IDs. |
metadata
ga4_get_metadata Get GA4 Dimensions & Metrics
List the dimensions and metrics available on a GA4 property (including custom definitions), so ga4_run_report calls use valid API names instead of guessing. Args: property_id (string, required): GA4 property ID (numeric) or full resource name. search (string, optional): Case-insensitive substring filter on API name / UI name (e.g. 'channel', 'revenue'). Omit to list everything. Returns: dimension_count, metric_count, and matching dimensions/metrics with api_name, ui_name, category, type (metrics), and custom flag.
| Parameter | Type | Description |
|---|---|---|
property_id required | string | GA4 property ID (numeric) or full resource name. |
reason required | string | Why this tool call is needed |
2 optional parameters
| Parameter | Type | Description |
|---|---|---|
search | string | Case-insensitive substring filter on API name / UI name (e.g. 'channel', 'revenue'). Omit to list everything. |
connection_id | string | Optional ID of a specific connection to use for this call. Omit to use the actor's default connection for this network. Call <platform>_list_connections to discover available connection IDs. |
Uncategorized
ga4_ping Ping GA4 MCP Server
Health check. Returns server status, version, and timestamp.
| Parameter | Type | Description |
|---|---|---|
reason required | string | Why this tool call is needed |
1 optional parameter
| Parameter | Type | Description |
|---|---|---|
message | string | Optional message to echo back |
property-details
ga4_get_property_details Get GA4 Property Details
Setup-health snapshot for one GA4 property: property info, data streams (with enhanced measurement settings for web streams), key events, Google Ads links, attribution settings, and data retention settings. Sections that fail to load are returned with an error string instead of failing the whole call. Args: property_id (string, required): GA4 property ID (numeric, e.g. '123456789') or full resource name ('properties/123456789'). Returns: property, data_streams, key_events, google_ads_links, attribution_settings, data_retention_settings — each either the API payload or { error }.
| Parameter | Type | Description |
|---|---|---|
property_id required | string | GA4 property ID (numeric, e.g. '123456789') or full resource name ('properties/123456789'). |
reason required | string | Why this tool call is needed |
1 optional parameter
| Parameter | Type | Description |
|---|---|---|
connection_id | string | Optional ID of a specific connection to use for this call. Omit to use the actor's default connection for this network. Call <platform>_list_connections to discover available connection IDs. |
report
ga4_run_report Run GA4 Report
Run a GA4 report (Data API runReport): arbitrary dimensions × metrics over one or more date ranges, with filtering, ordering and acquisition cohorts. Use ga4_get_metadata first to look up valid dimension/metric API names. For ORDERED, step-by-step funnels use ga4_run_funnel_report instead — runReport cannot express sequence. Args: property_id (string, required): GA4 property ID (numeric) or full resource name. dimensions (string[], optional): Up to 9 dimension API names (e.g. sessionDefaultChannelGroup, date). metrics (string[], required): 1-10 metric API names (e.g. sessions, totalUsers, keyEvents, purchaseRevenue). date_ranges (array, required unless cohort_spec is used): 1-4 ranges of { start_date, end_date, name? }. Dates are YYYY-MM-DD or relative (30daysAgo, yesterday, today). dimension_filter (object, optional): A filter expression — exactly one of: { filter: { field_name, string_filter | in_list_filter | numeric_filter | between_filter } } { and_group: { expressions: [ <leaf>, ... ] } } // all must hold { or_group: { expressions: [ <leaf>, ... ] } } // any must hold { not_expression: <leaf> } where <leaf> is { filter: {...} } or { not_expression: { filter: {...} } }. string_filter: { value, match_type?: EXACT|BEGINS_WITH|ENDS_WITH|CONTAINS|FULL_REGEXP|PARTIAL_REGEXP, case_sensitive? } Groups do not nest — one level of and/or over leaves. metric_filter (object, optional): Same shape, applied to metric values after aggregation (use numeric_filter / between_filter). cohort_spec (object, optional): Acquisition cohorts. { cohorts: [{ name?, date_range: { start_date, end_date } }], cohorts_range: { granularity: DAILY|WEEKLY|MONTHLY, start_offset?, end_offset } } Cohort reports REQUIRE the "cohort" dimension and must OMIT date_ranges — the cohort's own date_range defines the window. Pair with cohortNthDay/cohortNthWeek/cohortNthMonth and a metric such as cohortActiveUsers. order_by (object, optional): { type: 'metric'|'dimension', name, desc? }. limit (number, optional): Max rows, default 100, max 10000. offset (number, optional): Row offset for pagination. Returns: data — the rows, flattened as { dimension: value, metric: value } objects. Plus row_count (total rows before pagination) and returned_rows. For a single date range: metric_totals ({ metric: total }). For multiple date ranges: metric_totals_by_range ({ "date_range_0": { metric: total }, ... }) keyed by the dateRange dimension value (or the range's name).
| Parameter | Type | Description |
|---|---|---|
property_id required | string | GA4 property ID (numeric) or full resource name. |
metrics required | array | GA4 metric API names, e.g. sessions, totalUsers, keyEvents, purchaseRevenue. |
reason required | string | Why this tool call is needed |
9 optional parameters
| Parameter | Type | Description |
|---|---|---|
dimensions | array | GA4 dimension API names, e.g. sessionDefaultChannelGroup, landingPagePlusQueryString, date. Use ga4_get_metadata for valid names. Cohort reports must include "cohort". |
date_ranges | array | One to 4 date ranges. Omit only for cohort reports, where cohort_spec defines the window. |
dimension_filter | object | Filter on dimension values. One of and_group / or_group / filter / not_expression. |
metric_filter | object | Filter on metric values (applied after aggregation). Same shape as dimension_filter; use numeric_filter or between_filter. |
cohort_spec | object | Acquisition-cohort report. Requires the "cohort" dimension; pair with cohortActiveUsers or cohortTotalUsers, and cohortNthDay/Week/Month to see periods. |
order_by | object | |
limit | integer | Max rows (default 100). Range: 1-10000. |
offset | integer | Row offset for pagination. |
connection_id | string | Optional ID of a specific connection to use for this call. Omit to use the actor's default connection for this network. Call <platform>_list_connections to discover available connection IDs. |
realtime-report
ga4_run_realtime_report Run GA4 Realtime Report
Run a GA4 realtime report (last 30 minutes of events). Primary use: verifying tags and key events fire after a tracking change, without waiting for standard processing lag. Args: property_id (string, required): GA4 property ID (numeric) or full resource name. dimensions (string[], optional): Up to 9 realtime dimension API names (e.g. eventName, unifiedScreenName, country, deviceCategory). metrics (string[], required): 1-10 realtime metric API names (e.g. activeUsers, eventCount, keyEvents). limit (number, optional): Max rows, default 50. Returns: data — the rows, flattened as { dimension: value, metric: value } objects — plus row_count.
| Parameter | Type | Description |
|---|---|---|
property_id required | string | GA4 property ID (numeric) or full resource name. |
metrics required | array | Realtime metric API names, e.g. activeUsers, eventCount, keyEvents. |
reason required | string | Why this tool call is needed |
3 optional parameters
| Parameter | Type | Description |
|---|---|---|
dimensions | array | Realtime dimension API names, e.g. eventName, unifiedScreenName, country, deviceCategory. |
limit | integer | Max rows (default 50). |
connection_id | string | Optional ID of a specific connection to use for this call. Omit to use the actor's default connection for this network. Call <platform>_list_connections to discover available connection IDs. |