Reputation: 2210
I have an account with multiple properties, I'm querying the Google Analytics API to pull Sessions and Pageviews by Hour for each.
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.
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.
Here is the code I'm using to query the 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?
Upvotes: 0
Views: 684
Reputation: 116918
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.
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.
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.
Upvotes: 1