GA4
- typescript
0
GitHub Stars
typescript
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"shin-sibainu-ga4-mcp-server": {
"command": "node",
"args": [
"/path/to/ga4-mcp-server/dist/index.js"
],
"env": {
"GA4_PROPERTY_ID": "123456789",
"GOOGLE_APPLICATION_CREDENTIALS": "/path/to/service-account.json"
}
}
}
}You set up GA4 MCP Server to fetch and analyze Google Analytics 4 data from language models and other tools. It exposes a range of analysis capabilities, supports flexible date ranges, and outputs results in Japanese for easy interpretation by your workflows.
How to use
Connect your MCP client to the GA4 MCP Server and run the available tools to query GA4 data. Use the main report tool for general analytics, or pick from the 20 analytical tools to tailor insights to your needs. Results are formatted for easy interpretation by your language model, with common metrics like time, percentages, and counts expressed in natural Japanese formats.
How to install
Prerequisites: Node.js 18 or higher, and access to a GA4 property with the required permissions.
-
Clone or obtain the GA4 MCP Server package containing the server code.
-
Install dependencies and build the project.
-
Run the server configuration you need (see MCP configuration examples).
Configuration and runtime
You can run the GA4 MCP Server in two main modes depending on how you authenticate with Google:
- gcloud CLI authentication (recommended, simple): use application-default credentials and specify the GA4 property via environment variables.
- Service account authentication (production): provide the Google service account JSON and the GA4 property ID.
{
"mcpServers": {
"ga4": {
"command": "node",
"args": ["/path/to/ga4-mcp-server/dist/index.js"],
"env": {
"GA4_PROPERTY_ID": "123456789"
}
}
}
}
Security and environment variables
Set up credentials and property access securely. The following environment variables are shown as part of the configuration examples:
- GA4_PROPERTY_ID: the GA4 property you want to query
- GOOGLE_APPLICATION_CREDENTIALS: path to your service account JSON (for production setups)
{
"mcpServers": {
"ga4_sa": {
"command": "node",
"args": ["/path/to/ga4-mcp-server/dist/index.js"],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "/path/to/service-account.json",
"GA4_PROPERTY_ID": "123456789"
}
}
}
}
Notes and limitations
Be aware of GA4 Data API rate limits and data latency. Real-time reporting is available, but standard GA4 data can have delays of 24–48 hours. For precise funnel analyses, consider exporting data to BigQuery.
Tools and capabilities at a glance
GA4 MCP Server exposes a range of basic and analytic tools to query and analyze GA4 data. See the long list below for available functions.
Examples of usage patterns
Basic usage patterns include querying daily traffic summaries, examining top pages, and performing comparisons across periods. You can also drill into hourly traffic, user journeys, and engagement metrics to gain deeper insights.
Available tools
list_accounts
Retrieves a list of GA4 accounts and properties accessible with the configured credentials.
get_property_details
Fetches detailed information about a GA4 property.
run_report
Executes a general-purpose GA4 report query to fetch metrics and dimensions.
run_realtime_report
Queries real-time GA4 data for current activity.
get_metadata
Returns available GA4 dimensions and metrics that can be used in reports.
get_traffic_summary
Provides summary metrics like page views, users, sessions for a period.
get_top_pages
Returns ranking of pages by traffic for a period.
get_traffic_sources
Analyzes where traffic originates from, grouped by channel or source.
get_device_breakdown
Shows device type distribution (mobile, desktop, tablet).
get_geo_breakdown
Analyzes traffic by geographic region.
compare_periods
Compares metrics across two periods (e.g., week-over-week or month-over-month).
get_landing_pages
Analyzes landing page performance.
get_exit_pages
Analyzes exit page performance.
get_user_journey
Analyzes user navigation paths between pages.
get_conversion_funnel
Analyzes conversion funnel steps and drop-offs.
get_hourly_traffic
Breaks down traffic by hour of day.
get_daily_trend
Shows daily trends in metrics over time.
get_new_vs_returning
Compares new users to returning users.
get_engagement_metrics
Returns engagement metrics such as engagement rate and event counts.
get_search_terms
Retrieves site search terms used by visitors.