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).

Landing Pages Top

AI-generated

Summary

Retrieve the top landing pages for a specified Google Analytics 4 property ranked by sessions or engaged sessions over a configurable lookback period, optionally filtering by domain and path substring, and limiting the number of results.

Inputs

  • Property ID (required) — Numeric GA4 Property ID to query (not Measurement ID).
  • Return Property Quota — Include GA4 API quota details in the response to monitor usage.
  • Lookback (days) — Number of days in the past to aggregate session data (between 7 and 365).
  • Domain (hostName filter) — Optional hostname filter to restrict results to a single domain.
  • Path Contains — Filter landing pages containing this substring in the page path.
  • Limit — Maximum number of top landing pages to return.
  • Exclude “localhost” — Exclude hits from 'localhost' if no domain filter is set, to avoid counting development traffic.
  • Metric — Metric to rank landing pages by, either 'sessions' or the stricter 'engagedSessions'.

Output shape

a single JSON object per item containing an array list of landing pages, each with host, path, and selected metric values; includes property quota info if enabled.

Results are ordered by the specified metric descending. Host and path are included per landing page entry. Responses may include the GA4 propertyQuota field when enabled to monitor API usage.

Examples

Example 1: Fetch top 10 landing pages by sessions for property 412345678 over the last 60 days excluding localhost.

Property ID=412345678, Metric=Sessions, Lookback=60, Limit=10, Exclude localhost=true

Example 2: Retrieve top 5 landing pages by engaged sessions containing '/blog' under 'www.example.com' domain.

Property ID=412345678, Metric=Engaged Sessions, Lookback=60, Limit=5, Domain=www.example.com, Path Contains='/blog'

Discussion