prokodo (GA4) icon

prokodo (GA4)

Query Google Analytics 4 (Data API) with a Service Account. Includes helpers for best post times and quick lists (landing pages, referrers).

Blog Hours TopK (Helper)

AI-generated

Summary

Aggregate Google Analytics 4 data to identify the top hourly and weekday time slots for blog page traffic based on a chosen engagement metric, mapping those top time buckets into upcoming ISO datetimes with optional occurrence expansion and quota reporting.

Inputs

  • Property ID (required) — Numeric GA4 Property ID to query (not the Measurement ID). Example: 412345678.
  • Return Property Quota — Enable to include GA4 propertyQuota info to monitor remaining API quota tokens.
  • Metric for Timing — Select the engagement metric to aggregate by hour and weekday (Page Views, Sessions, or Engaged Sessions).
  • Label Time Zone (IANA) — Time zone string (e.g., Europe/Berlin) used for human-readable labels of suggested time slots.
  • Occurrence Mode — Choose 'First occurrence only' to return the next upcoming time slot per top bucket, or 'Expand within horizon (weekly)' to repeat these weekly within the specified horizon.
  • Max Occurrences per Bucket — Limits the number of weekly repeats per time bucket when using 'Expand within horizon' mode (default 9).
  • Lookback (days) — Number of past days (minimum 7) over which to aggregate session or traffic data to identify top time buckets (default 60).
  • Top K Buckets — Number of top (weekday, hour) time buckets to identify and return (e.g., top 3 best time slots).
  • Horizon (days ahead) — Future number of days over which to map top time buckets into actual ISO datetimes (default 14).
  • Domain (hostName filter) — Optional hostname filter to focus analysis on a specific domain (e.g., www.example.com) to prevent merging data across domains.
  • Path Contains — String filter for pagePath such as '/blog' to target blog pages specifically.

Output shape

A single JSON object per item with detailed fields.

Returns an object containing arrays of candidate ISO datetime strings for recommended time slots (candidates), their human-readable labels (labels), the original top buckets with ranks and scores (buckets), the metric used, lookback and horizon info, time zone, occurrence mode, the propertyQuota if requested, and the raw GA4 API report data as 'raw'. Time slots are scheduled according to the specified time zone. Errors encountered during execution appear in the node error output if 'Continue on Fail' is enabled.

Examples

Example 1: Identify top 3 hourly blog traffic time slots based on Page Views over past 60 days, mapped to the next 14 days, in Europe/Berlin time zone.

Property ID set; metric 'Page Views'; path filter '/blog'; topK=3; horizonDays=14; timeZone='Europe/Berlin'; returnQuota enabled; occurrenceMode 'first'.

Discussion