英文:
Restricted collecting data on GA4
问题
为什么在 GA4 上收集单个属性的数据时受到 10,000 行限制?当日期范围太大时,我必须缩小它以解决此问题。是否有可以更改的参数或解决此问题的方法?
这是我的代码,我可以在哪里管理页面令牌参数?
client = BetaAnalyticsDataClient()
request = RunReportRequest(
property=f"properties/{property_id}",
dimensions=[Dimension(name=dim) for dim in dimensions],
metrics=[Metric(name=m) for m in metrics],
date_ranges=[DateRange(start_date=str(start_date), end_date=str(end_date))],
)
response = client.run_report(request)
output = {}
headers = [header.name for header in response.dimension_headers] + [
header.name for header in response.metric_headers
]
rows = []
for row in response.rows:
rows.append(
[dimension_value.value for dimension_value in row.dimension_values]
+ [metric_value.value for metric_value in row.metric_values]
)
output["headers"] = headers
output["rows"] = rows
analytics_df = pd.DataFrame(columns=output["headers"], data=output["rows"])
英文:
Why am I restricted to 10,000 rows when i collect data on one property on GA4 ? When the date range is too big I have to reduce it to manage this issue. Is there a parameter to change or a solution to this problem ?
Here is my code, where can I manage the page token parameter ?
client = BetaAnalyticsDataClient()
request = RunReportRequest(
property=f"properties/{property_id}",
dimensions=[Dimension(name=dim) for dim in dimensions],
metrics=[Metric(name=m) for m in metrics],
date_ranges=[DateRange(start_date=str(start_date), end_date=str(end_date))],
)
response = client.run_report(request)
output = {}
headers = [header.name for header in response.dimension_headers] + [
header.name for header in response.metric_headers
]
rows = []
for row in response.rows:
rows.append(
[dimension_value.value for dimension_value in row.dimension_values]
+ [metric_value.value for metric_value in row.metric_values]
)
output["headers"] = headers
output["rows"] = rows
analytics_df = pd.DataFrame(columns=output["headers"], data=output["rows"])
答案1
得分: 1
Google Analytics API有一个最大页面限制,最多可以请求10,000行数据,如果需要请求更多行,只需使用下一个页面令牌并分页请求。
如何实现取决于您使用的编程语言。
英文:
The google analytics api has a max page limit of 10,000 rows to request additional rows you just need to use the next page token and page over the requests.
How this is done depends upon the language you are using.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论