drafty
Google Analytics logo

Build a Google Analytics traffic dashboard with Claude

Connect the official Google Analytics MCP server to Claude, ask for a traffic and acquisition dashboard from your live GA4 numbers, and publish it to a link your team comments on directly — no BI tool, no screenshots pasted into Slack.

What you'll build
A self-contained traffic dashboard — sessions and users, top acquisition channels, top landing pages, engagement rate, and a 30-day sessions trend — generated by Claude from your real Google Analytics 4 data, then published to a drafty.im/canvas/… link. Your team clicks the exact chart or number they want changed and leaves a note. Claude reads the comments and ships a revised version to the same URL.

This is an end-to-end example: connect a data source over MCP, generate a dashboard from live numbers, and close the review loop on one link. Total time, start to shared link, is under fifteen minutes. The same shape works for any of the other examples — only the connection step changes.

Here's the finished dashboard, published to a canvas — click any tile or number to leave a comment, exactly as your team would:

Live canvas — comment on any elementOpen ↗

The three moving parts

  1. The Google Analytics MCP server gives Claude read access to your GA4 properties — sessions, users, channels, pages, events — through a controlled set of report tools. You authorize it with a read-only scope.
  2. Claude pulls the numbers and writes a single self-contained HTML dashboard. You iterate on it in the artifact panel until it's right.
  3. Drafty turns that HTML into a stable link your team reviews. Comments pin to the exact element; Claude ships the fix to the same URL.

The generation step is fast now. The part this example is really about is the third one — getting the dashboard in front of people without losing their feedback to a screenshot circled in Preview.

Step 1 — Connect the Google Analytics MCP server

Google maintains an official Analytics MCP server (analytics-mcp) that runs locally and talks to the GA4 Data and Admin APIs. It authenticates over Application Default Credentials, so you authorize once with a read-only scope rather than pasting a long-lived key into a config file.

First, authorize with the Analytics read-only scope using the gcloud CLI:

claude
gcloud auth application-default login --scopes https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/cloud-platform

In Claude Code, add the server (it runs via pipx, so no separate install step):

claude
claude mcp add analytics-mcp --scope user -e GOOGLE_CLOUD_PROJECT=YOUR_PROJECT_ID -- pipx run analytics-mcp

Replace YOUR_PROJECT_ID with your Google Cloud project. Then run /mcp inside Claude Code to confirm the server connected.

In Claude Desktop: open Settings → Developer → Edit Config, and add an analytics-mcp entry to mcpServers with command pipx, args ["run", "analytics-mcp"], and GOOGLE_CLOUD_PROJECT in the env object — then restart Claude Desktop.

Safety first
The login above grants the analytics.readonly scope and nothing more — a reporting dashboard never needs write access. The credentials live in your local ADC file; don't paste them into a config file or commit them. If you run this as an unattended agent, use a service account with the read-only Analytics scope, not your full account.

Step 2 — Pull the numbers

Ask Claude in plain language. It uses the MCP server's read tools (run_report, run_realtime_report, get_account_summaries) to fetch real data:

claude
Using the Google Analytics MCP server, pull everything we need for a traffic dashboard for the last 30 days vs. the previous 30 days: total sessions and active users, engagement rate, average engagement time, sessions broken down by default channel group (organic search, direct, referral, social, paid), the 8 top landing pages by sessions, and new vs. returning users. Summarize the figures before you build anything.

Claude calls the GA4 Data API, returns the figures, and you sanity-check them against the Google Analytics dashboard before going further. This is the moment to catch a wrong assumption — the wrong property, a date range off by a day, a channel grouping you didn't expect — while it's cheap.

Step 3 — Build the dashboard

Once the numbers look right, ask for the artifact:

claude
Build a single self-contained HTML dashboard from those figures. Sessions as the hero number with the 30-day trend and period-over-period change, then tiles for active users, engagement rate, and average engagement time. A horizontal bar chart of sessions by acquisition channel, and a table of top landing pages with sessions and engagement rate. Clean, no external dependencies — inline the CSS and any chart code.

Claude renders it live in the artifact panel. Iterate in place — you're not regenerating from scratch:

Step 4 — Publish to Drafty for review

A Claude artifact link is a preview, not a stable URL — iterate the artifact and the link you already sent now shows the old version. Ask Claude to publish it to a Drafty canvas instead, so the link you share always stays current:

claude
Publish this dashboard to Drafty as a canvas and give me the shareable link.

Claude pushes the dashboard and hands back a drafty.im/canvas/… link that renders on any device. Send it — your team opens it in a browser, no login and no Claude account needed.

Step 5 — The review loop

This is the part that's not obvious until you've done it once.

A reviewer clicks the specific tile, chart, or number they want changed and leaves a pinned comment — "this organic figure looks low, are we counting Google Discover as referral?" The comment is anchored to that element, not floating in a Slack thread. Claude reads the comments through the CLI, reruns the relevant GA4 query if needed, and pushes a revised dashboard to the same URL. The reviewer refreshes and sees the change; the thread stays attached to the element.

The mechanic matters because of what it removes. A Slack message about a chart produces "the number on the left looks wrong." A pinned comment on the actual tile produces "this — split paid out of the organic bucket." One of those produces a correct revision; the other produces a guess.

Keeping it fresh

An MCP-generated dashboard is a snapshot — it holds the numbers Claude pulled when it built it; it doesn't re-query Google Analytics when someone opens the link. For a weekly review or a board-ready snapshot, that's fine.

To make it a live canvas that always shows today's figures, copy this prompt — Claude sets up the refresh for you and schedules it to run on its own:

claude
Turn this Google Analytics dashboard into a live canvas: every morning, re-pull the latest traffic and acquisition numbers from GA4 via the MCP server, rebuild the dashboard, and push a new version to the same canvas URL so the link always shows today's figures. Schedule it to run daily on its own.

The link stays stable while the content updates underneath it — see keeping a canvas updated automatically.

What to watch for

Google Analytics dashboard with Claude — FAQ

Do I need to paste an API key anywhere?
No. The official Google Analytics MCP server authenticates over Application Default Credentials — you run a one-time gcloud login with the analytics.readonly scope and the credentials live in your local ADC file. Nothing gets pasted into a config or committed. For an unattended agent, use a service account scoped to read-only Analytics access.
Is the dashboard live or a snapshot?
A snapshot. It contains the numbers Claude pulled when it built the file; it does not re-query GA4 when someone opens the link. To refresh it, ask Claude to repull and re-push to the same URL — or put that on a daily schedule so the stable link always shows current numbers.
Can my team comment without a Google Analytics or Claude account?
Yes. The dashboard is published to a Drafty canvas link that renders in any browser. Reviewers click the exact element they want changed and leave a pinned comment with no login required. Only the person connecting Google Analytics needs access to the property.
Is it safe to give Claude access to my Google Analytics data?
Authorize with the analytics.readonly scope and a traffic dashboard never needs more than that. The MCP server runs locally and every tool call is a read against the GA4 Data and Admin APIs; in Claude you approve the actions. Don't grant write scopes for a read-only reporting task.
How is this different from a Looker Studio or GA4 Explorations dashboard?
Looker Studio and GA4 Explorations query live data against a report you maintain — the right choice for governed, always-on reporting. This approach is for a fast, shareable snapshot you can spin up in minutes and iterate by talking to Claude, then collect feedback on inline. Different jobs: one is a standing system, the other is a quick reviewable deliverable.