API Reference

Google Analytics 4 / API Reference

ga4_compare_date_ranges

GA4 analytics tool. Compare key metrics between two date ranges side-by-side. Args: property_id: GA4 property ID period1_start: More recent period start YYYY-MM-DD (default: last 30 days) period1_end: More recent period end YYYY-MM-DD (default: yesterday) period2_start: Comparison period start (default: 31-60 days ago) period2_end: Comparison period end (default: 31 days ago) metrics: Comma-separated GA4 metric names (default: sessions,newUsers,conversions,purchaseRevenue)

This is a read-only tool: it compares date ranges from your Google Analytics 4 account. It changes nothing.

Ask Claude

You do not call this tool yourself. Ask for the outcome and the client picks the tool:

Compare date ranges in my Google Analytics 4 account.

It takes 1 required and 5 optional parameters.

Parameters

ParameterTypeRequiredDescription
property_idstringYesProperty Id
period1_startstringNoPeriod1 Start
period1_endstringNoPeriod1 End
period2_startstringNoPeriod2 Start
period2_endstringNoPeriod2 End
metricsstringNoMetrics

Related Google Analytics 4 tools

Before you can call it

This tool needs a connected Google Analytics 4 account. The Google Analytics 4 connect guide covers the OAuth flow and the permissions it asks for, and the quickstart gets a client talking to the server in about five minutes.

Workflows that use this

Rather than calling tools one at a time, these skills run a whole procedure against the same account:

Start using MCP Ads