# Google Analytics 4 MCP

> Google Analytics 4 provides event-based web analytics directly through your AI agent. Analyze user paths, conversion funnels, traffic sources, and device performance without opening the GA4 dashboard. It gives you full access to dimensions like country demographics or metrics like revenue, letting you ask questions about user behavior in plain English.

## Overview
- **Category:** industry-titans
- **Price:** Free
- **Tags:** web-analytics, event-tracking, conversion-analysis, real-time-data, traffic-attribution, user-behavior

## Description

This MCP connects your Google Analytics 4 property to any AI agent, letting you run complex web analytics from a simple chat prompt. You can figure out exactly where traffic comes from, what pages perform best, and which users are converting into paying customers—all without touching the GA4 UI. Need to know if mobile users drop off at checkout? Ask. Want to see how your latest campaign is affecting sign-ups? Just ask.

It's about making raw data actionable. Whether you use it through Vinkius or another MCP-compatible client, you get full power over custom reports and advanced metrics like device breakdown and user demographics. Your agent handles the heavy lifting of querying dimensions and metrics, letting you focus on what those numbers actually mean for your business.

## Tools

### batch_run_reports
Runs multiple different types of reports in one go for efficiency.

### check_compatibility
Verifies if the dimensions and metrics you want are available together.

### get_conversions
Retrieves specific data on how many conversions happened and what revenue they generated.

### get_device_breakdown
Separates user traffic counts by device type, like desktop or mobile.

### get_metadata
Lists all the available data dimensions and metrics you can use in reports.

### get_page_views
Gets a ranked list of your top 25 pages based on how many times they were viewed.

### get_traffic_sources
Identifies where the visitors are coming from, like Google or LinkedIn.

### get_user_demographics
Provides user data broken down by country and other demographic info.

### list_audience_exports
Retrieves a list of audience export options from GA4.

### run_pivot_report
Creates complex, cross-tabulated reports to compare different metrics across segments.

### run_realtime_report
Displays active user count and page views for the current moment in time.

### run_report
Runs a fully customized report using specified date ranges, dimensions, and metrics.

## Prompt Examples

**Prompt:** 
```
Show me the top 10 pages by views this month and where the traffic is coming from.
```

**Response:** 
```
Top 10 pages by views (this month): 1) /home — 42,300 views. 2) /pricing — 18,900. 3) /features — 12,400. 4) /blog/ai-tools-guide — 9,800. 5) /signup — 7,200. 6) /docs/getting-started — 6,100. 7) /about — 5,400. 8) /blog/2025-trends — 4,900. 9) /contact — 3,200. 10) /integrations — 2,800. Traffic sources: Google Organic (45.2%), Direct (22.1%), LinkedIn (12.8%), Twitter/X (8.4%), Referral (6.3%), Email (5.2%). Would you like to run a conversion report or see the device breakdown?
```

**Prompt:** 
```
How many conversions did we get this week and which pages drove them?
```

**Response:** 
```
This week: 234 total conversion events. Breakdown by event: 'sign_up' (98 events, $0 revenue), 'purchase' (52 events, $4,680 revenue), 'begin_checkout' (84 events). Top converting pages: 1) /pricing → sign_up (42 conversions). 2) /features → sign_up (28). 3) /checkout → purchase (52). 4) /blog/ai-tools-guide → sign_up (18). Conversion rate (sessions → sign_up): 2.8%. Purchase conversion rate: 0.7%. Would you like to compare with last week or run a funnel report?
```

**Prompt:** 
```
What devices are our users on and which countries are generating the most traffic?
```

**Response:** 
```
Device breakdown (last 30 days): Desktop 58.4% (24,100 users), Mobile 35.2% (14,500 users), Tablet 6.4% (2,640 users). User demographics by country: 1) United States — 34.2% (14,100 users). 2) United Kingdom — 12.8% (5,280). 3) Germany — 8.4% (3,460). 4) Canada — 7.1% (2,930). 5) Brazil — 6.3% (2,600). 6) France — 5.2% (2,140). Mobile traffic has grown 15% month-over-month. Would you like to run a device-specific conversion analysis?
```

## Capabilities

### Identify top web pages
Retrieves a ranked list of your site's most viewed pages over any specified time frame.

### Trace visitor sources
Pinpoints where website visitors came from, breaking down traffic by source and medium (e.g., Google Organic, Paid Ads).

### Analyze user locations
Shows you which countries are sending the most traffic to your site.

### Track conversion details
Gathers counts and revenue data for specific goal or conversion events.

### View real-time activity
Monitors active users and current page views as they happen right now.

## Use Cases

### Investigating a sudden drop in sign-ups
A user asks the agent: 'Our sign-up conversions dropped 20% last week. What's up?' The agent runs `get_conversions` and then cross-references it with `run_pivot_report`, revealing that only mobile traffic from a specific country was affected.

