GA4 realtime active users by page, source, country
google-analytics.realtimeSee who is on your site right now (active users by page, source and country)
- Price
- freeAt list price
- Success rate
- 100%Last 30 days · 1,086 calls
- Latency p50
- 368 msp95 572 ms
- Last verified
- Jul 28, 2026Verified working
POSThttps://toolswitch.dev/v1/tools/google-analytics.realtimeBeta- Uses platform quota
- Synchronous response
- Reads public data
Parameters
covers the last 30 minutes only, and takes NO dateRanges — passing one is an error. Reusing a standard-report dimension name here is the usual failure
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| Path parameters | ||||
property_id | string | Required | 123456789 | |
| Request body (JSON) | ||||
limit | integer | Optional | 20 | |
metrics | array | Required | activeUsers, screenPageViews, conversions | [{"name":"activeUsers"}] |
dimensions | array | Optional | realtime has its OWN smaller dimension set — unifiedScreenName, country, deviceCategory, audienceName; pagePath is not among them | [{"name":"unifiedScreenName"}] |
minuteRanges | array | Optional | windows within the last 30 minutes, e.g. [{"startMinutesAgo":29,"endMinutesAgo":0}] | |
- Path parameters
property_idstringRequiredExample:
123456789- Request body (JSON)
limitintegerOptionalExample:
20metricsarrayRequiredactiveUsers, screenPageViews, conversions
Example:
[{"name":"activeUsers"}]dimensionsarrayOptionalrealtime has its OWN smaller dimension set — unifiedScreenName, country, deviceCategory, audienceName; pagePath is not among them
Example:
[{"name":"unifiedScreenName"}]minuteRangesarrayOptionalwindows within the last 30 minutes, e.g. [{"startMinutesAgo":29,"endMinutesAgo":0}]
Code samples
Replace $TOOLSWITCH_KEY with the key you created in the console.
curl -X POST 'https://toolswitch.dev/v1/tools/google-analytics.realtime' \
-H "X-Toolswitch-Key: $TOOLSWITCH_KEY" \
-H "Content-Type: application/json" \
--data-raw '{"limit":3,"metrics":[{"name":"activeUsers"}],"dimensions":[{"name":"country"}]}'import os
import json
import requests
response = requests.request(
"POST",
"https://toolswitch.dev/v1/tools/google-analytics.realtime",
headers={"X-Toolswitch-Key": os.environ["TOOLSWITCH_KEY"]},
json=json.loads("{\"limit\":3,\"metrics\":[{\"name\":\"activeUsers\"}],\"dimensions\":[{\"name\":\"country\"}]}"),
)
response.raise_for_status()
print(response.text)const response = await fetch("https://toolswitch.dev/v1/tools/google-analytics.realtime", {
method: "POST",
headers: {
"X-Toolswitch-Key": process.env.TOOLSWITCH_KEY ?? "",
"Content-Type": "application/json",
},
body: JSON.stringify(JSON.parse("{\"limit\":3,\"metrics\":[{\"name\":\"activeUsers\"}],\"dimensions\":[{\"name\":\"country\"}]}")),
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
console.log(await response.text());This gateway API is in beta; its URL and authentication may change. The example parameters are sample data. Calls are billed at free, including the service fee.