getActiveUsers
Get active users metrics for a specific date range
Ask a GA4 property for page views, active users, events or session behaviour over a date range — and build the reports the presets miss out of metrics, dimensions and a filter.
No longer maintained. The GitHub repository for this server is archived — no fixes or security updates are expected.
LABSCO SUMMARY
getPageViews, getActiveUsers, getEvents and getUserBehavior each take a date range and nothing else, which covers the routine reads without a trip through the report builder; runReport is there for the ones that do not fit. Everything is read-only, and the property is fixed by GA_PROPERTY_ID rather than passed per call — no tool here takes a property identifier, so a second property means a second server.
Five read tools over a single GA4 property: four preset reports covering the routine questions, and runReport for anything you can express as metrics plus dimensions plus a dimension filter.
A GA4 property and a Google service account authorised on it: GOOGLE_CLIENT_EMAIL, GOOGLE_PRIVATE_KEY and GA_PROPERTY_ID.
One command plus credentials — npm install -g mcp-server-google-analytics, then supply credentials
USE CASES
Two calls over the same date range give traffic and audience: page views, optionally split by dimensions, and the active user count.
Name the event and a date range that starts at the release, and see whether anything came back at all — the fastest way to tell a tracking bug from a product problem.
Session duration and bounce rate over a date range answer whether the traffic you got was the traffic you wanted.
Specify metrics, dimensions and a dimension filter directly when the question is narrower than the four preset reports — a landing page cohort, one campaign, one country.
Counted once with only startup setup. Other versions, modes or optional credentials may expose a different list.
getActiveUsersGet active users metrics for a specific date range
getEventsGet event metrics for a specific date range
getPageViewsGet page view metrics for a specific date range
getUserBehaviorGet user behavior metrics like session duration and bounce rate
runReportRun a report to get analytics data
BEFORE YOU INSTALL
5 tools when we connected. All five only read GA4. runReport is the general tool; the other four are presets. Names are camelCase, such as getPageViews.
The documented client runs the server on your machine.
CONTEXT COST
Rated by the size of the 5 tool definitions that ride along on every turn, not by how many there are
INSTALLATION
npm install -g mcp-server-google-analytics{
"mcpServers": {
"google-analytics": {
"command": "npx",
"args": [
"-y",
"mcp-server-google-analytics"
],
"env": {
"GOOGLE_CLIENT_EMAIL": "<YOUR_GOOGLE_CLIENT_EMAIL>",
"GOOGLE_PRIVATE_KEY": "<YOUR_GOOGLE_PRIVATE_KEY>",
"GA_PROPERTY_ID": "<YOUR_GA_PROPERTY_ID>"
}
}
}
}