Download GA4 data summaries using Google Analytics Data API and python
Last updated Apr 11, 2026
29
Stars
7
Forks
1
Issues
0
Stars/day
Attention Score
14
Language breakdown
Jupyter Notebook 94.9%
Python 5.1%
▸ Files
click to expand
README
Google Analytics 4 (GA4) Data API with Python
Important links:
- Google Quickstart guide: https://developers.google.com/analytics/devguides/reporting/data/v1/quickstart-client-libraries
- API dimensions and metrics: https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema
- Google developer's guides: https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties
Blog post with detailed instructions: https://probabilistically.com/ga4-bigquery-backfill/
The overview of the process:
- Get API keys: create a GCP project, authorize Google Analytics Data API, create a service account, create JSON keys for the account.
- Add service account as a viewer to your GA4 propert(Admin->User Management)
- Install google-analytics-data package.
- Set os.environ["GOOGLEAPPLICATIONCREDENTIALS"] = 'yourapikey.json'
- Send request, get output. Done!
🔗 More in this category