Google Analytics 4
BUILDING Source · built and tested, not yet verified against production accounts. Contact us before relying on it.
Overview
Section titled “Overview”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.
Features
Section titled “Features”| Feature | Supported | Notes |
|---|---|---|
| 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. |
Before you connect
Section titled “Before you connect”- Create a service account in a Google Cloud project and enable the Google Analytics Data API in that project.
- Create a JSON key for the service account and download it.
- 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.
- Note the property ID (Admin → Property settings), a number such as
123456789.
Connect
Section titled “Connect”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. |
Schema
Section titled “Schema”sessions
Sessions per day and default channel group.
| Column | Type | Description |
|---|---|---|
datePKcursor | string | Day, as YYYYMMDD. |
sessionDefaultChannelGroupPK | string | Channel group, e.g. Organic Search, Direct. |
sessions | integer | Number of sessions. |
bounceRate | number | Share of sessions that weren't engaged (0–1). |
page_views
Page views per day and page path.
| Column | Type | Description |
|---|---|---|
datePKcursor | string | Day, as YYYYMMDD. |
pagePathPK | string | Page path, e.g. /pricing. |
screenPageViews | integer | Views of the page or screen. |
averageSessionDuration | number | Average session length, in seconds. |
events
Event counts per day and event name.
| Column | Type | Description |
|---|---|---|
datePKcursor | string | Day, as YYYYMMDD. |
eventNamePK | string | Event name, e.g. page_view, purchase. |
eventCount | integer | Number of events. |
eventCountPerUser | number | Average events per active user. |
conversions
Key events per day and event name.
| Column | Type | Description |
|---|---|---|
datePKcursor | string | Day, as YYYYMMDD. |
eventNamePK | string | Event name, e.g. page_view, purchase. |
keyEvents | number | Number of key events (conversions). |
sessionKeyEventRate | number | Share 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).
Sync behavior
Section titled “Sync behavior”- First sync: every day from
start_dateto today. - Later syncs: from
lookback_daysbefore 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.
Common gotchas
Section titled “Common gotchas”- 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_datebackfills on busy properties can hit it; the run fails asrate_limitedand 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 largepage_viewstables, and GA4 may group rare values into(other).