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

Read-onlyOpen-world

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.

ParameterTypeDescription
reason requiredstringWhy this tool call is needed
4 optional parameters
ParameterTypeDescription
limitintegerMax accounts per page (default 20).
cursorstringOpaque pagination cursor from a previous response's pagination.nextCursor. Do not construct by hand.
refreshbooleanForce a fresh fetch from the Admin API, bypassing the cache. Default: false.
connection_idstringOptional 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.
View full documentation →

k-auth-status

ga4_check_auth_status Check GA4 Auth Status

Read-onlyIdempotent

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.

ParameterTypeDescription
reason requiredstringWhy this tool call is needed
1 optional parameter
ParameterTypeDescription
connection_idstringOptional 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.
View full documentation →

-connections

ga4_list_connections List Google Analytics Connections

Read-onlyIdempotent

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.

ParameterTypeDescription
reason requiredstringWhy this tool call is needed
View full documentation →

default-connection

ga4_set_default_connection Set Default Google Analytics Connection

Idempotent

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).

ParameterTypeDescription
connection_id requiredstringUUID of the connection to mark as the actor's default Google Analytics connection.
reason requiredstringWhy this tool call is needed
View full documentation →

e-connection

ga4_share_connection Share Google Analytics Connection With Organization

Idempotent

Share an owned Google Analytics connection with all members of your organization, so teammates can use it without having to reconnect Google themselves. You must be the owner of the connection.

ParameterTypeDescription
connection_id requiredstringUUID of the connection to mark as the actor's default Google Analytics connection.
reason requiredstringWhy this tool call is needed
View full documentation →

are-connection

ga4_unshare_connection Unshare Google Analytics Connection From Organization

DestructiveIdempotent

Stop sharing an owned Google Analytics connection with your organization. Teammates lose access immediately. You must be the owner.

ParameterTypeDescription
connection_id requiredstringUUID of the connection to mark as the actor's default Google Analytics connection.
reason requiredstringWhy this tool call is needed
View full documentation →

me-connection

ga4_rename_connection Rename Google Analytics Connection

Idempotent

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.

ParameterTypeDescription
connection_id requiredstringUUID of the connection to mark as the actor's default Google Analytics connection.
reason requiredstringWhy this tool call is needed
View full documentation →

ke-connection

ga4_revoke_connection Revoke Google Analytics Connection

DestructiveIdempotent

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.

ParameterTypeDescription
connection_id requiredstringUUID of the connection to mark as the actor's default Google Analytics connection.
reason requiredstringWhy this tool call is needed
View full documentation →

loper-feedback

ga4_developer_feedback Submit Developer Feedback

IdempotentOpen-world

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.

ParameterTypeDescription
feedback_type requiredstringFeedback category: new_tool (request new capability), improvement (enhance existing tool), bug (report issue), workflow_gap (missing workflow)
title requiredstringConcise title summarizing the feedback
description requiredstringWhat is needed and why
reason requiredstringWhy this tool call is needed
3 optional parameters
ParameterTypeDescription
current_workaroundstringCurrent workaround, if any
prioritystringImpact level: low (nice-to-have), medium (improves workflow), high (blocking issue)
interfacestringInterface the feedback originated from: MCP (default) or CLI
View full documentation →

funnel-report

ga4_run_funnel_report Run GA4 Funnel Report

Read-onlyOpen-world

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.

ParameterTypeDescription
property_id requiredstringGA4 property ID (numeric) or full resource name.
date_ranges requiredarrayOne to 4 date ranges. Use several to compare periods (e.g. week over week) in a single call.
steps requiredarrayOrdered funnel steps (2-10).
reason requiredstringWhy this tool call is needed
7 optional parameters
ParameterTypeDescription
is_open_funnelbooleanOpen 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_typestringTRENDED_FUNNEL adds a date dimension to funnel_visualization (activeUsers only).
funnel_breakdownobject
funnel_next_actionobject
limitintegerMax rows returned.
return_property_quotabooleanInclude the property quota state in the response.
connection_idstringOptional 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.
View full documentation →

metadata

ga4_get_metadata Get GA4 Dimensions & Metrics

Read-onlyOpen-world

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.

ParameterTypeDescription
property_id requiredstringGA4 property ID (numeric) or full resource name.
reason requiredstringWhy this tool call is needed
2 optional parameters
ParameterTypeDescription
searchstringCase-insensitive substring filter on API name / UI name (e.g. 'channel', 'revenue'). Omit to list everything.
connection_idstringOptional 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.
View full documentation →

Uncategorized

ga4_ping Ping GA4 MCP Server

Read-onlyIdempotent

Health check. Returns server status, version, and timestamp.

ParameterTypeDescription
reason requiredstringWhy this tool call is needed
1 optional parameter
ParameterTypeDescription
messagestringOptional message to echo back
View full documentation →

property-details

ga4_get_property_details Get GA4 Property Details

Read-onlyOpen-world

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 }.

ParameterTypeDescription
property_id requiredstringGA4 property ID (numeric, e.g. '123456789') or full resource name ('properties/123456789').
reason requiredstringWhy this tool call is needed
1 optional parameter
ParameterTypeDescription
connection_idstringOptional 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.
View full documentation →

report

ga4_run_report Run GA4 Report

Read-onlyOpen-world

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).

ParameterTypeDescription
property_id requiredstringGA4 property ID (numeric) or full resource name.
metrics requiredarrayGA4 metric API names, e.g. sessions, totalUsers, keyEvents, purchaseRevenue.
reason requiredstringWhy this tool call is needed
9 optional parameters
ParameterTypeDescription
dimensionsarrayGA4 dimension API names, e.g. sessionDefaultChannelGroup, landingPagePlusQueryString, date. Use ga4_get_metadata for valid names. Cohort reports must include "cohort".
date_rangesarrayOne to 4 date ranges. Omit only for cohort reports, where cohort_spec defines the window.
dimension_filterobjectFilter on dimension values. One of and_group / or_group / filter / not_expression.
metric_filterobjectFilter on metric values (applied after aggregation). Same shape as dimension_filter; use numeric_filter or between_filter.
cohort_specobjectAcquisition-cohort report. Requires the "cohort" dimension; pair with cohortActiveUsers or cohortTotalUsers, and cohortNthDay/Week/Month to see periods.
order_byobject
limitintegerMax rows (default 100). Range: 1-10000.
offsetintegerRow offset for pagination.
connection_idstringOptional 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.
View full documentation →

realtime-report

ga4_run_realtime_report Run GA4 Realtime Report

Read-onlyOpen-world

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.

ParameterTypeDescription
property_id requiredstringGA4 property ID (numeric) or full resource name.
metrics requiredarrayRealtime metric API names, e.g. activeUsers, eventCount, keyEvents.
reason requiredstringWhy this tool call is needed
3 optional parameters
ParameterTypeDescription
dimensionsarrayRealtime dimension API names, e.g. eventName, unifiedScreenName, country, deviceCategory.
limitintegerMax rows (default 50).
connection_idstringOptional 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.
View full documentation →