Google Analytics MCP Server + Slack MCP Server

Beginner25 minutes
Use Cases

Common Use Cases

  • Daily traffic summaries
  • Weekly performance reports
  • Traffic anomaly alerts
  • Campaign performance tracking
Before You Begin

Prerequisites

  • Google Analytics property with data
  • Slack workspace
Walkthrough

Step-by-Step Guide

1

Configure GA MCP Server

Set up with Google Analytics API credentials and property ID.

2

Configure Slack

Set up the Slack MCP Server for posting reports.

3

Build Daily Report

Generate a daily traffic summary and post to Slack.

async function dailyTrafficReport() {
  const data = await analytics.getReport({
    dateRanges: [{ startDate: "yesterday", endDate: "yesterday" }],
    metrics: ["sessions", "users", "pageviews", "bounceRate"],
  });
  const yesterday = data.rows[0];
  await slack.sendMessage({
    channel: "#marketing",
    text: `šŸ“Š Yesterdays Traffic:\n• Sessions: ${yesterday.sessions}\n• Users: ${yesterday.users}\n• Pageviews: ${yesterday.pageviews}\n• Bounce Rate: ${yesterday.bounceRate}%`
  });
}
4

Add Week-over-Week Comparison

Compare this week's metrics against last week to highlight trends.

Examples

Code Examples

typescript
Trend Comparison
async function compareWeeks() {
  const [thisWeek, lastWeek] = await Promise.all([
    analytics.getReport({ dateRanges: [{ startDate: "7daysAgo", endDate: "today" }], metrics: ["sessions"] }),
    analytics.getReport({ dateRanges: [{ startDate: "14daysAgo", endDate: "8daysAgo" }], metrics: ["sessions"] })
  ]);
  const change = ((thisWeek.sessions - lastWeek.sessions) / lastWeek.sessions * 100).toFixed(1);
  return { change, trend: change > 0 ? "šŸ“ˆ" : "šŸ“‰" };
}
Help

Troubleshooting

Reports show zero data+
Can I filter by specific pages?+

Quick Info

DifficultyBeginner
Time Estimate25 minutes
Tools
Google Analytics MCP ServerSlack MCP Server

Need Integration Help?

Our team can implement this integration for you.

Get in Touch