I want to export Google Analytics (hereinafter GA) to BigQuery, but GA360 is too expensive! I thought, so I implemented to export to BigQuery via GCS using GA API. I haven't tried it a little yet, so I think it's perfect, but it's not bad because I post it every day ... lol
I will introduce it in this flow!
GA API Quick Start Please refer to the above page for a quick start. Then, will you get the raw data!
Also install the library.
pip install --upgrade google-api-python-client
pip install oauth2client
I will change this sample to my liking. First of all, I will change the date because the amount that can be acquired at one time is small and I want to update it every day.
from datetime import datetime,timedelta
maxSize = 10000
dt_now = datetime.datetime.now()
yesterday = dt_now - timedelta(days=1)
yesterday = yesterday.strftime("%Y-%m-%d")
If I had read such a wonderful article, it would have been completed sooner ... lol
How to export raw data to BigQuery even in the free version using Google Analytics API
So, there was an article without having to write it, so this time! I didn't find a single file in the previous article, so I'll list it in Git for those who don't want to copy and paste.
First of all, my goal is not to be a shaven for 3 days! Lol
Recommended Posts