Skip to content
OpenNodeFlow.DocsOpen beta ↗
Agent guide ↗
Docs/Library & integrations

Google Analytics 4

Build typed reports, retain exact metrics and collect bounded GA4 pages.

23 Oct 2026 · 5 min read
Markdown ↗

GA4 nodes combine pure report builders, metadata/compatibility discovery, core report paging and realtime reports. Analytics reads require an authorized Google principal with access to the specific property. They do not connect an account merely because the pack is installed.

Configure identity#

Enable the Analytics Data API in the appropriate Google project and authorize the actual property. The implemented read scope is analytics.readonly. In accessToken mode the bearer secret must stay valid externally; refreshToken mode consumes named OAuth client/refresh secrets. Do not place grant JSON or token values on workflow sockets or in examples.

Choose an explicit propertyId. A Google Cloud project, Analytics account and property are different identities. Token consent alone does not grant property access.

Build before querying#

Compose Build GA4 Date Range, Build GA4 Dimensions, Build GA4 Metrics, optional leaf/combined filters and Order By into Build GA4 Report Request. Builder tests can run on synthetic data without contacting Google. Inspect the typed request, then use Get GA4 Metadata and Check GA4 Report Compatibility for a real authorized property when required.

Dimensions, metrics and filters have provider-specific compatibility; ONF does not infer a valid combination from labels. Keep the provider query and property identity explicit. Realtime has a separate request and response contract rather than pretending it is a core report with a different date range.

Page and decode#

Run GA4 Report Page performs one bounded page; Collect GA4 Report Pages collects within explicit limits. Inspect completion, row/page counts and continuation before considering the dataset complete. Retain request identity and stable header interpretation across pages.

Reporting numeric values may exceed JavaScript's safe integer range or require exact decimal representation. Metric strings remain strings; do not convert every value with Number. The reusable decoders expose selected useful summaries while retaining the underlying provider blocks/remainders. Optional values stay absent rather than being invented as zero.

Limits and diagnosis#

Request timeout defaults to 15 seconds and allows 100 ms–120 seconds. Response reading defaults to 8 MB with a 16 MB maximum. The serialized returned object is separately bounded to 3,000,000 UTF-8 bytes, including duplicated report/row outputs. Reduce page size, maxRows/maxPages or query breadth when accumulation exceeds it.

Only selected read HTTP 429/5xx responses retry internally, honoring bounded Retry-After. Longer waits should become later timer/schedule work. Authentication, invalid requests, malformed JSON, oversize data and transport/timeout failures do not gain automatic internal replay. Quota consumption and changing source data still matter for repeated reads.

Operations#

  • Build GA4 Date Range: Build inclusive GA4 date boundaries. Input overrides configuration. Example: startDate 7daysAgo, endDate yesterday. Absolute impossible dates and reversed absolute ranges fail; relative dates resolve in the property time zone. Returned objects are li
  • Build GA4 Dimensions: Build a compact dimension block from comma-separated API names, for example date,country. Reject duplicate names and more than nine dimensions. Use metadata to discover property-specific custom dimensions. Returned objects are limited to 3 MB UTF-8 t
  • Build GA4 Metrics: Build a metric block from comma-separated API names, for example activeUsers,sessions. For formulas use the typed GA4 Metric JSON codec expression field and combine through the typed Metrics list. Returned objects are limited to 3 MB UTF-8 to leave O
  • Build GA4 Leaf Filter: Build one string/in-list/numeric/empty filter with exact provider oneof shape. Numeric int64 defaults preserve precision as text. In-list value is JSON such as ["ZA","GB"]. Dimensions and metrics must use separate expression trees; provider compatibi
  • Combine GA4 Filters: Compose two typed filters using AND/OR, or negate A using NOT. B is required at runtime for AND/OR. Separate dimension and metric trees. Bounded recursive validation rejects malformed oneof/group structures. Returned objects are limited to 3 MB UTF-8
  • Build GA4 Order By: Build stable dimension or metric sorting. Prefer a unique dimension combination across paged reports; relative dates and incoming data can change between pages. Returned objects are limited to 3 MB UTF-8 to leave ONF transport headroom; reduce page/r
  • Build GA4 Report Request: Assemble the reusable core reporting request from small typed blocks. No credentials or property identifier are embedded in the payload. Page size 1–250000; default 10000. Date ranges 1–4, dimensions <=9 and metrics 1–10. Returned objects are limited
  • Run GA4 Report Page: Read one GA4 core report page; emits typed raw response, exact string-valued rows and continuation. Inspect result.complete/nextOffset before requesting another page. Reports consume read quota. Returned objects are limited to 3 MB UTF-8 to leave ONF
  • Collect GA4 Report Pages: Collect bounded offset pages with consistent headers and progress checks. maxRows is a hard returned-row bound; the final request shrinks to remaining capacity. Partial results expose nextOffset, complete=false. Aggregates/quota metadata in report co
  • Get GA4 Metadata: Read dimensions/metrics available for the selected property, including custom definitions. propertyId=0 requests universal metadata only. Requires analytics.readonly scope; no API key fallback. Returned objects are limited to 3 MB UTF-8 to leave ONF
  • Check GA4 Report Compatibility: Check dimensions/metrics and filters for core reports. DateRanges, ordering and pagination are intentionally not sent to compatibility. Realtime rules differ; this method does not validate realtime requests. Returned objects are limited to 3 MB UTF-8
  • Build GA4 Realtime Request: Build a distinct realtime report contract. Standard properties support minute range 0–29; 360 can support up to 59. No dateRanges or offset: realtime API has no offset pagination. Choose realtime-compatible dimensions/metrics. Returned objects are li
  • Run GA4 Realtime Report: Read current realtime data. Deliberately one bounded report; no fake offset paging. rowCount may exceed the selected limit; choose an appropriate limit or narrower dimensions/filters. Standard versus 360 lookback and metric compatibility are checked

The source fixtures demonstrate builders, precision, paging and failure behavior with synthetic responses. They do not prove account-specific report compatibility or live Analytics access.

Source provenance

Reviewed against maintained source and topic documentation on 23 October 2026. This is a source snapshot; installed versions and provider access may differ.

  • ../OpenNodeFlow-Library/work/google/SETUP.md
  • ../OpenNodeFlow-Library/docs/INTEGRATIONS.md
  • docs/INTEGRATIONS-GOOGLE.md
Type to search the documentation.
↑ ↓ to navigate · Enter to openAgent map ↗