What Is The Time Range For Google Analytics Real Time API - api

I'm having no issues using the API with PHP, but when I look at my dashboard on Google Analytics, it says I have 1 real time user, but the data I get back from my API call shows far more than that. This leads me to believe this is over a period of time. What is the time period it is calling? The last 15 mins, 30?
Thanks for your help!

For real time reports, the session duration of a user is 5 minutes. More info can be found here https://support.google.com/analytics/answer/1638635?hl=en under "Active User Metrics". I'm not sure if this would be any different if the data was accessed through the API though.

I discovered that the answer is 30 minutes. Realtime displays pageviews back 30 minutes, not as a snapshot as I had thought.

Related

Is it possible to increase the Google Sheets API quota limit beyond 2500 per account and 500 per user?

The problem: Running into Google Sheets API read/write quota limits. Specifically, the read/write requests per 100 seconds and read/write requests per 100 seconds per user quotas.
Some background:
For the past few months I've been developing a web app for students and staff in our school district which uses a Google spreadsheet as the database. Each school in our district was assigned a different Google spreadsheet, and a service account was created to make read and write calls to these spreadsheets on behalf of the web app.
We started with one school of approximately 1000 students, but it has now expanded to two other schools with a total user load of around 4000. Due to the nature of a school day schedule, we started hitting our quota limit (per 100 sec & per 100 sec per user) since almost everyone uses the app at the same time.
I found the usage limits guide for the Google sheets API, and as per the instructions I created a billing account, and linked the associated service account project to it. I then went to the quotas section in the developers console and applied for a higher quota. This involved filling out a Google form which asked "How much quota do you need? Express in number of API queries per day." Again, queries per day is not the problem, rather it's the number of queries per 100 seconds and per user (service account). After a couple of weeks our limit was increased to 2500 read/write requests per 100 seconds and 500 read/write requests per 100 seconds per user. The billing account was not charged, and after a little searching, I realized this was a free increase. This bump in our quota limit helped, but it's still going to be an issue because our district wants to add more schools in the future.
Here's what I need to know:
1) [ESSENTIAL QUESTION] Does Google have an upper limit or maximum to the number of read/write requests a single service account/user/IP can make within the 100 second time frame, and if so what is it?
2) If it is possible to go beyond our current quota limit (2500/500), is there another way of requesting/applying for the increase. Once again we have a billing account established for the project and are willing to pay for the service.
I've been pulling (what's left of) my hair out trying to find definitive answers to my questions. This post came close to what I was looking for, and I even did some of the things the OP suggested, but I just need a direct answer to my "essential" question.
Couple more things.
I understand that Google Charts Visualization doesn't have a quota limitation, and I'd consider using it however, for privacy reasons I can't have the spreadsheet keys exposed in plain javascript. Are there other options here?
Also, one might suggest creating multiple service accounts, but I'd rather avoid this if possible.
Thank you for your help. I'm very much a novice and I greatly appreciate your time and expertise.
To answer your questions:
1) [ESSENTIAL QUESTION] Does Google have an upper limit or maximum to the number of read/write requests a single service account/user/IP can make within the 100 second time frame, and if so what is it?
*The provided documentation only stated that Google Sheets API has a limit of 500 requests per 100 seconds per project, and 100 requests per 100 seconds per user. Check this post for additional information.*
2) If it is possible to go beyond our current quota limit (2500/500), is there another way of requesting/applying for the increase. Once again we have a billing account established for the project and are willing to pay for the service.
AFAIK, you can request for a higher quota limit and the Google Engineers may grant the request as long as you are making a reasonable request.
Also, you may check this thread for additional tips:
You can use spreadsheets.get to read the entire spreadsheet in a single call, rather than 1 call per request. Alternately, you
can use spreadsheets.values.batchGet to read multiple different
ranges in a single call, if all you need are the values.
The Drive API offers "push notifications", so you can get notified when changes occur and react to those, instead of polling for
them. The latency of the notifications is a little on the slow side,
but it gets the job done.

How does Google define "day" for Google API quotas?

Google Cloud Translate API, for example, sets a default quota of 2 million characters "per day".
However, I can't find their definition of "day" anywhere.
Is this calendar-based, or is it a sliding time interval?
(Observation suggests that it is a sliding time window.)
If calendar-based, when does each day begin?
Is this immutable or does it vary?
Can developers set the start or end time of a project's "days"?
If it is a sliding window, can developers reset it? This could help us manage usage that comes in bursts, and could help us test limiting situations.
Thanks in advance for any information you can provide.
I found one answer in Google's online documentation, and it is specific to the Google Analytics API.
This API's daily quota is calendar-based and immutable:
Daily quotas are refreshed at midnight Pacific Standard Time.
From: Google Developers | Analytics Real Time Reporting API | Limits and Quotas on API Requests
I assume that this definition probably applies to the other Google APIs, as well.

How do i get active minutes?

I am trying to get active minutes out of Jawbone API's but haven't find anything. Is there a way to get to know active minutes of a user? Does jawbone supports and shows active minutes?
thanks
Take a look at the documentation for the moves endpoint. One of the pieces of data that comes back for a move event is active_time, which is the total active time in seconds.

New Instagram Rate Limits

We have created an app to display our own feed on our own website. However, we're now exceeding the new rate limit of 500 requests per hour. Instagram says our app does not need review and therefore cannot be upgraded to a "Live" app and take advantage of the higher rate limit. How do we get around this? On a side note, this is a lot of trouble to display our own feed on our own website. Sheesh.
If I got it right, you datafeed is seen by all users, but it's always the same datafeed. So instead of caching it for each user, you could request data each 30 seconds (or less) and store the results in a DB. You should then try always to read feed data from DB but if 15 seconds have passed you should request data from Instagram again.
That would make pretty transaparent to your users

How to get 5 hours back trend in Twitter?

I know how to get the current trends of Twitter for a specific location, but is there any way to get 5 hours back trend in Twitter using API ?
The Twitter REST API does not support this sort of inquiry. To accomplish this, you would need to have your application poll the trends every hour (or so) and store them in a database. You could then query that database however you like.