View as Markdown
Google Analytics icon

Google Analytics ACTION

Run Report in GA4

Returns a customized report of your Google Analytics event data. Reports contain statistics derived from data collected by the Google Analytics tracking code. See the documentation
  • Action
  • Writes data
  • OAuth
  • SDK
  • MCP

IMPLEMENTATION

Call this tool

Connect a user's Google Analytics account once, then configure and run Run Report in GA4 from your backend or agent.

import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "google_analytics-run-report-in-ga4",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    google_analytics: { authProvisionId: "apn_xxxxxxx" },
    property: "Property",
    startDate: "Start Date",
  },
})

console.log(result)

SCHEMA

Inputs

Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.

Run Report in GA4 inputs
Property Type Description
property Property string
A Google Analytics GA4 property identifier whose events are tracked. Specified in the URL path and not the body. To learn more, see where to find your Property ID. Within a batch request, this property should either be unspecified or consistent with the batch-level property.
Required Dynamic
startDate Start Date string
Start date in YYYY-MM-DD format
Required
endDate End Date string
End date in YYYY-MM-DD format
Required
metrics Metrics string[]
Metrics attributes for your data. Explore the available metrics here
Required
dimensions Dimensions string[]
Dimension attributes for your data. Explore the available dimensions here
Optional
dimensionFilter Dimension filter object
Dimension filters let you ask for only specific dimension values in the report. Read more about dimension filters here
Optional

REFERENCE

Tool details

Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.

Registry key
google_analytics-run-report-in-ga4
Version
0.1.2
App
Google Analytics
Authentication
OAuth
Read-only
No
Destructive
No
Open world
Yes