Google Analytics MCP Server logo

Google Analytics MCP Server

by MCP-Mirror

An MCP server implementation for accessing Google Analytics 4 (GA4) data, built using the Model Context Protocol TypeScript SDK. It allows you to retrieve various GA4 metrics.

View on GitHub

Last updated: N/A

What is Google Analytics MCP Server?

This is an MCP (Model Context Protocol) server that provides an interface to query and retrieve data from Google Analytics 4 (GA4) using the Analytics Data API. It allows users to access metrics like page views, active users, events, and user behavior.

How to use Google Analytics MCP Server?

  1. Set up a Google Cloud project with the Analytics Data API enabled. 2. Create a service account and grant it access to your GA4 property. 3. Configure environment variables with your service account credentials and GA4 property ID. 4. Install the server using pnpm install mcp-server-google-analytics. 5. Start the server using pnpm start. 6. Configure your Claude Desktop application to use the server.

Key features of Google Analytics MCP Server

  • Get page view metrics with customizable dimensions

  • Track active and new users over time

  • Analyze specific events and their metrics

  • Monitor user behavior metrics (session duration, bounce rate)

Use cases of Google Analytics MCP Server

  • Analyzing website traffic patterns

  • Tracking user engagement

  • Monitoring marketing campaign performance

  • Identifying popular content

  • Understanding user behavior

FAQ from Google Analytics MCP Server

What is the Model Context Protocol (MCP)?

MCP is a protocol for communication between different components in a system, enabling them to share data and context.

What permissions are required for the service account?

The service account needs appropriate read access to your Google Analytics 4 property.

How do I find my GA4 property ID?

Your GA4 property ID can be found in the Google Analytics interface under Admin > Property Settings.

What date format should I use for the API requests?

The date format should be YYYY-MM-DD, as shown in the examples.

How do I contribute to this project?

Please read the Contributing Guide for details on our code of conduct and the process for submitting pull requests.