【发布时间】:2021-10-27 08:11:25
【问题描述】:
我想传递多个视图 ID,因为我的视图 ID 是区域,并将它们组合成一个数据框。由于我是初学者,有人可以帮助我吗?
我已经尝试了下面的 for 循环,但不确定。 ID = ['156950826','156928279','156964042']
def ga_data(i):
IDs = i
return
下面是批量获取的代码/
def get_report(analytics):
return analytics.reports().batchGet(
body={
'reportRequests': [
{
'viewId': [{'VIEW_ID':i} for i in VIEW_ID],
'dateRanges': [{'startDate': START_DATE, 'endDate': END_DATE}],
'metrics': [{'expression':i} for i in METRICS],
'dimensions': [{'name':j} for j in DIMENSIONS],
'pageSize': 8000 #by default batch request gives only 1000 results. Max is 100,000
}]
}
).execute()
【问题讨论】:
标签: python google-api google-analytics-api google-api-python-client