google-analytics-api Real-time API



(Required) Parameter nameDescription
idsUnique table ID for retrieving Analytics data. Table ID is of the form ga:XXXX, where XXXX is the Analytics view (profile) ID.
metricsA comma-separated list of Analytics metrics. E.g., 'rt:activeUsers'. At least one metric must be specified.
(Optional) Parameter nameDescription
dimensionsA comma-separated list of real-time dimensions. E.g., 'rt:medium,rt:city'.
filtersA comma-separated list of dimension or metric filters to be applied to real-time data.
max-resultsThe maximum number of entries to include in this feed.
sortA comma-separated list of dimensions or metrics that determine the sort order for real-time data.
(Standard) Parameter nameDescription
callbackName of the JavaScript callback function that handles the response. Used in JavaScript JSON-P requests.
prettyPrintReturns the response in a human-readable format if true. Default value: true. When this is false, it can reduce the response payload size, which might lead to better performance in some environments.
quotaUserLets you enforce per-user quotas from a server-side application even in cases when the user's IP address is unknown. This can occur, for example, with applications that run cron jobs on App Engine on a user's behalf. You can choose any arbitrary string that uniquely identifies a user, but it is limited to 40 characters.Overrides userIp if both are provided. Learn more about capping usage.
userIpLets you enforce per-user quotas when calling the API from a server-side application. Learn more about capping usage.


The Real Time Reporting API, in limited beta, is available for developer preview only. Sign up to access the API.

The Real Time Reporting API enables you to request real time data—for example, real time activity on your property—for an authenticated user.

You can use the Real Time Reporting API to:

  • Display active viewers of a page and create a sense of urgency for users looking at an item with finite inventory.
  • Display the most popular content such as the top 10 active pages.
  • Create and display a real time dashboard.


Calls to the Google Analytics Real-time API requires authorization with at least one of the following scopes (read more about authentication and authorization).

Scopeaccess granted access to Google Analytics accounts up to the level of the authenticated users access. only access to the Authenticated users Google Analytics accounts