Google Analytics 4 MCP server

Prebuilt SnapLogic agentic-tool pipelines that let an LLM read from and act on Google Analytics 4, callable as MCP tools via Pipeline Execute. Published in the SnapLogic pattern catalog.

Overview

This tool pack gives an agent access to Google Analytics 4: browse accounts and properties, discover available metrics and dimensions, and run historical or real-time reports. The report tools accept any metrics and dimensions the property supports, so one connected account can answer a wide range of traffic and engagement questions.

For setup instructions, see SnapLogic MCP Server quickstart.

Example Prompts

  • How many users are on the site right now?
  • Show me realtime active users by country
  • What pages are being viewed in the last 5 minutes?
  • Give me live traffic for the past 15 minutes broken down by device
  • Is there anyone active on property 123456789 at the moment?
  • How many sessions did we get last week?
  • Show me active users by country for the past 30 days
  • Get page views by page path for this month
  • Compare sessions and active users by date from 2026-01-01 to 2026-01-31
  • Break down traffic by device category and channel for the last 7 days

Tools

Tool Name Functions
GoogleAnalyticsCreateRealtimeReport Run a live GA4 realtime report over a minutes-ago window.
GoogleAnalyticsCreateReport Run a historical GA4 report over a date range with chosen metrics and dimensions.
GoogleAnalyticsGetMetadata Discover the dimensions and metrics available on a GA4 property.
GoogleAnalyticsListAccounts List all GA4 accounts accessible to the configured credentials.
GoogleAnalyticsListProperties List the GA4 properties under a given account.

Set up the MCP Server tools

  1. Download ga4_tools.zip.
  2. In SnapLogic Designer, open the target project space (or create one), then choose Import Project / Import Pipelines and select the downloaded ga4_tools.zip. Designer unpacks each pipeline into the project.
  3. Attach the required account to the connectivity snaps (see Connection Setup).
  4. Expose the project as an MCP server — each pipeline becomes a tool named after its label. New to this? Start with the MCP quickstart, then use the MCP Server Pipeline Builder to generate the server from the imported pipelines.

Configure account

Attach a Google Analytics account (service account or OAuth 2.0) to the Google Analytics snaps in Designer after import.

These pipelines ship without credentials by design — attach a valid account in Designer before the tools will execute.

See the SnapLogic account documentation for this connector: Snaps Accounts.Html.

Important: These pipelines ship without credentials by design — attach a valid account in Designer before the tools will execute. Credentials live in the SnapLogic account store, never in the pipeline JSON.

GoogleAnalyticsCreateRealtimeReport

Runs a GA4 realtime report over a rolling minutes-ago window, returning live traffic data broken down by the dimensions and metrics you choose. Use it to answer 'right now' questions about who is on the site, which pages are active, and where current visitors are coming from.

Parameter Type Default Description
property_id* string

GA4 property ID to report on, e.g. 123456789.

start_minutes_ago string

Start of the realtime window, in minutes ago (defaults to 30 when omitted or blank).

end_minutes_ago string

End of the realtime window, in minutes ago (defaults to 0, i.e. now).

account_id string

GA4 account ID the property belongs to.

* Required parameter.

Try asking:

  • How many users are on the site right now?
  • Show me realtime active users by country
  • What pages are being viewed in the last 5 minutes?
  • Give me live traffic for the past 15 minutes broken down by device
  • Is there anyone active on property 123456789 at the moment?

GoogleAnalyticsCreateReport

Runs a historical GA4 report over a date range, returning traffic and engagement data broken down by the metrics and dimensions you choose. Use it for any 'how many' or 'broken down by' question about past traffic.

Parameter Type Default Description
property_id* string

GA4 property ID to report on, e.g. 123456789.

start_date* string

Report start date — an absolute date (2026-01-01) or a GA4 relative form such as 7daysAgo.

end_date* string

Report end date — an absolute date (2026-01-31) or a GA4 relative form such as today.

account_id string

GA4 account ID the property belongs to.

* Required parameter.

Try asking:

  • How many sessions did we get last week?
  • Show me active users by country for the past 30 days
  • Get page views by page path for this month
  • Compare sessions and active users by date from 2026-01-01 to 2026-01-31
  • Break down traffic by device category and channel for the last 7 days

GoogleAnalyticsGetMetadata

Returns the dimensions and metrics available on a GA4 property, with descriptions for each. Use it before building a report when you need to confirm which fields the property supports.

Parameter Type Default Description
property_id* string

GA4 property ID whose metadata is retrieved, e.g. 123456789.

account_id string

GA4 account ID the property belongs to.

* Required parameter.

Try asking:

  • What metrics can I report on for property 123456789?
  • Show me the available dimensions for our web property
  • Does this property have any custom dimensions?
  • List the GA4 metrics and what each one means
  • Before you build the report, check which dimensions this property supports

GoogleAnalyticsListAccounts

Lists all GA4 accounts accessible to the configured credentials. Use it as the starting point when the user has not named an account, before listing properties.

No parameters.

Try asking:

  • What GA4 accounts do I have access to?
  • List my Google Analytics accounts
  • Which analytics accounts is this connection authorised for?
  • Show me the GA4 account names and IDs

GoogleAnalyticsListProperties

Lists the GA4 properties under an account, returning each property's name and ID. Use it to resolve a user's casual mention of a property into the numeric property ID that the report tools require.

Parameter Type Default Description
account_id* string

GA4 account ID whose properties are listed, e.g. 123456789.

* Required parameter.

Try asking:

  • What properties are in account 123456789?
  • List the GA4 properties for my main analytics account
  • Find the property ID for our marketing website
  • Show me every property under this account with its display name