Signup comes with $1 in credit. No subscription needed.Claim your $1
Docs: Google Analytics
Guides

Google Analytics

Connect your own Google Analytics and let your agent read your GA4 property: connecting an account, picking a property, reports on any metrics by any dimensions, and what each error means.

Connect your own Google Analytics to RouterGrowth, then let your agent read your GA4 property with the same RouterGrowth key, over REST, the CLI or MCP: sessions, users, page views, key events and revenue, by day, channel, source, page or any other dimension. This page covers connecting an account, picking a property, running a report, several accounts in one workspace, and what each error means.

Capabilities

Capability What it does Price
googleanalytics.accounts Lists the Analytics connections this workspace holds, each with its live status Free
googleanalytics.account Connects a Google account, checks or reconnects one, or disconnects it Free
googleanalytics.properties Lists the GA4 properties the connected Google account can read Free
googleanalytics.report Any metrics by any dimensions over a range of days, with filters, ordering and totals Free

A connection has no monthly fee. RouterGrowth only reads: nothing here edits a property, a data stream or a user. Use inspect for each capability's current schema.

Connect an account

Run googleanalytics.accounts first, so you reuse a connection that already exists, then ask for a link:

routergrowth run -c googleanalytics.accounts -i '{}' --wait 30
routergrowth run -c googleanalytics.account -i '{"name":"main"}' --wait 30

Open the returned connect_url and sign in with a Google account that has a role on the property. The approval is Google's own screen on a page hosted by Composio, the connection provider: your Google password and the access token never reach RouterGrowth, which keeps only the connection's id and the Google account's name. For now that screen asks for permission to see and edit Analytics data, because the connection provider's Google app requests both; RouterGrowth uses the read part only.

Run the same googleanalytics.account call again to confirm connected: true. status is OK when connected, PENDING while nobody has approved the link, and EXPIRED, FAILED, REVOKED or DISCONNECTED when the connection can no longer read: run googleanalytics.account with the same name for a fresh link. Without a name, googleanalytics.account reports what is already connected instead of starting a new connection.

To remove a connection:

routergrowth run -c googleanalytics.account -i '{"name":"main","disconnect":true}' --wait 30

To withdraw the access on Google's side as well, remove the app under Third-party apps and services in the Google account's security settings.

Pick a property

routergrowth run -c googleanalytics.properties -i '{}' --wait 30

Each GA4 property comes with its number (property_id), its name and the Analytics account it sits in. googleanalytics.report takes property as that number, as properties/123456789, or as the property's name. You may leave it out while the connection has exactly one property.

Run a report

Sessions, users and page views by day over the last 28 days:

routergrowth run -c googleanalytics.report -i '{"property":"123456789"}' --wait 30

Where the visits come from this quarter:

routergrowth run -c googleanalytics.report -i '{"property":"123456789","metrics":["sessions","key_events","revenue"],"dimensions":["channel"],"days":90}' --wait 30

The pages organic search lands on:

routergrowth run -c googleanalytics.report -i '{"property":"123456789","metrics":["sessions","engagement_rate"],"dimensions":["landing_page"],"filters":[{"dimension":"channel","value":"Organic Search"}],"limit":50}' --wait 30

metrics and dimensions take the plain names below or any GA4 API name (activeUsers, sessionDefaultChannelGroup, customEvent:plan). A row's keys are the names you wrote.

Metrics GA4 name
sessions, engaged_sessions sessions, engagedSessions
users, new_users, total_users activeUsers, newUsers, totalUsers
views screenPageViews
engagement_rate, bounce_rate, avg_session_duration engagementRate, bounceRate, averageSessionDuration
events, key_events eventCount, keyEvents
revenue totalRevenue
Dimensions GA4 name
date, month date, yearMonth
channel, source, medium, source_medium, campaign sessionDefaultChannelGroup, sessionSource, sessionMedium, sessionSourceMedium, sessionCampaignName
page, page_title, landing_page pagePath, pageTitle, landingPage
country, city, device, event country, city, deviceCategory, eventName

A report takes up to 10 metrics and 9 dimensions. With dimensions: [] it returns one row. filters keeps the rows that match all of them, on any dimension, whether or not it is a column; operator is equals (the default), contains, begins_with, ends_with, regex and the not_ forms of the first two and of regex.

The result gives rows, the totals over the whole range, total_rows (send offset for the next ones, limit goes up to 5,000), and the property's timezone and currency. A report over days reads in order; any other one comes largest first on its first metric, unless you pass order_by and order.

Dates: pass start_date and end_date (YYYY-MM-DD), or days to count back from the end. The default range ends yesterday, the newest whole day.

Several accounts

A workspace can hold several connections, one per Google account: an agency connects each client's account under its own name.

routergrowth run -c googleanalytics.account -i '{"name":"client-acme"}' --wait 30
routergrowth run -c googleanalytics.report -i '{"account_id":"client-acme","property":"acme.com"}' --wait 30

Pass account_id as the connection's name. You may omit it only while the workspace has exactly one connection; with several, a call without it is refused rather than guessing which account to read. A name is stored as lowercase letters, digits and dashes, up to 24 characters. Every member of the workspace can read through its connections.

Errors

What you see What it means
forbidden on account_id The name is not a connection this workspace holds
"does not name one GA4 property of the connection" No property, or more than one, fits that name; the message lists the ones the account can read
"the Google Analytics connection is not active" The link was never approved, or the connection lapsed: run googleanalytics.account with the name
"Google refused the connection" The access was removed in the Google account: reconnect with googleanalytics.account
"Google refused the read" The Google account has no role on that property
"Google refused the request" A metric or dimension name is not one GA4 knows, or two of them cannot be combined; the message is Google's own
no_match Analytics has no data for that property, range and filters
provider_rate_limited Google's quota or the connection provider's rate limit: wait, then send it again

A read that timed out is safe to send again.

Reading this as an agent? This page as markdown: /docs/google-analytics.md · every page: /docs/llms.txt