Question

I would like to understand the earliest time when the data for the previous week (Mon-Sun) can be requested from the Google Analytics API:

response = service.data().ga().get(
  ids='ga:78212345',
  start_date='2014-03-31',
  end_date='2014-04-06',
  metrics='ga:visitors').execute()

I will request the data with GAE cron, it uses UTC. If I define every monday 00:01, will Sunday be already finished in Google Analytics timezone?

Upd. That old discussion says that Google Analytics API uses timezone from the profile. I use service account (myappid@appspot.gserviceaccount.com) to access the API. Which timezone setting is used in this case?

Was it helpful?

Solution 2

It takes 24 hours for the data in the standard API to finish processing. Some of the data may in fact be there but the numbers can and will change over time because they aren't done processing it.

Here is my experience and what I have done to deal with this limitation.

I have a SSIS task that basically does what you are talking about doing with Cron. What we decided to do was never check yesterday. We always select data starting two days ago. This ensures that we have correct data. We may not have the 100% up to date data but we have what we can be 100% sure is finished processing and correct.

Example: My SSIS task runs around 2 am on 2014-04-11. Now technically speaking data between 2014-04-10 2:00 and 2014-04-11 2:00 hasn't finished processing yet. This means that I cant use either 2014-04-11 or 2014-04-10 in my query. The only way to ensure that the data is done processing is to use 2014-04-09.

Note: I have had some people say it can take up to 48 hours for data to be done processing. I have only seen this when someone just installed the tracking code on there website. My experience says that data is done processing after 24 hours.

So to answer your question: To request Sundays data I would wait until Tuesday.


From Google Help - Data limits

Data processing latency

Processing latency is 24-48 hours. Standard accounts that send more than 200,000 visits 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 visits you send to < 200,000 per day. For Premium accounts, this limit is extended to 2 billion hits per month.

I have submitted an feature request for adding the Account time zone to the Google Analytics Management API. ISSUE 418: Timezone for an account

Hope this helps.

OTHER TIPS

Reporting API is used to access Google Analytics report data. View ID is one of the required params this API.

Namely View ID defines the timezone in its settings:

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top