Reference · Tools
Google Analytics
Retrieve GA4 and Universal Analytics reports and user activity data via the Google Analytics API.
The Google Analytics node pulls report data from both GA4 and Universal Analytics into your BusyBot workflows using OAuth2. You can retrieve traffic breakdowns, dimension-sliced metric reports, or individual user activity sessions — for example, scheduling a daily workflow that fetches last week's GA4 sessions by device category and writes them to a spreadsheet.
- Node type
- Action
- Parameters
- 35
- Outputs
- —
- Credentials
- Google Analytics OAuth2
Google Analytics
Retrieve GA4 and Universal Analytics reports and user activity
Overview
Google Analytics is a web analytics service. This tool supports GA4 (Google Analytics 4) via the Analytics Data API and Universal Analytics (UA) via the Analytics Reporting API v4. For GA4: run reports with metrics, dimensions, filters, and order-by options. For UA: run batch reports and search user activity sessions by client ID. All operations use Google OAuth2 authentication.
Category: Analytics
Tool Name: google_analytics
Version: 1
Appearance: Icon: lucide-BarChart | Color: #F9AB00
Node Type
Action — processes input items and produces output
Input / Output
| Direction | Port(s) |
|---|---|
| Input | Input |
| Output | Output, Error |
Credentials
This tool requires Google Analytics OAuth2 credentials. See the Credentials Guide for setup instructions.
Resources
| Resource | Value |
|---|---|
| Report | report |
| User Activity | userActivity |
Operations
| Operation | Value | Description |
|---|---|---|
| Report: Get | get | Return the analytics report data |
| User Activity: Search | search | Return user activity data for a given user ID |
Parameters
Report: Get
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| Property Type | options | No | ga4 | Which version of Google Analytics to query. |
Options: ga4 (Google Analytics 4 (GA4)), universal (Universal Analytics (UA)) | ||||
| Property ID | string | Yes | — | The GA4 Property ID (numeric). Found in Google Analytics under Admin → Property Settings. (shown when Property Type is ga4) |
Date Range (dateRange) | options | Yes | last7days | The date range for the GA4 report. (shown when Property Type is ga4) |
Options: today, yesterday, lastCalendarWeek (Last Complete Calendar Week), last7days, last14days, last28days, last30days, last90days, last12months, lastCalendarMonth (Last Complete Calendar Month), lastCalendarYear (Last Complete Calendar Year), thisCalendarYear, custom | ||||
Start Date (startDate) | dateTime | Yes | — | Start date for the custom date range (YYYY-MM-DD or ISO datetime). (shown when Property Type is ga4 and Date Range is custom) |
End Date (endDate) | dateTime | Yes | — | End date for the custom date range (YYYY-MM-DD or ISO datetime). (shown when Property Type is ga4 and Date Range is custom) |
Metrics (metricsGA4) | fixedCollection | No | {"metricValues":[{"name":"totalUsers"}]} | Quantitative measurements for the GA4 report (e.g. totalUsers, sessions, pageViews). Up to 10 metrics allowed. (shown when Property Type is ga4) |
| — Metric Name | options | No | totalUsers | The GA4 metric to include in the report. |
Options: activeUsers, averageSessionDuration, bounceRate, conversions, engagementRate, eventCount, newUsers, screenPageViews (Page Views), purchaseRevenue, sessions, sessionsPerUser, totalUsers, custom (Custom Metric) | ||||
| — Custom Metric Name | string | No | — | The exact GA4 API name for the custom metric. (shown when Metric Name is custom) |
| — Expression | string | No | — | A mathematical expression for derived metrics (optional). (shown when Metric Name is custom) |
Dimensions to Split By (dimensionsGA4) | fixedCollection | No | {"dimensionValues":[{"name":"date"}]} | Attributes to split the GA4 report by (e.g. date, country, deviceCategory). Up to 9 dimensions allowed. (shown when Property Type is ga4) |
— Dimension Name (name) | options | No | date | The GA4 dimension to split the report by. |
Options: browser, city, country, date, dateHour, deviceCategory, eventName, landingPage, medium, operatingSystem, pagePath, pageTitle, platform, sessionDefaultChannelGroup, sessionSource, sessionSourceMedium, source, week, year, other (Other (specify below)) | ||||
— Custom Dimension Name (customName) | string | No | — | The exact GA4 API name for the dimension when “Other” is selected. (shown when Dimension Name is other) |
Simplify Output (simplify) | boolean | No | true | Whether to return a simplified flat object per row instead of the raw API response. When enabled, dimension and metric names become object keys. (shown when Property Type is ga4) |
| Keep Empty Rows | boolean | No | false | Whether to include rows where all metrics are zero. (shown when Property Type is ga4) |
Return All (returnAll) | boolean | No | false | Whether to return all rows or only up to a given limit. (shown when Property Type is ga4) |
Limit (limit) | number | No | 50 | Max number of rows to return. (shown when Property Type is ga4 and Return All is false) |
Additional Fields (additionalFieldsGA4) | collection | No | {} | (shown when Property Type is ga4) |
| — Currency Code | string | No | — | ISO 4217 currency code. If empty, uses the property default. |
| — Dimension Filter (JSON) | json | No | {} | A GA4 FilterExpression object for filtering by dimensions. See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/FilterExpression for schema. |
| — Metric Filter (JSON) | json | No | {} | A GA4 FilterExpression object for filtering by metrics. See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/FilterExpression for schema. |
| — Order By (JSON) | json | No | [] | Array of GA4 OrderBy objects. Each has optional “desc” (bool) and either “metric” (metricName) or “dimension” (dimensionName, orderType). E.g. [{“desc”:true,“metric”:{“metricName”:“sessions”}}] |
View ID (viewId) | string | Yes | — | The Universal Analytics View (Profile) ID. Found in Google Analytics under Admin → View Settings. (shown when Property Type is universal) |
Date Range (dateRange) | options | Yes | last7days | The date range for the UA report. (shown when Property Type is universal) |
Options: today, yesterday, lastCalendarWeek (Last Complete Calendar Week), last7days, last14days, last28days, last30days, last90days, last12months, lastCalendarMonth (Last Complete Calendar Month), lastCalendarYear (Last Complete Calendar Year), thisCalendarYear, custom | ||||
Start Date (startDate) | dateTime | Yes | — | Start date for the custom date range (YYYY-MM-DD or ISO datetime). (shown when Property Type is universal and Date Range is custom) |
End Date (endDate) | dateTime | Yes | — | End date for the custom date range (YYYY-MM-DD or ISO datetime). (shown when Property Type is universal and Date Range is custom) |
Metrics (metricsUA) | fixedCollection | No | {"metricValues":[{"listName":"ga:users"}]} | Metrics for the UA report. Use ga: prefix (e.g. ga:sessions, ga:pageviews, ga:users). (shown when Property Type is universal) |
| — Metric | options | No | ga:users | The UA metric expression. |
Options: ga:productCheckouts (Checkouts), ga:totalEvents (Events), ga:pageviews (Page Views), ga:sessionDuration (Session Duration), ga:sessions (Sessions), ga:sessionsPerUser (Sessions per User), ga:users (Total Users), other (Other metrics…), custom (Custom metric…) | ||||
| — Name / Expression | string | No | — | The ga: metric expression (when “Other metrics…” is selected) or alias (for custom). (shown when Metric is other, custom) |
| — Custom Expression | string | No | — | Custom metric expression (for “Custom metric…” only). (shown when Metric is custom) |
| — Formatting Type | options | No | INTEGER | How the metric expression should be formatted (for “Custom metric…” only). (shown when Metric is custom) |
Options: CURRENCY, FLOAT, INTEGER, PERCENT, TIME | ||||
Dimensions to Split By (dimensionsUA) | fixedCollection | No | {"dimensionValues":[{"listName":"ga:date"}]} | Dimensions for the UA report. Use ga: prefix (e.g. ga:date, ga:country). (shown when Property Type is universal) |
| — Dimension | options | No | ga:date | The UA dimension to split the report by. |
Options: ga:browser (Browser), ga:campaign (Campaign), ga:city (City), ga:country (Country), ga:date (Date), ga:deviceCategory (Device Category), ga:productName (Item Name), ga:language (Language), ga:pagePath (Page), ga:sourceMedium (Source / Medium), other (Other dimensions…) | ||||
— Custom Dimension Name (name) | string | No | — | The ga: dimension name when “Other dimensions…” is selected. (shown when Dimension is other) |
Simplify Output (simplify) | boolean | No | true | Whether to return simplified flat row objects instead of the raw batchGet report structure. (shown when Property Type is universal) |
Return All (returnAll) | boolean | No | false | Whether to return all rows or only up to a given limit. (shown when Property Type is universal) |
Limit (limit) | number | No | 50 | Max number of rows to return (per-page, for UA pagination pageSize). (shown when Property Type is universal and Return All is false) |
Additional Fields (additionalFieldsUA) | collection | No | {} | (shown when Property Type is universal) |
| — Use Resource Quotas | boolean | No | false | Whether to enable resource-based quotas (requires Analytics 360). |
| — Dimension Filters | fixedCollection | No | {} | Filters on UA dimension values. |
— — Dimension Name (dimensionName) | string | No | — | The GA dimension to filter on. |
| — — Operator | options | No | EXACT | The filter operator. |
Options: BEGINS_WITH, ENDS_WITH, NUMERIC_EQUAL (Equals (Number)), EXACT (Exactly Matches), NUMERIC_GREATER_THAN (Greater Than (Number)), NUMERIC_LESS_THAN (Less Than (Number)), PARTIAL (Partly Matches), REGEXP (Regular Expression) | ||||
| — — Value | string | No | — | The value or regular expression to match against. |
| — Include Empty Rows | boolean | No | false | Whether to include rows where all metrics equal zero. |
| — Hide Totals | boolean | No | false | Whether to hide the totals row from the response. |
| — Hide Value Ranges | boolean | No | false | Whether to hide minimum and maximum values. |
User Activity: Search
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
View ID (viewId) | string | Yes | — | The Universal Analytics View (Profile) ID to search user activity in. |
| User ID | string | Yes | — | The Client ID (ga: cookie value) or User ID to search activity for. |
Return All (returnAll) | boolean | No | false | Whether to return all sessions or only up to a given limit. |
Limit (limit) | number | No | 100 | Max number of sessions to return per page. (shown when Return All is false) |
Additional Fields (additionalFieldsUA) | collection | No | {} | — |
| — Activity Types | multiOptions | No | [] | Filter activity by type. If empty, all activity types are returned. |
Options: ECOMMERCE, EVENT, GOAL, PAGEVIEW, SCREENVIEW |
All Operations
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| Authentication | options | No | oAuth2 | Authentication method to use. |
Options: oAuth2 (OAuth2 (recommended)), serviceAccount | ||||
| Google Account | credential | No | — | Connect or select your Google account. (shown when Authentication is oAuth2) |
| Service Account Email | string | Yes | — | The email address of the Google service account. (shown when Authentication is serviceAccount) |
| Private Key | string | Yes | — | The private key from the service account JSON key file. (shown when Authentication is serviceAccount) |
| Max Concurrency | number | No | 5 | Maximum number of items to process concurrently. |
Output Data
This node fans out and replaces: it emits one output item per report row (or per session), and each output item’s JSON is the row itself. The input item’s fields do not pass through, and binary data is not forwarded — carry anything you still need downstream in a Merge node instead.
What lands on each item depends on the operation and on Simplify Output:
| Operation | Simplify Output | Output items |
|---|---|---|
Report: Get (GA4) | on (default) | One item per row, a flat object keyed by the dimension and metric names you selected — e.g. date, country, totalUsers |
Report: Get (GA4) | off | A single item carrying the raw Data API runReport response, headers and all |
Report: Get (UA) | on (default) | One item per row, a flat object keyed by the ga: dimension and metric names you selected — e.g. ga:date, ga:sessions |
Report: Get (UA) | off | A single item carrying the raw batchGet report structure, with every page’s rows merged into it |
User Activity: Search | not applicable | One item per session returned by the user activity search |
Metric values arrive as strings, not numbers — the Analytics APIs return them that way. Cast before arithmetic, for example {{ Number($json.totalUsers) }}.
A report that matches no rows produces no output items at all, so a downstream node may receive nothing.
Usage Examples
- Get a GA4 report for the last 7 days with sessions and pageViews metrics
- Get a Universal Analytics report for last 30 days split by date and country
- Search user activity sessions by client ID in a UA view
- Get GA4 report with dimension and metric filters
- Return all GA4 report rows without pagination limit
Example Configuration
Daily users and sessions from a GA4 property, last 30 days:
{
"type": "google_analytics",
"parameters": {
"resource": "report",
"operation": "get",
"propertyType": "ga4",
"propertyId": "123456789",
"dateRange": "last30days",
"metricsGA4": {
"metricValues": [
{
"name": "totalUsers"
},
{
"name": "sessions"
}
]
},
"dimensionsGA4": {
"dimensionValues": [
{
"name": "date"
}
]
},
"simplify": true,
"returnAll": true
}
}
GA4 traffic split by device and country over a custom date range, ordered by users:
{
"type": "google_analytics",
"parameters": {
"resource": "report",
"operation": "get",
"propertyType": "ga4",
"propertyId": "123456789",
"dateRange": "custom",
"startDate": "2026-01-01",
"endDate": "2026-01-31",
"metricsGA4": {
"metricValues": [
{
"name": "totalUsers"
},
{
"name": "averageSessionDuration"
}
]
},
"dimensionsGA4": {
"dimensionValues": [
{
"name": "deviceCategory"
},
{
"name": "country"
}
]
},
"returnAll": false,
"limit": 500,
"additionalFieldsGA4": {
"orderBys": "[{\"desc\":true,\"metric\":{\"metricName\":\"totalUsers\"}}]"
}
}
}
Universal Analytics source/medium report, filtered to one country:
{
"type": "google_analytics",
"parameters": {
"resource": "report",
"operation": "get",
"propertyType": "universal",
"viewId": "12345678",
"dateRange": "last30days",
"metricsUA": {
"metricValues": [
{
"listName": "ga:users"
},
{
"listName": "ga:sessions"
}
]
},
"dimensionsUA": {
"dimensionValues": [
{
"listName": "ga:sourceMedium"
}
]
},
"simplify": true,
"returnAll": true,
"additionalFieldsUA": {
"includeEmptyRows": false,
"dimensionFiltersUi": {
"filterValues": [
{
"dimensionName": "ga:country",
"operator": "EXACT",
"expressions": "United States"
}
]
}
}
}
}
Look up one visitor’s pageviews and events:
{
"type": "google_analytics",
"parameters": {
"resource": "userActivity",
"operation": "search",
"viewId": "12345678",
"userId": "GA1.2.1234567890.1234567890",
"returnAll": false,
"limit": 50,
"additionalFieldsUA": {
"activityTypes": [
"PAGEVIEW",
"EVENT"
]
}
}
}
Error Handling
| Mode | Behavior |
|---|---|
| stop | Halts workflow on first error |
| continue | Skips failed items, passes successful ones through |
| errorPort | Routes failed items to Error output port |
Tips
Retrieve GA4 and Universal Analytics reports including metrics, dimensions, and user activity sessions. Use when you need website analytics data, traffic reports, or user behavior analysis from Google Analytics. Returns report rows with metric values and dimension breakdowns.
Choosing a property type
- GA4 queries the Data API by numeric Property ID, found under Admin → Property Settings. Metric and dimension names have no prefix (
totalUsers,deviceCategory). - Universal Analytics queries the Reporting API by View ID, found under Admin → View Settings. Metric and dimension names keep the
ga:prefix (ga:users,ga:country). - User Activity is Universal Analytics only, and takes a View ID plus the client or user ID whose sessions you want.
Behavior notes
- GA4 allows up to 10 metrics and 9 dimensions per report. More than that and the API rejects the query.
- Pick “Custom Metric” or “Other” to reach names not in the dropdown. The dropdown covers the common ones; the custom fields take any exact API name, and GA4 custom metrics additionally accept a derived expression such as
eventCount/totalUsers. - Turn Simplify Output off only when you need the envelope. Simplified rows are what most workflows want; the raw response is useful when you need headers, totals or quota metadata.
- Keep Empty Rows / Include Empty Rows brings back all-zero rows. Leave them off to avoid padding a report with rows nothing happened on.
- Return All pages the API until it is exhausted. On a large property that is many round trips — set a limit while you are building the workflow.
Frequently asked questions
Do I use the same ID for GA4 and Universal Analytics properties?
No — they are different identifiers found in different places. GA4 uses a numeric Property ID, which you find under Admin → Property Settings. Universal Analytics uses a View ID, found under Admin → View Settings. Using the wrong one will cause the API to reject your request, so confirm which analytics version your property runs before configuring the node.
What is the maximum number of metrics and dimensions I can request in a single GA4 report?
GA4 enforces a hard limit of 10 metrics and 9 dimensions per report. If you exceed either limit the API will reject the query outright. If you need more data points, split them across multiple node executions and merge the results downstream in your workflow.
The metric or dimension I need isn't in the dropdown — can I still use it?
Yes. Select 'Custom Metric' or 'Other' to expose a free-text field where you can type any exact API name. For GA4, this field also accepts derived expressions such as eventCount/totalUsers. For Universal Analytics, remember to include the ga: prefix (for example, ga:users) even in custom fields.
Should I leave 'Simplify Output' on or turn it off?
Leave it on for most workflows. Simplified output returns clean rows with metric values and dimension breakdowns, which is what the majority of downstream steps need. Turn it off only when you specifically need the raw API envelope — for example, to access response headers, report totals, or quota metadata.
What happens if I enable 'Return All' on a large property?
The node will paginate through the API until all results are exhausted, which on a large property can mean many sequential round trips and significant execution time. While building or testing your workflow, set a page limit so you can iterate quickly and avoid unexpectedly large result sets.
Build with the Google Analytics node
Drop it into a workflow, wire it to an agent, or call it on a schedule. You'll need Google Analytics OAuth2 credentials first.
Open BusyBotLast updated . Spotted something wrong? Tell us.