Skip to main content
Glama
wonyoungseong

GA4 MCP Server

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
GA4_CLIENT_IDNoOAuth client ID from the Google Cloud Console.
GA4_ACCESS_TOKENNoOAuth access token for Google Analytics 4 API authentication.
GA4_CLIENT_SECRETNoOAuth client secret from the Google Cloud Console.
GA4_REFRESH_TOKENNoOAuth refresh token for Google Analytics 4 API authentication.
GA4_SERVICE_ACCOUNT_JSONNoGoogle Analytics 4 Service Account credentials provided as a raw JSON string.
GOOGLE_APPLICATION_CREDENTIALSNoPath to the Google Analytics 4 Service Account JSON credentials file.

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
ga4_account_summaries

Retrieves information about the user's Google Analytics accounts and properties. Returns a list of all GA4 accounts and their associated properties that the authenticated user has access to.

ga4_property_details

Returns details about a specific GA4 property including its name, display name, time zone, currency, industry category, and other settings.

ga4_google_ads_links

Returns a list of links to Google Ads accounts for a GA4 property. Shows which Google Ads accounts are connected to the property for data sharing.

ga4_property_annotations

Returns annotations for a GA4 property. Annotations are notes that mark specific dates or periods, typically used to record events like releases, campaigns, or traffic changes.

ga4_run_report

Runs a Google Analytics Data API report. Returns analytics data based on the specified dimensions, metrics, and date ranges.

Hints for arguments

Hints for dimensions

The dimensions list must consist solely of either:

  1. Standard dimensions from https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema#dimensions

  2. Custom dimensions for the property. Use ga4_custom_dimensions_metrics to retrieve custom dimensions.

Hints for metrics

The metrics list must consist solely of either:

  1. Standard metrics from https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema#metrics

  2. Custom metrics for the property. Use ga4_custom_dimensions_metrics to retrieve custom metrics.

Hints for dateRanges

Examples:

  • Single range: [{"startDate": "2025-01-01", "endDate": "2025-01-31"}]

  • Relative: [{"startDate": "30daysAgo", "endDate": "yesterday"}]

  • Multiple: [{"startDate": "2025-01-01", "endDate": "2025-01-31", "name": "Jan"}, {"startDate": "2025-02-01", "endDate": "2025-02-28", "name": "Feb"}]

Hints for dimensionFilter

Example: {"filter": {"fieldName": "eventName", "stringFilter": {"matchType": "BEGINS_WITH", "value": "page"}}}

Hints for orderBys

Example: [{"dimension": {"dimensionName": "eventName"}, "desc": false}] or [{"metric": {"metricName": "eventCount"}, "desc": true}]

ga4_run_realtime_report

Runs a Google Analytics Data API realtime report. Returns real-time analytics data for the last 30 minutes.

Hints for arguments

Hints for dimensions

Use realtime dimensions from https://developers.google.com/analytics/devguides/reporting/data/v1/realtime-api-schema#dimensions Or user-scoped custom dimensions (apiName starting with "customUser:")

Hints for metrics

Use realtime metrics from https://developers.google.com/analytics/devguides/reporting/data/v1/realtime-api-schema#metrics Note: Realtime reports cannot use custom metrics.

ga4_custom_dimensions_metrics

Retrieves the custom dimensions and metrics defined for a GA4 property. Use this to discover what custom definitions are available before running reports.

ga4_validate_gtm_params

GTM에서 보내는 이벤트 파라미터가 GA4에 제대로 수집되는지 검증합니다.

사용 방법

방법 1: GTM 이벤트 목록 직접 전달

gtmEvents 배열로 이벤트별 파라미터를 전달합니다.

방법 2: GTM Container Export JSON 전달

GTM에서 컨테이너를 Export한 JSON 파일 내용을 gtmExportJson으로 전달하면 자동으로 파싱합니다.

검증 항목

  1. 파라미터가 GA4 커스텀 디멘션으로 등록되어 있는지

  2. 등록된 파라미터가 실제로 데이터를 수집하고 있는지

  3. 미등록/미수집 파라미터에 대한 권장사항

API 호출 효율성

  • 기존: 이벤트 수 × 파라미터 수 = N×M 호출

  • 최적화: 1(메타데이터) + 고유 파라미터 수 = 1+P 호출

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/wonyoungseong/ga4-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server