{"_id":"mcp-google-analytics","_rev":"8-f9fd2bb52fa7db0f712e4da189d7e4e0","name":"mcp-google-analytics","dist-tags":{"latest":"1.3.1"},"versions":{"1.0.0":{"name":"mcp-google-analytics","version":"1.0.0","keywords":["mcp","model-context-protocol","google-analytics","ga4","analytics","measurement-protocol","claude","cursor"],"author":{"name":"Leonardo Sepúlveda","email":"lsepulvedatabares@gmail.com"},"license":"MIT","_id":"mcp-google-analytics@1.0.0","maintainers":[{"name":"gomakers","email":"leonardo@gomakers.ai"}],"homepage":"https://github.com/gomakers-ai/mcp-google-analytics#readme","bugs":{"url":"https://github.com/gomakers-ai/mcp-google-analytics/issues"},"bin":{"mcp-google-analytics":"build/index.js"},"dist":{"shasum":"1210eecd3b2579806e1b4ca7f690147cee468a14","tarball":"https://registry.npmjs.org/mcp-google-analytics/-/mcp-google-analytics-1.0.0.tgz","fileCount":23,"integrity":"sha512-JwaXoAnVJlEcTh997Imy5CnPsO+ykq96QyU21xZhvOYWEOIGd5veUMhyCezvhUTXbLObNNXcuXeXxYsthI9wkQ==","signatures":[{"sig":"MEUCIQDSp3698+AjjdJu60Ca9+ny+FOsTxOtOFnCpQ/XRQtcowIgCEky7OFiMgGRbq12NSqKC9OOrx+4wOEAcHPkoZ1or04=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":147993},"type":"module","engines":{"node":">=18"},"scripts":{"dev":"npm run build && node build/index.js","build":"tsc && chmod +x build/index.js","watch":"tsc --watch","prepare":"npm run build"},"_npmUser":{"name":"gomakers","email":"leonardo@gomakers.ai"},"repository":{"url":"git+https://github.com/gomakers-ai/mcp-google-analytics.git","type":"git"},"_npmVersion":"10.8.2","description":"MCP server for Google Analytics Data API and Measurement Protocol - Read reports and send events","directories":{},"_nodeVersion":"20.19.3","dependencies":{"zod":"^3.24.1","axios":"^1.7.9","dotenv":"^16.4.5","google-auth-library":"^9.15.0","@modelcontextprotocol/sdk":"^1.0.4"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.7.2","@types/node":"^22.10.2"},"_npmOperationalInternal":{"tmp":"tmp/mcp-google-analytics_1.0.0_1763954916644_0.8969411424024285","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"mcp-google-analytics","version":"1.0.1","keywords":["mcp","model-context-protocol","google-analytics","ga4","analytics","measurement-protocol","claude","cursor"],"author":{"name":"Leonardo Sepúlveda","email":"lsepulvedatabares@gmail.com"},"license":"MIT","_id":"mcp-google-analytics@1.0.1","maintainers":[{"name":"gomakers","email":"leonardo@gomakers.ai"}],"homepage":"https://github.com/leosepulveda/mcp-google-analytics#readme","bugs":{"url":"https://github.com/leosepulveda/mcp-google-analytics/issues"},"bin":{"mcp-google-analytics":"build/index.js"},"dist":{"shasum":"3dbbc3cd2522d081b63458b8b405d035b695ea58","tarball":"https://registry.npmjs.org/mcp-google-analytics/-/mcp-google-analytics-1.0.1.tgz","fileCount":23,"integrity":"sha512-V9Hqa5wT1+fCwBTVywimQkX0YuDUZDF/hbNdhQAuDgeaCc+K1mDtcEOxcmveC5dhrYB05YcFi8Zx8RG8yvMj1w==","signatures":[{"sig":"MEQCIC22MquCl9pzPEOLIsP9aN3i6G7gYMOFcpk63+SfTfM5AiAvF/MM5x86IE0uXYdwnsv7bV+mK32Eij+G7LTDk1bwhg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":147953},"type":"module","engines":{"node":">=18"},"gitHead":"85da9de9781154167d062698b049741fcc94ca8d","scripts":{"dev":"npm run build && node build/index.js","build":"tsc && chmod +x build/index.js","watch":"tsc --watch","prepare":"npm run build"},"_npmUser":{"name":"gomakers","email":"leonardo@gomakers.ai"},"repository":{"url":"git+https://github.com/leosepulveda/mcp-google-analytics.git","type":"git"},"_npmVersion":"10.8.2","description":"MCP server for Google Analytics Data API and Measurement Protocol - Read reports and send events","directories":{},"_nodeVersion":"20.19.3","dependencies":{"zod":"^3.24.1","axios":"^1.7.9","dotenv":"^16.4.5","google-auth-library":"^9.15.0","@modelcontextprotocol/sdk":"^1.0.4"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.7.2","@types/node":"^22.10.2"},"_npmOperationalInternal":{"tmp":"tmp/mcp-google-analytics_1.0.1_1764940910472_0.4845939779263606","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"mcp-google-analytics","version":"1.1.0","keywords":["mcp","model-context-protocol","google-analytics","ga4","analytics","measurement-protocol","claude","cursor"],"author":{"name":"Leonardo Sepúlveda","email":"lsepulvedatabares@gmail.com"},"license":"MIT","_id":"mcp-google-analytics@1.1.0","maintainers":[{"name":"gomakers","email":"lsepulvedatabares@gmail.com"}],"homepage":"https://github.com/leonardosepulvedat/mcp-google-analytics#readme","bugs":{"url":"https://github.com/leonardosepulvedat/mcp-google-analytics/issues"},"bin":{"mcp-google-analytics":"build/index.js"},"dist":{"shasum":"d745089963873950984b1da29970bad1918c58d6","tarball":"https://registry.npmjs.org/mcp-google-analytics/-/mcp-google-analytics-1.1.0.tgz","fileCount":19,"integrity":"sha512-dIXPXj+GW6h2cpNQc7XLXqwLwEsrg8lJhGpYRguMPn6kJ6GzC51MnkVqJpjeVbk6DDQ9u5RBL9FUj3TWiNrRLQ==","signatures":[{"sig":"MEUCIHgWg462IlS3XO53HYvS15hoySok1tKWkKocrjVHashKAiEA0VFLkkPuAH0NWoLdVIj01J4KcOWfOPn+SoAspKfNWik=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":109618},"type":"module","engines":{"node":">=20"},"gitHead":"c766aff77dec100d8960afbf7f34a12c01208cba","scripts":{"dev":"npm run build && node build/index.js","test":"vitest run","build":"tsc && chmod +x build/index.js","watch":"tsc --watch","prepare":"npm run build"},"_npmUser":{"name":"gomakers","email":"lsepulvedatabares@gmail.com"},"repository":{"url":"git+https://github.com/leonardosepulvedat/mcp-google-analytics.git","type":"git"},"_npmVersion":"10.9.7","description":"MCP server for Google Analytics Data API and Measurement Protocol - Read reports and send events","directories":{},"_nodeVersion":"22.22.2","dependencies":{"zod":"^3.24.1","axios":"^1.19.0","google-auth-library":"^11.0.0","@modelcontextprotocol/sdk":"^1.30.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.10","typescript":"^5.7.2","@types/node":"^22.20.1"},"_npmOperationalInternal":{"tmp":"tmp/mcp-google-analytics_1.1.0_1786025375964_0.6482844503703098","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"mcp-google-analytics","version":"1.1.1","keywords":["mcp","model-context-protocol","google-analytics","ga4","analytics","measurement-protocol","claude","cursor"],"author":{"name":"Leonardo Sepúlveda","email":"lsepulvedatabares@gmail.com"},"license":"MIT","_id":"mcp-google-analytics@1.1.1","maintainers":[{"name":"gomakers","email":"lsepulvedatabares@gmail.com"}],"homepage":"https://github.com/leonardosepulvedat/mcp-google-analytics#readme","bugs":{"url":"https://github.com/leonardosepulvedat/mcp-google-analytics/issues"},"bin":{"mcp-google-analytics":"build/index.js"},"dist":{"shasum":"9da8d5d6cc129f7198b42e111d2b2a358f50be6b","tarball":"https://registry.npmjs.org/mcp-google-analytics/-/mcp-google-analytics-1.1.1.tgz","fileCount":19,"integrity":"sha512-XMlydGVX2SmcUhoYssuHRrjG11SOMMwQn4AxEGLwl2lYO5VbUycOGmxnpk0o9/VDVacxGUwWKkeCLY2JEq0Z7Q==","signatures":[{"sig":"MEUCIQDGttUCij4RmKPHKDZwIK3P5zQtJOTnl5pqErMienzKaQIgH0rKkrMf8daNCArFaBqvX9fn676IJ2yo8DFUyXY9Y1M=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":113819},"type":"module","engines":{"node":">=20"},"gitHead":"b1466d72c4fd1db44700dca8a7c072ea2f0e5d36","scripts":{"dev":"npm run build && node build/index.js","test":"vitest run","build":"tsc && chmod +x build/index.js","watch":"tsc --watch","prepare":"npm run build"},"_npmUser":{"name":"gomakers","email":"lsepulvedatabares@gmail.com"},"repository":{"url":"git+https://github.com/leonardosepulvedat/mcp-google-analytics.git","type":"git"},"_npmVersion":"10.9.7","description":"MCP server for Google Analytics Data API and Measurement Protocol - Read reports and send events","directories":{},"_nodeVersion":"22.22.2","dependencies":{"zod":"^3.24.1","axios":"^1.19.0","google-auth-library":"^11.0.0","@modelcontextprotocol/sdk":"^1.30.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.10","typescript":"^5.7.2","@types/node":"^22.20.1"},"_npmOperationalInternal":{"tmp":"tmp/mcp-google-analytics_1.1.1_1786027349212_0.8318679610466102","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"mcp-google-analytics","version":"1.2.0","keywords":["mcp","model-context-protocol","google-analytics","ga4","analytics","measurement-protocol","claude","cursor","ga4-mcp","google-analytics-data-api","server-side-tracking","ecommerce-events"],"author":{"name":"Leonardo Sepúlveda","email":"lsepulvedatabares@gmail.com"},"license":"MIT","_id":"mcp-google-analytics@1.2.0","maintainers":[{"name":"gomakers","email":"lsepulvedatabares@gmail.com"}],"homepage":"https://github.com/leonardosepulvedat/mcp-google-analytics#readme","bugs":{"url":"https://github.com/leonardosepulvedat/mcp-google-analytics/issues"},"bin":{"mcp-google-analytics":"build/index.js"},"dist":{"shasum":"73c50a9a801354451e231b9ad5057a5ba363b243","tarball":"https://registry.npmjs.org/mcp-google-analytics/-/mcp-google-analytics-1.2.0.tgz","fileCount":19,"integrity":"sha512-y73qZGIX5yRM3WzxN1gT0rjShts0CT5scXSPo/F4AyK+1a+xlgDgpcKJg/KG0790yzLb8d4WJ4SmCJoTXV/qoQ==","signatures":[{"sig":"MEUCIFkpD+6IxTY0okSiVa4ea4zrt4cpAkUDgsCWofYDzpGQAiEAtDb+hhmCgBeWB6KdICBRviQpiJUiNCpeFoB9jo5hMeA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":132551},"type":"module","engines":{"node":">=20"},"gitHead":"aaf1b9e5c95891af394702d73fb426a0884feab6","scripts":{"dev":"npm run build && node build/index.js","test":"vitest run","build":"tsc && chmod +x build/index.js","watch":"tsc --watch","prepare":"npm run build"},"_npmUser":{"name":"gomakers","email":"lsepulvedatabares@gmail.com"},"repository":{"url":"git+https://github.com/leonardosepulvedat/mcp-google-analytics.git","type":"git"},"_npmVersion":"10.9.7","description":"GA4 MCP server that reads AND writes: run reports and funnels (Data API), audit your setup (custom dimensions, key events, compatibility checks), and send events server-side (Measurement Protocol v2)","directories":{},"_nodeVersion":"22.22.2","dependencies":{"zod":"^3.24.1","axios":"^1.19.0","google-auth-library":"^11.0.0","@modelcontextprotocol/sdk":"^1.30.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.10","typescript":"^5.7.2","@types/node":"^22.20.1"},"_npmOperationalInternal":{"tmp":"tmp/mcp-google-analytics_1.2.0_1787317166005_0.5131456914858614","host":"s3://npm-registry-packages-npm-production"}},"1.2.1":{"name":"mcp-google-analytics","version":"1.2.1","keywords":["mcp","model-context-protocol","google-analytics","ga4","analytics","measurement-protocol","claude","cursor","ga4-mcp","google-analytics-data-api","server-side-tracking","ecommerce-events"],"author":{"name":"Leonardo Sepúlveda","email":"lsepulvedatabares@gmail.com"},"license":"MIT","_id":"mcp-google-analytics@1.2.1","maintainers":[{"name":"gomakers","email":"lsepulvedatabares@gmail.com"}],"homepage":"https://github.com/leonardosepulvedat/mcp-google-analytics#readme","bugs":{"url":"https://github.com/leonardosepulvedat/mcp-google-analytics/issues"},"bin":{"mcp-google-analytics":"build/index.js"},"dist":{"shasum":"2a0a0034335dcd411a647066351b617b22f8a242","tarball":"https://registry.npmjs.org/mcp-google-analytics/-/mcp-google-analytics-1.2.1.tgz","fileCount":19,"integrity":"sha512-e5VvowZvy/sYw1KzXhsxAbdyg+mQhGmklQBJpTSWCylHZi78GuF0/pZvLOUB13ycMOyzvqp92fFIX+UY0j6nNQ==","signatures":[{"sig":"MEQCIEqui1F/PIaBvHTB3H3Jlgp97x5xw4ctuqUNwBfcSc3dAiADmAx1xbeiFbtz80k9qbRmsEjQbHVI+JyaSE+1P/yt5w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":133581},"type":"module","engines":{"node":">=20"},"gitHead":"922e9e037b97dbf2351438efb00fca3a85725ec8","mcpName":"io.github.leonardosepulvedat/mcp-google-analytics","scripts":{"dev":"npm run build && node build/index.js","test":"vitest run","build":"tsc && chmod +x build/index.js","watch":"tsc --watch","prepare":"npm run build"},"_npmUser":{"name":"gomakers","email":"lsepulvedatabares@gmail.com"},"repository":{"url":"git+https://github.com/leonardosepulvedat/mcp-google-analytics.git","type":"git"},"_npmVersion":"10.9.7","description":"GA4 MCP server that reads AND writes: run reports and funnels (Data API), audit your setup (custom dimensions, key events, compatibility checks), and send events server-side (Measurement Protocol v2)","directories":{},"_nodeVersion":"22.22.2","dependencies":{"zod":"^3.24.1","axios":"^1.19.0","google-auth-library":"^11.0.0","@modelcontextprotocol/sdk":"^1.30.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.10","typescript":"^5.7.2","@types/node":"^22.20.1"},"_npmOperationalInternal":{"tmp":"tmp/mcp-google-analytics_1.2.1_1787320179610_0.8295874887879577","host":"s3://npm-registry-packages-npm-production"}},"1.3.0":{"name":"mcp-google-analytics","version":"1.3.0","keywords":["mcp","model-context-protocol","google-analytics","ga4","analytics","measurement-protocol","claude","cursor","ga4-mcp","google-analytics-data-api","server-side-tracking","ecommerce-events"],"author":{"name":"Leonardo Sepúlveda","email":"lsepulvedatabares@gmail.com"},"license":"MIT","_id":"mcp-google-analytics@1.3.0","maintainers":[{"name":"gomakers","email":"lsepulvedatabares@gmail.com"}],"homepage":"https://github.com/leonardosepulvedat/mcp-google-analytics#readme","bugs":{"url":"https://github.com/leonardosepulvedat/mcp-google-analytics/issues"},"bin":{"mcp-google-analytics":"build/index.js"},"dist":{"shasum":"b6d044efee670d2c6d2a93e1b1df111f070db2e4","tarball":"https://registry.npmjs.org/mcp-google-analytics/-/mcp-google-analytics-1.3.0.tgz","fileCount":19,"integrity":"sha512-FmU2nQENwxboIjBztnYsWvfO2n8nB6ZaGUpZIhkObRrIOVjSyMpsnfIk+gecHy544zZGawzS41bYNn2zvUq29A==","signatures":[{"sig":"MEQCIG7v0RSHZg8Rp1+4cTmFdqr5w4dxZBjGcs9dEEih7mBZAiB74HG+5PalMNPotjwKthvhL09G4kNe8LFQmTIXcEw1NA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":139389},"type":"module","engines":{"node":">=20"},"gitHead":"8d85255864f7e27eda36b9508dfacc72bae8b07a","mcpName":"io.github.leonardosepulvedat/mcp-google-analytics","scripts":{"dev":"npm run build && node build/index.js","test":"vitest run","build":"tsc && chmod +x build/index.js","watch":"tsc --watch","prepare":"npm run build"},"_npmUser":{"name":"gomakers","email":"lsepulvedatabares@gmail.com"},"repository":{"url":"git+https://github.com/leonardosepulvedat/mcp-google-analytics.git","type":"git"},"_npmVersion":"10.9.7","description":"GA4 MCP server that reads AND writes: run reports and funnels (Data API), audit your setup (custom dimensions, key events, compatibility checks), and send events server-side (Measurement Protocol v2)","directories":{},"_nodeVersion":"22.22.2","dependencies":{"zod":"^3.24.1","axios":"^1.19.0","google-auth-library":"^11.0.0","@modelcontextprotocol/sdk":"^1.30.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.10","typescript":"^5.7.2","@types/node":"^22.20.1"},"_npmOperationalInternal":{"tmp":"tmp/mcp-google-analytics_1.3.0_1787322271344_0.773074331574281","host":"s3://npm-registry-packages-npm-production"}},"1.3.1":{"name":"mcp-google-analytics","version":"1.3.1","description":"GA4 MCP server that reads AND writes: run reports and funnels (Data API), audit your setup (custom dimensions, key events, compatibility checks), and send events server-side (Measurement Protocol v2)","keywords":["mcp","model-context-protocol","google-analytics","ga4","analytics","measurement-protocol","claude","cursor","ga4-mcp","google-analytics-data-api","server-side-tracking","ecommerce-events"],"author":{"name":"Leonardo Sepúlveda","email":"lsepulvedatabares@gmail.com"},"license":"MIT","type":"module","bin":{"mcp-google-analytics":"build/index.js"},"scripts":{"build":"tsc && chmod +x build/index.js","prepare":"npm run build","watch":"tsc --watch","dev":"npm run build && node build/index.js","test":"vitest run"},"dependencies":{"@modelcontextprotocol/sdk":"^1.30.0","axios":"^1.19.0","google-auth-library":"^11.0.0","zod":"^3.24.1"},"devDependencies":{"@types/node":"^22.20.1","typescript":"^5.7.2","vitest":"^4.1.10"},"engines":{"node":">=20"},"repository":{"type":"git","url":"git+https://github.com/leonardosepulvedat/mcp-google-analytics.git"},"bugs":{"url":"https://github.com/leonardosepulvedat/mcp-google-analytics/issues"},"homepage":"https://github.com/leonardosepulvedat/mcp-google-analytics#readme","mcpName":"io.github.leonardosepulvedat/mcp-google-analytics","_id":"mcp-google-analytics@1.3.1","gitHead":"64bd4c98bb70aaa1d1c1620cd89351bba1958922","_nodeVersion":"22.22.2","_npmVersion":"10.9.7","dist":{"integrity":"sha512-gImeZBR7OsWYrzn/AqV4BSMjJBu2j5MlzdO968hVQ7yHlSnDiboviHJVuYxZ5BHAcsLz68uRZvGrbgzVPeH6ng==","shasum":"6359410e182ab9aa39ddf1912eeb1f93d7d05f5c","tarball":"https://registry.npmjs.org/mcp-google-analytics/-/mcp-google-analytics-1.3.1.tgz","fileCount":19,"unpackedSize":144148,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDiWjmnfDd/R9Hr8F3gBiz2REqsXTRZ2itwQATSf8CpEAiEAkS2FivTFnxhNbRg9n+IjLBL1b8rtRY187wTNmFUZwno="}]},"_npmUser":{"name":"gomakers","email":"lsepulvedatabares@gmail.com"},"directories":{},"maintainers":[{"name":"gomakers","email":"lsepulvedatabares@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mcp-google-analytics_1.3.1_1787322977706_0.8229277991644623"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-24T03:28:36.556Z","modified":"2026-08-21T14:36:17.963Z","1.0.0":"2025-11-24T03:28:36.835Z","1.0.1":"2025-12-05T13:21:50.631Z","1.1.0":"2026-08-06T14:09:36.105Z","1.1.1":"2026-08-06T14:42:29.372Z","1.2.0":"2026-08-21T12:59:26.140Z","1.2.1":"2026-08-21T13:49:39.762Z","1.3.0":"2026-08-21T14:24:31.469Z","1.3.1":"2026-08-21T14:36:17.845Z"},"bugs":{"url":"https://github.com/leonardosepulvedat/mcp-google-analytics/issues"},"author":{"name":"Leonardo Sepúlveda","email":"lsepulvedatabares@gmail.com"},"license":"MIT","homepage":"https://github.com/leonardosepulvedat/mcp-google-analytics#readme","keywords":["mcp","model-context-protocol","google-analytics","ga4","analytics","measurement-protocol","claude","cursor","ga4-mcp","google-analytics-data-api","server-side-tracking","ecommerce-events"],"repository":{"type":"git","url":"git+https://github.com/leonardosepulvedat/mcp-google-analytics.git"},"description":"GA4 MCP server that reads AND writes: run reports and funnels (Data API), audit your setup (custom dimensions, key events, compatibility checks), and send events server-side (Measurement Protocol v2)","maintainers":[{"name":"gomakers","email":"lsepulvedatabares@gmail.com"}],"readme":"# MCP Google Analytics Server\n\nA Model Context Protocol (MCP) server for Google Analytics 4, providing comprehensive integration with both the **Google Analytics Data API** (for reading reports) and **Measurement Protocol v2** (for sending events).\n\n**The GA4 MCP that reads AND writes.** Most GA4 MCP servers (including Google's official one) are read-only. This one gives your AI agent the full loop: run reports and funnels, audit your setup (custom dimensions, key events, compatibility checks), send ecommerce and conversion events server-side, and verify them in the realtime report — 26 tools in one `npx` command.\n\n**Built for agencies too**: every read tool accepts an optional `propertyId`, so one conversation can query all your clients' properties — no reconfiguration between clients. See [Multi-Property Mode](#-multi-property-mode-agencies).\n\n[![npm version](https://badge.fury.io/js/mcp-google-analytics.svg)](https://www.npmjs.com/package/mcp-google-analytics)\n[![npm downloads](https://img.shields.io/npm/dm/mcp-google-analytics.svg)](https://www.npmjs.com/package/mcp-google-analytics)\n[![CI](https://github.com/leonardosepulvedat/mcp-google-analytics/actions/workflows/ci.yml/badge.svg)](https://github.com/leonardosepulvedat/mcp-google-analytics/actions/workflows/ci.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![smithery badge](https://smithery.ai/badge/lsepulvedatabares/mcp-google-analytics)](https://smithery.ai/servers/lsepulvedatabares/mcp-google-analytics)\n\n## ⚡ One-Click Install\n\n[![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](cursor://anysphere.cursor-deeplink/mcp/install?name=google-analytics&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIm1jcC1nb29nbGUtYW5hbHl0aWNzIl0sImVudiI6eyJHQV9TRVJWSUNFX0FDQ09VTlRfSlNPTiI6Ii9wYXRoL3RvL3NlcnZpY2UtYWNjb3VudC5qc29uIiwiR0FfUFJPUEVSVFlfSUQiOiIxMjM0NTY3ODkiLCJHQV9NRUFTVVJFTUVOVF9JRCI6IkctWFhYWFhYWFhYWCIsIkdBX0FQSV9TRUNSRVQiOiJ5b3VyLWFwaS1zZWNyZXQifX0=)\n\nClick **Install in Cursor** above, approve, then replace the placeholder values in `~/.cursor/mcp.json` with your real credentials (see [Configuration](#-configuration) below).\n\n## ⚡ Token Optimization - READ THIS FIRST!\n\n**IMPORTANT**: Google Analytics reports can return large datasets that consume significant tokens. This server is designed with token optimization in mind:\n\n- **All read tools default to 10 results** - Adjust the `limit` parameter as needed\n- **Use specific date ranges** - Avoid querying years of data at once\n- **Select only needed dimensions/metrics** - Don't request everything\n- **Check [TOKEN_OPTIMIZATION.md](TOKEN_OPTIMIZATION.md)** for detailed best practices\n\nSee the dedicated [Token Optimization Guide](TOKEN_OPTIMIZATION.md) for strategies to minimize token usage.\n\n## 🚀 Quick Start\n\nSee [QUICKSTART.md](QUICKSTART.md) for a 5-minute setup guide, or follow the installation steps below.\n\n## 📦 Installation\n\n### Option 1: Install globally via npm\n\n```bash\nnpm install -g mcp-google-analytics\n```\n\n### Option 2: Use with npx (no installation needed)\n\n```bash\nnpx mcp-google-analytics\n```\n\n## 🔧 Configuration\n\nThis server requires different credentials for reading data vs sending events:\n\n### For Reading Data (Google Analytics Data API)\n\nYou need a **Service Account** with access to your GA4 property:\n\n1. Go to [Google Cloud Console](https://console.cloud.google.com/)\n2. Create or select a project\n3. Enable the **Google Analytics Data API**\n4. Create a Service Account:\n   - Go to \"IAM & Admin\" > \"Service Accounts\"\n   - Click \"Create Service Account\"\n   - Give it a name (e.g., \"GA4 MCP Reader\")\n   - Grant the \"Viewer\" role\n   - Create a JSON key and download it\n5. Add the service account email to your GA4 property:\n   - Go to GA4 Admin > Property Access Management\n   - Add the service account email with \"Viewer\" role\n6. Get your Property ID:\n   - Go to GA4 Admin > Property Settings\n   - Copy the Property ID (numeric, e.g., \"123456789\")\n\n### For Sending Events (Measurement Protocol)\n\nYou need a **Measurement ID** and **API Secret**:\n\n1. Go to GA4 Admin > Data Streams\n2. Select your data stream (web, iOS, or Android)\n3. Copy the **Measurement ID** (format: `G-XXXXXXXXXX`)\n4. Click \"Measurement Protocol API secrets\"\n5. Click \"Create\" to generate a new API secret\n6. Copy the secret value\n\n### Environment Variables\n\nSet these environment variables:\n\n```bash\n# For Data API (reading)\nexport GA_SERVICE_ACCOUNT_JSON=/path/to/service-account.json\n# Or provide JSON directly:\n# export GA_SERVICE_ACCOUNT_JSON='{\"type\":\"service_account\",\"project_id\":\"...\"}'\n\n# Optional: default property. If omitted, pass \"propertyId\" per tool call\n# (multi-property mode — see below)\nexport GA_PROPERTY_ID=123456789\n\n# For Measurement Protocol (writing)\nexport GA_MEASUREMENT_ID=G-XXXXXXXXXX\nexport GA_API_SECRET=your-api-secret-here\n```\n\n## 🏢 Multi-Property Mode (Agencies)\n\nEvery read tool accepts an optional `propertyId` argument that overrides the configured `GA_PROPERTY_ID` — so a single conversation can query any property the service account can access, with no reconfiguration between clients.\n\n1. Grant your service account \"Viewer\" access on each client's GA4 property (or at account level).\n2. Set only `GA_SERVICE_ACCOUNT_JSON` (`GA_PROPERTY_ID` becomes optional — if set, it acts as the default).\n3. Discover properties, then query any of them:\n\n```\nShow me all my accounts and properties          → ga_get_account_summaries\nCompare last week's active users between the    → ga_run_report with propertyId \"111111\"\nAcme property and the Globex property             and again with propertyId \"222222\"\n```\n\n`propertyId` accepts both `123456789` and `properties/123456789`. Event sending (Measurement Protocol) remains tied to the configured `GA_MEASUREMENT_ID`/`GA_API_SECRET`, since each data stream has its own secret.\n\n## 🔌 Integration with Claude Desktop\n\nAdd to your Claude Desktop configuration file:\n\n**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`\n**Windows**: `%APPDATA%/Claude/claude_desktop_config.json`\n\n```json\n{\n  \"mcpServers\": {\n    \"google-analytics\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mcp-google-analytics\"],\n      \"env\": {\n        \"GA_SERVICE_ACCOUNT_JSON\": \"/path/to/service-account.json\",\n        \"GA_PROPERTY_ID\": \"123456789\",\n        \"GA_MEASUREMENT_ID\": \"G-XXXXXXXXXX\",\n        \"GA_API_SECRET\": \"your-api-secret\"\n      }\n    }\n  }\n}\n```\n\nOr if installed globally:\n\n```json\n{\n  \"mcpServers\": {\n    \"google-analytics\": {\n      \"command\": \"mcp-google-analytics\",\n      \"env\": {\n        \"GA_SERVICE_ACCOUNT_JSON\": \"/path/to/service-account.json\",\n        \"GA_PROPERTY_ID\": \"123456789\",\n        \"GA_MEASUREMENT_ID\": \"G-XXXXXXXXXX\",\n        \"GA_API_SECRET\": \"your-api-secret\"\n      }\n    }\n  }\n}\n```\n\nRestart Claude Desktop after updating the configuration.\n\n## 🎯 Integration with Cursor\n\nAdd to your Cursor MCP settings file:\n\n**macOS/Linux**: `~/.cursor/mcp.json`\n**Windows**: `%USERPROFILE%\\.cursor\\mcp.json`\n\n```json\n{\n  \"mcpServers\": {\n    \"google-analytics\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mcp-google-analytics\"],\n      \"env\": {\n        \"GA_SERVICE_ACCOUNT_JSON\": \"/path/to/service-account.json\",\n        \"GA_PROPERTY_ID\": \"123456789\",\n        \"GA_MEASUREMENT_ID\": \"G-XXXXXXXXXX\",\n        \"GA_API_SECRET\": \"your-api-secret\"\n      }\n    }\n  }\n}\n```\n\nRestart Cursor after updating the configuration.\n\n## 🛠️ Available Tools\n\n### At a Glance\n\n**Reading data (Google Analytics Data API)** — all read tools default to 10 rows to save tokens:\n\n| Tool | Purpose | Notes |\n|---|---|---|\n| `ga_run_report` | Custom reports with dimensions and metrics | Adjust `limit` as needed |\n| `ga_run_realtime_report` | Real-time data (last 30 minutes) | Great for verifying sent events |\n| `ga_get_metadata` | All available dimensions and metrics | Large response (500+ items), use sparingly |\n| `ga_list_accounts` | List accessible GA accounts | |\n| `ga_list_properties` | List GA4 properties | Aggregates all accounts if no `accountId` |\n| `ga_get_property` | Details of the configured property | |\n| `ga_list_data_streams` | Data streams of the property | Useful to find measurement IDs |\n| `ga_run_pivot_report` | Pivot table reports | Responses can be very large |\n| `ga_run_funnel_report` | Funnel analysis across event steps | Uses Data API v1alpha |\n| `ga_batch_run_reports` | Multiple reports in one request | 2–5 reports per batch recommended |\n| `ga_get_account_summaries` | All accounts and properties in one call | Fastest way to discover IDs |\n| `ga_list_custom_dimensions` | Custom dimensions of the property | Discover API names for reports |\n| `ga_list_custom_metrics` | Custom metrics of the property | Discover API names for reports |\n| `ga_list_key_events` | Key events (conversions) of the property | Know what counts as a conversion |\n| `ga_list_google_ads_links` | Google Ads accounts linked to the property | |\n| `ga_check_compatibility` | Validate dimension/metric combos before reporting | Avoids wasted requests and error loops |\n\n**Sending events (Measurement Protocol)**:\n\n| Tool | Purpose |\n|---|---|\n| `ga_send_event` | Any custom GA4 event with parameters |\n| `ga_validate_event` | Test an event against the debug endpoint without recording it |\n| `ga_send_pageview` | Page/screen views |\n| `ga_send_purchase` | Ecommerce purchases with transaction and items |\n| `ga_send_login` | User logins |\n| `ga_send_signup` | User registrations |\n| `ga_send_view_item` | Product/item detail views |\n| `ga_send_add_to_cart` | Add-to-cart events |\n| `ga_send_begin_checkout` | Checkout initiations |\n| `ga_send_refund` | Full or partial refunds |\n\n### Google Analytics Data API (Reading Data)\n\n#### `ga_run_report`\nRun custom reports with dimensions and metrics.\n\n**Common Dimensions**: `date`, `city`, `country`, `deviceCategory`, `browser`, `pagePath`, `eventName`, `sessionSource`, `sessionMedium`, `sessionCampaignName`\n\n**Common Metrics**: `activeUsers`, `sessions`, `screenPageViews`, `conversions`, `totalRevenue`, `engagementRate`, `averageSessionDuration`\n\n**Example**:\n```typescript\n{\n  \"dateRanges\": [{\"startDate\": \"7daysAgo\", \"endDate\": \"today\"}],\n  \"dimensions\": [{\"name\": \"city\"}],\n  \"metrics\": [{\"name\": \"activeUsers\"}],\n  \"limit\": 10\n}\n```\n\n#### `ga_run_realtime_report`\nGet real-time data (last 30 minutes).\n\n**Example**:\n```typescript\n{\n  \"metrics\": [{\"name\": \"activeUsers\"}],\n  \"dimensions\": [{\"name\": \"country\"}],\n  \"limit\": 10\n}\n```\n\n#### `ga_get_metadata`\nGet all available dimensions and metrics for your property.\n\n**Warning**: Returns 500+ items. Use sparingly.\n\n#### `ga_list_accounts`\nList all GA accounts accessible to the service account.\n\n#### `ga_list_properties`\nList GA4 properties, optionally filtered by account ID.\n\n#### `ga_get_property`\nGet details about the configured property.\n\n#### `ga_list_data_streams`\nList data streams for the configured property.\n\n#### `ga_run_pivot_report`\nRun pivot table reports with row/column dimensions.\n\n**Example**:\n```typescript\n{\n  \"dateRanges\": [{\"startDate\": \"7daysAgo\", \"endDate\": \"today\"}],\n  \"dimensions\": [{\"name\": \"country\"}, {\"name\": \"deviceCategory\"}],\n  \"metrics\": [{\"name\": \"activeUsers\"}],\n  \"pivots\": [{\"fieldNames\": [\"deviceCategory\"], \"limit\": 5}]\n}\n```\n\n#### `ga_run_funnel_report`\nRun funnel analysis to track user progression.\n\n**Note**: Funnel reporting uses the Data API v1alpha channel (the only channel where Google exposes it). Each step matches an event: set `eventName` per step, or omit it to use the step's `name` as the event name. For advanced matching, pass a full `filterExpression`.\n\n**Example**:\n```typescript\n{\n  \"dateRanges\": [{\"startDate\": \"7daysAgo\", \"endDate\": \"today\"}],\n  \"funnelSteps\": [\n    {\"name\": \"page_view\"},\n    {\"name\": \"add_to_cart\"},\n    {\"name\": \"begin_checkout\"},\n    {\"name\": \"Purchase\", \"eventName\": \"purchase\"}\n  ]\n}\n```\n\n#### `ga_batch_run_reports`\nRun multiple reports in a single request.\n\n**Warning**: Can return large datasets. Limit to 2-5 reports per batch.\n\n#### `ga_get_account_summaries`\nGet all accessible accounts with their properties in a single compact call. The fastest way to discover account and property IDs.\n\n#### `ga_list_custom_dimensions` / `ga_list_custom_metrics`\nList the custom dimensions and metrics defined for the property, including their API names (e.g., `customEvent:plan_type`) so you can use them in reports.\n\n#### `ga_list_key_events`\nList the key events (conversions) configured for the property — useful before building conversion reports or deciding which events to send.\n\n#### `ga_list_google_ads_links`\nList Google Ads accounts linked to the property.\n\n#### `ga_check_compatibility`\nCheck whether a dimension/metric combination is valid **before** running a report, avoiding wasted requests and token-heavy error loops.\n\n**Example**:\n```typescript\n{\n  \"dimensions\": [{\"name\": \"city\"}],\n  \"metrics\": [{\"name\": \"activeUsers\"}],\n  \"compatibilityFilter\": \"COMPATIBLE\"\n}\n```\n\n### Measurement Protocol (Sending Events)\n\n> **Good to know**:\n> - Events take a few minutes to appear in standard reports, but show up almost immediately in the realtime report (`ga_run_realtime_report`).\n> - Use `ga_validate_event` to test new events without recording them.\n> - If you omit `client_id`, one is auto-generated per call. To have GA group several events (e.g., a cart-to-purchase flow) into the same session and user, pass the **same `client_id`** to every call.\n\n#### `ga_send_event`\nSend custom events to GA4.\n\n**Example**:\n```typescript\n{\n  \"events\": [{\n    \"name\": \"button_click\",\n    \"params\": {\n      \"button_id\": \"cta_signup\",\n      \"page\": \"/landing\"\n    }\n  }],\n  \"user_id\": \"user123\"\n}\n```\n\n#### `ga_validate_event`\nValidate events before sending (uses debug endpoint).\n\n#### `ga_send_pageview`\nSend page view events.\n\n**Example**:\n```typescript\n{\n  \"page_location\": \"https://example.com/products\",\n  \"page_title\": \"Products\",\n  \"user_id\": \"user123\"\n}\n```\n\n#### `ga_send_purchase`\nSend ecommerce purchase events.\n\n**Example**:\n```typescript\n{\n  \"transaction_id\": \"T12345\",\n  \"value\": 99.99,\n  \"currency\": \"USD\",\n  \"items\": [{\n    \"item_id\": \"SKU123\",\n    \"item_name\": \"Product Name\",\n    \"price\": 99.99,\n    \"quantity\": 1\n  }]\n}\n```\n\n#### `ga_send_login`\nSend login events.\n\n#### `ga_send_signup`\nSend user registration events.\n\n#### `ga_send_view_item`\nSend product/item detail view events. Completes the standard ecommerce funnel: `view_item` → `add_to_cart` → `begin_checkout` → `purchase`.\n\n#### `ga_send_add_to_cart`\nSend add-to-cart events.\n\n#### `ga_send_begin_checkout`\nSend checkout initiation events.\n\n#### `ga_send_refund`\nSend full or partial refund events. Use the same `transaction_id` as the original purchase; omit `items` for a full refund, include them for a partial one.\n\n**Example (partial refund)**:\n```typescript\n{\n  \"transaction_id\": \"T12345\",\n  \"currency\": \"USD\",\n  \"value\": 49.99,\n  \"items\": [{\"item_id\": \"SKU123\", \"quantity\": 1}]\n}\n```\n\n## 📖 Usage Examples\n\nSee [EXAMPLES.md](EXAMPLES.md) for practical usage examples in Spanish.\n\n### Example: Get users by country (last 7 days)\n\n```\nShow me active users by country for the last 7 days\n```\n\nClaude will use `ga_run_report`:\n```json\n{\n  \"dateRanges\": [{\"startDate\": \"7daysAgo\", \"endDate\": \"today\"}],\n  \"dimensions\": [{\"name\": \"country\"}],\n  \"metrics\": [{\"name\": \"activeUsers\"}],\n  \"limit\": 10,\n  \"orderBys\": [{\"metric\": {\"metricName\": \"activeUsers\"}, \"desc\": true}]\n}\n```\n\n### Example: Track a purchase\n\n```\nSend a purchase event for order #12345, $99.99 USD\n```\n\nClaude will use `ga_send_purchase`:\n```json\n{\n  \"transaction_id\": \"12345\",\n  \"value\": 99.99,\n  \"currency\": \"USD\",\n  \"items\": [{\n    \"item_id\": \"product_1\",\n    \"item_name\": \"Example Product\",\n    \"price\": 99.99,\n    \"quantity\": 1\n  }]\n}\n```\n\n### Example: Validate an event before sending it\n\nRecommended before wiring up any new event: the debug endpoint checks the payload without recording anything.\n\n```\nValidate this tutorial_complete event before we send it for real\n```\n\nClaude will use `ga_validate_event`:\n```json\n{\n  \"client_id\": \"test.123\",\n  \"events\": [{\n    \"name\": \"tutorial_complete\",\n    \"params\": {\"tutorial_id\": \"onboarding\", \"duration_seconds\": 120}\n  }]\n}\n```\n\nThe response lists validation messages; an empty list means the event is well-formed.\n\n### Example: Server-side conversion tracking\n\nTrack signups or logins that happen in your backend, where no JavaScript tag runs:\n\n```\nA user just registered with Google OAuth, record the signup in Analytics\n```\n\nClaude will use `ga_send_signup`:\n```json\n{\n  \"user_id\": \"user_789\",\n  \"method\": \"Google\"\n}\n```\n\n### Example: Full ecommerce funnel from an agent\n\nSend the same `client_id` on each call so GA groups the events into one session:\n\n```\nTrack this user's journey: they added a $49 course to the cart, started checkout, and completed the purchase\n```\n\nClaude will chain `ga_send_add_to_cart` → `ga_send_begin_checkout` → `ga_send_purchase`, reusing the client ID:\n```json\n{\n  \"client_id\": \"555.1717000000\",\n  \"currency\": \"USD\",\n  \"value\": 49,\n  \"items\": [{\"item_id\": \"course_101\", \"item_name\": \"Intro Course\", \"price\": 49, \"quantity\": 1}]\n}\n```\n\n### Example: Custom events from automations\n\nMeasure things GA never sees natively, like AI agent activity or scheduled jobs:\n\n```\nLog that the weekly report generator ran successfully\n```\n\nClaude will use `ga_send_event`:\n```json\n{\n  \"events\": [{\n    \"name\": \"automation_run\",\n    \"params\": {\"job\": \"weekly_report\", \"status\": \"success\", \"duration_ms\": 5400}\n  }]\n}\n```\n\n### Example: Send and verify in one conversation\n\nCombine both APIs to confirm your tracking works end to end:\n\n```\nSend a test event and confirm Analytics received it\n```\n\nClaude will call `ga_send_event`, then check with `ga_run_realtime_report`:\n```json\n{\n  \"dimensions\": [{\"name\": \"eventName\"}],\n  \"metrics\": [{\"name\": \"eventCount\"}],\n  \"limit\": 10\n}\n```\n\nMeasurement Protocol events appear in the realtime report within seconds, while standard reports can take a few minutes.\n\n## 🔍 Debugging\n\nEnable debug logging by setting:\n\n```bash\nexport DEBUG=mcp-google-analytics:*\n```\n\nFor Measurement Protocol, use `ga_validate_event` to check events before sending them live.\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## 📄 License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n## 🔗 Links\n\n- [GitHub Repository](https://github.com/leonardosepulvedat/mcp-google-analytics)\n- [npm Package](https://www.npmjs.com/package/mcp-google-analytics)\n- [Smithery](https://smithery.ai/servers/lsepulvedatabares/mcp-google-analytics)\n- [MCP Documentation](https://modelcontextprotocol.io/)\n- [GA4 Data API Documentation](https://developers.google.com/analytics/devguides/reporting/data/v1)\n- [Measurement Protocol Documentation](https://developers.google.com/analytics/devguides/collection/protocol/ga4)\n\n## 🆘 Support\n\nFor issues and questions:\n- [GitHub Issues](https://github.com/leonardosepulvedat/mcp-google-analytics/issues)\n- [MCP Community Discord](https://discord.gg/modelcontextprotocol)\n\n## 📝 Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md) for version history.\n\n---\n","readmeFilename":"README.md"}