I am very new to this and only started looking at python this week.
I am currently trying to extract data from Google Analytics and need to extract multiple days of data. I am however having issues trying to loop the code for multiple days:
CODE:
for date in daterange( start, end ):
# EXTRACT OVERALL VISITS AND UNIQUE VISITS;
def get_results(service, profile_id):
return service.data().ga().get(
ids='ga:' + profile_id,
start_date=str(date),
end_date=str(date),
metrics='ga:visits,ga:newVisits,ga:visitors').execute()
This however doesn't seem to loop, but give me the data for the last date defined.