19
May
2023

读取GA4 report by using Google analytics data api

Reference url:

https://github.com/tanyazyabkina/GA4_API_python/blob/main/GA4%20Python%20Report.ipynb

GA4 Python Report.ipynb

https://www.youtube.com/redirect?event=video_description&redir_token=QUFFLUhqazFnLUdacVZjTTgyTHRkd0VMSkduZ1BGT1FYQXxBQ3Jtc0tuMVYzRlFHTVpSOV9paGNKSVU1UjVHNzFiRHhDVjdDeXd6djRNZGpCeFV5YkNxcUNIeTZsT3pyQjdHcjFZN3VuZDZ0ZEpfN3pPZE5TM1llaGhpTGxTSnl3bmxkd05wSjQ5cFg0TGRuNEp4UDNKdlM0NA&q=https%3A%2F%2Fdevelopers.google.com%2Fanalytics%2Fdevguides%2Freporting%2Fdata%2Fv1%2Fapi-schema&v=HbxIXEfl-Hs

https://jupyter.org/try-jupyter/lab/

https://github.com/googleapis/python-analytics-data/tree/main/samples/snippets

Google API github code 参考

Step 1:

https://developers.google.com/analytics/devguides/reporting/data/v1/quickstart-cli?hl=zh-cn to Create a service account, download the json file

Step 2:

Enable the Google Anlytics data api in google cloud console.

Step 3:

Create a service account, copy the email address, create a key, and download it as a JSON file. This file will use to the Python file.

Step 4:

Go to Google analytics and add the email account in the service account email to as a viewer, and mark down the property id.

Step 5

Share

You may also like...