diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..93f46fa --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +ga_extractor/__pycache__/ diff --git a/ga_extractor/extractor.py b/ga_extractor/extractor.py index 823f9ea..bfe369d 100644 --- a/ga_extractor/extractor.py +++ b/ga_extractor/extractor.py @@ -248,8 +248,9 @@ def __migrate_extract(credentials, table_id, date_ranges): with build('analyticsreporting', 'v4', credentials=credentials) as service: body["reportRequests"][0]["dateRanges"] = [r] response = service.reports().batchGet(body=body).execute() - - rows[r["startDate"]] = response["reports"][0]["data"]["rows"] + num_rows = response["reports"][0]["data"]["totals"][0]["values"] + if len(list(filter(lambda x: x != '0', num_rows))): + rows[r["startDate"]] = response["reports"][0]["data"]["rows"] return rows