Canonry integrates with Google Analytics 4 (GA4) via a service account — no OAuth redirect flow required. You grant a service account read-only access to your GA4 property once, and canonry handles the rest.
You can complete the setup via the web dashboard or the CLI — both are documented below.
This is the most commonly missed step. The GA4 Data API must be explicitly enabled in your GCP project.
Or go directly:
https://console.developers.google.com/apis/api/analyticsdata.googleapis.com/overview?project=YOUR_PROJECT_ID
Note: If you skip this step, connecting will fail with a
SERVICE_DISABLEDerror even if your service account credentials are correct and the account has GA4 property access.
canonry-ga4).json key fileThe service account needs Viewer (or higher) access to your GA4 property.
canonry-ga4@your-project.iam.gserviceaccount.com)Access propagates within a few seconds to a minute.
123456789)This is not the Measurement ID (which starts with
G-).
Canonry verifies the credentials by making a test API call. On success, the page refreshes to show your traffic data.
canonry ga connect <project> --property-id <id> --key-file ./canonry-ga4.json
Example:
canonry ga connect ainyc --property-id 527609434 --key-file ./canonry-ga4.json
Canonry will verify the credentials by making a test API call. On success:
GA4 connected for project "ainyc" (property 527609434).
The Traffic tab on each project page provides:
# Sync last 30 days of traffic data
canonry ga sync ainyc
# Show top landing pages by sessions
canonry ga traffic ainyc
# Show landing page coverage with index + citation overlay
canonry ga coverage ainyc
# Connection status
canonry ga status ainyc
# Disconnect
canonry ga disconnect ainyc
GA4 API authentication failed — The Google Analytics Data API is not enabledThe API is disabled in your GCP project. Enable it at:
https://console.developers.google.com/apis/api/analyticsdata.googleapis.com/overview?project=YOUR_PROJECT_ID
GA4 API authentication failed — check service account permissionsEither:
Failed to get access tokenThe JSON key file is invalid or the private key is corrupted. Download a fresh key from the GCP service account console.
JSON file is missing required fields: client_email and private_keyYou uploaded the wrong type of credential file. Make sure you downloaded a service account key (IAM & Admin → Service Accounts → Keys), not an OAuth client JSON.
No GA4 connection foundYou haven’t connected GA4 to this project yet.
UI: Navigate to the Traffic tab and use the connect form.
CLI: Run canonry ga connect with your property ID and key file.