Skip to content

Google Analytics 4

BUILDING Source · built and tested, not yet verified against production accounts. Contact us before relying on it.

PortPilot pulls four daily reports from a Google Analytics 4 property through the Google Analytics Data API and loads one table per report. These are aggregated reports (one row per day and dimension value), not raw event-level data. Each sync re-reads the last few days, because GA4 keeps adjusting recent data for 24–48 hours.

FeatureSupportedNotes
Incremental sync Yes New days, plus a re-read of the last few days while GA4 data settles.
Captures deletes No Records deleted in the source stay in the destination.
Custom fields No Fixed reports; custom dimensions aren't included.
Table selection Yes Choose which tables to sync.
New columns added automatically No Report columns are fixed.
Re-sync Yes A full refresh re-reads every selected table.
  1. Create a service account in a Google Cloud project and enable the Google Analytics Data API in that project.
  2. Create a JSON key for the service account and download it.
  3. Grant the service account access to the GA4 property: in Google Analytics, Admin → Property access management → add the service account’s email with the Viewer role.
  4. Note the property ID (Admin → Property settings), a number such as 123456789.

In the app, go to Connectors → New connector → Google Analytics 4 and click Test connection after filling in:

Field Required Default Description
property_id Yes — GA4 property, as properties/123456789.
credentials_json Yes — The service account’s JSON key, pasted whole. Stored write-only in the data plane’s secret store.
start_date No 2020-01-01 YYYY-MM-DD. Earliest date to report on.
lookback_days No 3 Days before the last synced date to re-read every sync.

sessions

Sessions per day and default channel group.

Primary key
date, sessionDefaultChannelGroup
Replication
Incremental, on date
ColumnTypeDescription
datePKcursorstringDay, as YYYYMMDD.
sessionDefaultChannelGroupPKstringChannel group, e.g. Organic Search, Direct.
sessionsintegerNumber of sessions.
bounceRatenumberShare of sessions that weren't engaged (0–1).

page_views

Page views per day and page path.

Primary key
date, pagePath
Replication
Incremental, on date
ColumnTypeDescription
datePKcursorstringDay, as YYYYMMDD.
pagePathPKstringPage path, e.g. /pricing.
screenPageViewsintegerViews of the page or screen.
averageSessionDurationnumberAverage session length, in seconds.

events

Event counts per day and event name.

Primary key
date, eventName
Replication
Incremental, on date
ColumnTypeDescription
datePKcursorstringDay, as YYYYMMDD.
eventNamePKstringEvent name, e.g. page_view, purchase.
eventCountintegerNumber of events.
eventCountPerUsernumberAverage events per active user.

conversions

Key events per day and event name.

Primary key
date, eventName
Replication
Incremental, on date
ColumnTypeDescription
datePKcursorstringDay, as YYYYMMDD.
eventNamePKstringEvent name, e.g. page_view, purchase.
keyEventsnumberNumber of key events (conversions).
sessionKeyEventRatenumberShare of sessions with a key event (0–1).

These are aggregated reports, so tables don’t reference each other: join on date (and eventName between events and conversions).

  • First sync: every day from start_date to today.
  • Later syncs: from lookback_days before the last synced date through today. Because the primary key is every dimension, re-read days replace the earlier values (upsert) rather than duplicating them.
  • Numbers won’t match the GA4 UI exactly. The Data API applies thresholding and sampling differently from the UI, and today’s numbers are incomplete until the next sync’s lookback re-reads them.
  • Only these four reports. Other dimensions or metrics need a change on our side; contact us. There’s no raw event export; for that, use GA4’s own BigQuery export.
  • Property quota. GA4 limits Data API usage per property per hour and day. Long start_date backfills on busy properties can hit it; the run fails as rate_limited and continues on the next schedule.
  • Permission errors mean the service account isn’t on the property, or the Data API isn’t enabled in the key’s Google Cloud project.
  • High-cardinality pagePath. Sites with many unique URLs (query strings, IDs in paths) produce large page_views tables, and GA4 may group rare values into (other).