API Reference Card
| Detail | Value |
|---|---|
| Base URL | https://analyticsdata.googleapis.com/v1beta |
| Auth | OAuth 2.0 via service account (GOOGLE_APPLICATION_CREDENTIALS JSON key file) |
| Rate limits | 50,000 requests/project/day; 10 concurrent requests/property |
| Python client | google-analytics-data — official GA4 Data API client |
| Mavera base | https://app.mavera.io/api/v1 |
| Mavera auth | Authorization: Bearer mvra_live_... |
All examples use three environment variables:
GOOGLE_APPLICATION_CREDENTIALS (path to service account JSON), GA4_PROPERTY_ID (numeric property ID, e.g. 123456789), and MAVERA_API_KEY. Python examples use the google-analytics-data client library; JavaScript examples use the REST API directly with a service account access token.Prerequisites
GA4 property with data
You need an active GA4 property with at least 30 days of traffic. Find the property ID in GA4 → Admin → Property Settings.
Service account with GA4 access
Create a service account in Google Cloud, download the JSON key, then add the service account email as a Viewer in GA4 → Admin → Property Access Management.
Enable the Analytics Data API
In Google Cloud Console, navigate to APIs & Services → Enable the Google Analytics Data API.
Jobs
| # | Job | GA4 Data | Mavera Surface | Output |
|---|---|---|---|---|
| 1 | Audience Demographics → Persona Creation | RunReport: age, gender, country, device, conversions | Custom Personas | High-value intersection personas |
| 2 | Interest Category → Content Strategy | Interests dimension report | Mave Agent | Content plan bridging product + interests |
| 3 | Conversion Path → Focus Group Validation | Funnel report with step drop-off | Focus Groups | Persona feedback on drop-off points |
| 4 | Landing Page Performance → Content Refresh | Top landing pages with bounce + engagement | Generate | Audience-specific copy rewrites |
| 5 | Real-Time Audience → Trending Response | Real-time active users by page/source | Mave Agent | Spike diagnosis + response plan |
| 6 | Acquisition Channel × Persona Mapping | Session source/medium × demographics | Custom Personas | Channel-demographic persona map |
| 7 | Device Behavior → Creative Format Recommendations | Device category, resolution, engagement | Mave Agent | Format adjustments per device |
Rate Limits & Production Notes
| GA4 API Endpoint | Limit | Strategy |
|---|---|---|
| RunReport | 10 concurrent per property; 50,000/day | Queue reports; use date range caching |
| RunRealtimeReport | Same quota pool | Poll at max 1/minute for dashboards |
| RunFunnelReport | Same quota pool | Cache results; funnels rarely need real-time refresh |
| Concern | Recommendation |
|---|---|
| Service account key rotation | Rotate keys every 90 days via Google Cloud IAM. Store in a secrets manager, never in code. |
| Date ranges | Always use relative ranges (30daysAgo) for scheduled jobs. Absolute dates risk stale data. |
| Data freshness | Standard GA4 properties have 24–48h processing delay for non-real-time reports. Real-time reports cover the last 30 minutes only. |
| Sampling | Reports over 10M events may be sampled. Use shorter date ranges or the GA4 BigQuery export for unsampled data. |
| Mavera credits | Monitor at Dashboard. Mave chat calls consume credits proportional to prompt length. |
| Thresholding | GA4 redacts rows with small user counts to protect privacy. If critical segments are missing, reduce dimension cardinality or extend date ranges. |
What’s Next
All Integrations
50+ API integrations with full code
GA4 Data API Docs
Official GA4 Data API reference
Personas API
Full reference for POST /api/v1/personas
Focus Groups API
Full reference for POST /api/v1/focus-groups
Mave Agent
Full reference for POST /api/v1/mave/chat
Generate API
Full reference for POST /api/v1/generations