Google Api返回的数据不是最新的(实时)

时间:2023-01-15 03:54:41

I have an account with multiple properties, I'm querying the Google Analytics API to pull Sessions and Pageviews by Hour for each.

我有一个包含多个属性的帐户,我正在查询Google AnalyticsAPI,以便按小时为每个提取会话和网页浏览量。

It's currently 8:45pm PST and I have data through 20th hour (8pm) on three properties, but two other properties only have data through the 13th hour (1pm). All 5 properties have data through 8pm when looking at the GA UI.

它目前是太平洋标准时间晚上8点45分,我有三个属性的20小时(晚上8点)的数据,但其他两个属性只有13小时(下午1点)的数据。当查看GA UI时,所有5个属性都有到晚上8点的数据。

I was hoping to create a report that rolls up metrics from all 5 properties on an hourly basis, but I can't do that if two properties are going to be hours behind.

我希望创建一个报告,按小时汇总所有5个属性的指标,但如果两个属性要落后数小时,我就不能这样做。

Here is the code I'm using to query the API:

这是我用来查询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()

Is there some setting/configuration I need to enable for the properties that are behind schedule?

是否需要为落后于计划的属性启用一些设置/配置?

1 个解决方案

#1


It can take between 24 and 48 hours for Google Analytics to finish processing data. Data that is available before that time will not be 100% correct as it is not completed processing. There is also no guarantee that all of the data will be there until its at least 24 hours old. You are not going to be able to do what you are talking about with the reporting api.

Google Analytics可能需要24到48小时才能完成数据处理。在此之前可用的数据将不是100%正确,因为它未完成处理。也不能保证所有数据在至少24小时之前都会存在。您无法使用报告API执行您所说的内容。

While some of your properties may be showing data early it wont be complete and there is no guarantee that tomorrow they will still show data early.

虽然您的某些属性可能会提前显示数据,但它并不完整,并且无法保证明天它们仍会提前显示数据。

Data processing latency
Processing latency is 24-48 hours. Standard accounts that send more than 200,000 sessions per day to Google Analytics will result in the reports being refreshed only once a day. This can delay updates to reports and metrics for up to two days. To restore intra-day processing, reduce the number of sessions you send to < 200,000 per day. For Premium accounts, this limit is extended to 2 billion hits per month.

数据处理延迟处理延迟为24-48小时。每天向Google Analytics发送超过200,000个会话的标准帐户将导致报告每天只刷新一次。这可能会延迟最多两天的报告和指标更新。要恢复日内处理,请将发送的会话数减少到每天<200,000。对于高级帐户,此限制扩展到每月20亿次点击。

I suggest you look into using the Real-time api for this, the main drawback is that there is a very limited number of dimensions and metrics that you have access to with the real-time api.

我建议您考虑使用Real-time api,主要缺点是您可以使用实时api访问非常有限的维度和指标。

#1


It can take between 24 and 48 hours for Google Analytics to finish processing data. Data that is available before that time will not be 100% correct as it is not completed processing. There is also no guarantee that all of the data will be there until its at least 24 hours old. You are not going to be able to do what you are talking about with the reporting api.

Google Analytics可能需要24到48小时才能完成数据处理。在此之前可用的数据将不是100%正确,因为它未完成处理。也不能保证所有数据在至少24小时之前都会存在。您无法使用报告API执行您所说的内容。

While some of your properties may be showing data early it wont be complete and there is no guarantee that tomorrow they will still show data early.

虽然您的某些属性可能会提前显示数据,但它并不完整,并且无法保证明天它们仍会提前显示数据。

Data processing latency
Processing latency is 24-48 hours. Standard accounts that send more than 200,000 sessions per day to Google Analytics will result in the reports being refreshed only once a day. This can delay updates to reports and metrics for up to two days. To restore intra-day processing, reduce the number of sessions you send to < 200,000 per day. For Premium accounts, this limit is extended to 2 billion hits per month.

数据处理延迟处理延迟为24-48小时。每天向Google Analytics发送超过200,000个会话的标准帐户将导致报告每天只刷新一次。这可能会延迟最多两天的报告和指标更新。要恢复日内处理,请将发送的会话数减少到每天<200,000。对于高级帐户,此限制扩展到每月20亿次点击。

I suggest you look into using the Real-time api for this, the main drawback is that there is a very limited number of dimensions and metrics that you have access to with the real-time api.

我建议您考虑使用Real-time api,主要缺点是您可以使用实时api访问非常有限的维度和指标。