我有一个具有多个属性的帐户,我正在查询Google Analytics API来为每个属性拉Sessions和{a3}。在
现在是太平洋标准时间晚上8点45分,我有三个楼盘的20小时(8点)的数据,但另外两个楼盘只有13小时(下午1点)的数据。在查看GA UI时,所有5个属性都有到晚上8点的数据。在
我希望创建一个报告,以每小时为基础汇总所有5个物业的指标,但如果两个物业要落后几个小时,我就不能这样做。在
下面是我用来查询API的代码:
# configure query details
dimensions = "ga:hour"
metrics = "ga:sessions,ga:pageviews"
samplingLevel = "HIGHER_PRECISION"
for site in sites:
# Fetch data from API for yesterday
data = service.data().ga().get(
ids=site,
start_date=YESTERDAY,
end_date=YESTERDAY,
metrics=metrics,
dimensions=dimensions,
samplingLevel=samplingLevel
).execute()
# Fetch data from API for today
data = service.data().ga().get(
ids=site,
start_date=TODAY,
end_date=TODAY,
metrics=metrics,
dimensions=dimensions,
samplingLevel=samplingLevel
).execute()
是否需要为落后于计划的属性启用某些设置/配置?
谷歌分析可能需要24到48小时才能完成数据处理。在此之前可用的数据将不会100%正确,因为它没有完成处理。也不能保证所有的数据至少24小时前都会在那里。你将不能用reporting api来做你所说的。在
虽然您的一些物业可能会提前显示数据,但这并不是完整的,也不能保证明天他们仍然会提前显示数据。在
我建议您考虑使用Real-time api来实现这一点,主要缺点是您可以通过实时api访问的维度和度量的数量非常有限。在
相关问题 更多 >
编程相关推荐