npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

erica-ga4-mcp

v1.2.1

Published

MCP server for Google Analytics 4 - access GA4 data from Claude

Readme

ERICA GA4 MCP Server

Google Analytics 4 MCP Server for ERICA - provides GA4 data access via the Model Context Protocol.

Features

  • ga4_list_accounts: List all GA4 accounts and properties
  • ga4_get_property_details: Get details about a specific property
  • ga4_run_report: Run custom reports with any dimensions/metrics
  • ga4_run_realtime_report: Get real-time analytics data
  • ga4_get_top_pages: Get top performing pages
  • ga4_get_traffic_sources: Get traffic source breakdown
  • ga4_get_user_metrics: Get user metrics (new vs returning, devices)
  • ga4_get_conversions: Get conversion/event data
  • ga4_get_dimensions: List available dimensions
  • ga4_get_metrics: List available metrics
  • ga4_compare_periods: Compare metrics between time periods

Setup for Team Members

Option A: Connect to ERICA Server (Recommended)

This is the easiest setup for team members. The ERICA server handles OAuth authentication centrally.

Prerequisites:

  • GA4 must be authorized in the ERICA web UI (one-time setup by admin)

Claude Desktop Config (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "ga4": {
      "command": "npx",
      "args": ["-y", "erica-ga4-mcp"],
      "env": {
        "ERICA_SERVER_URL": "https://erica.s1.solicom.net"
      }
    }
  }
}

That's it! The MCP will fetch tokens from the ERICA server automatically.

Option B: Service Account (for standalone use)

If you need to use GA4 MCP without the ERICA server:

  1. Create a service account in Google Cloud Console
  2. Enable GA4 Admin API and GA4 Data API
  3. Grant the service account Viewer access to your GA4 properties
  4. Configure Claude Desktop:
{
  "mcpServers": {
    "ga4": {
      "command": "npx",
      "args": ["-y", "erica-ga4-mcp"],
      "env": {
        "GA4_SERVICE_ACCOUNT_KEY": "{\"type\":\"service_account\",...}"
      }
    }
  }
}

Admin Setup (One-Time)

For the ERICA server option to work, an admin needs to:

  1. Enable APIs in Google Cloud Console:

  2. Add OAuth redirect URI to the Google Cloud OAuth client:

    • Go to APIs & Services → Credentials
    • Edit the OAuth 2.0 Client ID
    • Add redirect URI: https://erica.s1.solicom.net/oauth/ga4/callback
  3. Authorize GA4 in ERICA:

    • Visit the ERICA web UI
    • Click "Authorize GA4" in the purple banner
    • Sign in with a Google account that has access to your GA4 properties

Example Questions

Once connected, you can ask questions like:

  • "What were my top 5 traffic sources last month?"
  • "How did mobile vs desktop traffic perform this quarter?"
  • "Which pages have the highest bounce rate?"
  • "Show me conversion rates broken down by country"
  • "What's my real-time user count right now?"
  • "How many new users did I get from organic search last week?"
  • "Compare my traffic this month vs last month"

Common Dimensions

  • date, dateHour, dateHourMinute
  • country, city, region
  • deviceCategory, operatingSystem, browser
  • pagePath, pageTitle, landingPage
  • sessionSource, sessionMedium, sessionDefaultChannelGroup
  • eventName
  • newVsReturning

Common Metrics

  • activeUsers, newUsers, totalUsers
  • sessions, sessionsPerUser
  • screenPageViews, screenPageViewsPerSession
  • averageSessionDuration, bounceRate
  • engagedSessions, engagementRate
  • eventCount, conversions