### Preparing for an executive meeting
A manager needs to show the board how much revenue is coming from different device types. They use the agent to run `get_device_breakdown` and then ask for a summary of conversion data, which saves them hours in manual reporting.

### Debugging a new feature launch
A product team needs immediate feedback on a page update. They use the agent to run `run_realtime_report` while QA tests it, seeing if active users are behaving differently than expected right now.

### Understanding user drop-off points
A growth engineer wants to map out the path a typical user takes. They use `get_page_views` to find high-traffic pages, then follow up with `get_user_demographics` to see which countries are interested in those specific pages.

## Benefits

- Stop leaving the GA4 dashboard. You can ask your agent for things like 'show me all traffic from LinkedIn' or 'what are our top pages?' without ever clicking a filter.
- Need to check if certain metrics work together? Use the `get_metadata` tool to list available dimensions and verify compatibility before running any report.
- When you need deep comparisons, use `run_pivot_report`. It lets you cross-reference user demographics against conversion counts in one shot.
- Want to know what's happening right now? The `run_realtime_report` tool gives you instant visibility into active users and current page views. No waiting for data refresh cycles.
- Targeting campaign performance is easy. Run a report using the `get_traffic_sources` tool to immediately see if your paid ads are driving better revenue than organic search.
- Analyze user location instantly. The `get_user_demographics` tool tells you exactly which countries are sending traffic, helping prioritize regional campaigns.

## How It Works

The bottom line is: you talk to your agent, and it pulls specific analytics reports from Google Analytics 4 without needing to log into the dashboard.

1. Subscribe to this MCP, then enter your Google OAuth Access Token and GA4 Property ID.
2. Your AI agent sends a request specifying the required date ranges, dimensions, and metrics.
3. The MCP runs the query against GA4 data and returns structured results directly to your chat interface.

## Frequently Asked Questions

**How do I run a custom report using get_metadata with Google Analytics 4?**
You first use `get_metadata` to list all available dimensions and metrics. Then, you provide those specific field names when asking the agent to 'run a report' so it knows exactly what data to pull.

**What is the difference between get_page_views and run_report?**
`get_page_views` quickly gives you the top 25 pages by views. `run_report`, however, lets you build a fully custom report by specifying date ranges, dimensions, and metrics to cover specific analyses.

**Can I see live traffic using run_realtime_report?**
Yes. `run_realtime_report` monitors active users and current page views instantly. This is perfect for checking how a site performs during peak hours without delay.

**Does get_user_demographics cover all countries?**
It pulls user distribution by country, providing geographic insights on your traffic sources. You can use this data to focus marketing efforts regionally.

**Before running a custom report, how do I use `check_compatibility` to verify my GA4 dimensions and metrics?**
It confirms whether the combination of dimensions, metrics, and date ranges you plan to query are supported by your specific GA4 property. Run this tool first before calling run_report to prevent errors and ensure accurate data retrieval.

**Is there a way to run several different analytics reports simultaneously using `batch_run_reports`?**
Yes, batch_run_reports is designed for efficiency. It lets you submit multiple, varied report requests in a single call. This saves time compared to calling run_report repeatedly for different date ranges or segments.

**What does the `list_audience_exports` tool help me find regarding user groups?**
This function retrieves a list of pre-defined audience exports within your GA4 property. It tells you which specialized user groups—like 'High Value Shoppers' or 'Lapsed Users'—you can analyze further for deeper segmentation.

**When I call `run_report`, what specific data structure must the JSON request include?**
You must provide three distinct arrays in your JSON payload: `dateRanges` for time periods, an array of desired `dimensions`, and an array of target `metrics`. Missing any one of these elements will cause the report to fail.

**Can I run custom reports with specific dimensions and metrics?**
Yes! The `run_report` tool accepts a JSON configuration with dateRanges, dimensions (e.g., pagePath, sessionSource), and metrics (e.g., sessions, screenPageViews, conversions). Use `get_metadata` to list all available dimensions and metrics, and `check_compatibility` to verify your combination is valid before running.

**Does GA4 require two credentials — an access token and a property ID?**
Yes. You need a Google OAuth **Access Token** (for authentication via Bearer header) and a **GA4 Property ID** (numeric ID identifying your specific GA4 property). The Access Token can be generated via a Google Cloud Service Account with the Analytics Data API enabled. The Property ID is found in GA4 Admin > Property Settings.

**Can I see real-time active users on my website?**
Yes. The `run_realtime_report` tool provides current active user data with real-time dimensions and metrics. For pre-built convenience reports, use `get_page_views` for top pages, `get_traffic_sources` for session sources, and `get_device_breakdown` for device distribution.