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)
- Precio
- freeA precio de catálogo
- Tasa de éxito
- 100 %Últimos 30 días · 1086 llamadas
- Latencia p50
- 368 msp95 572 ms
- Última verificación
- 28 jul 2026Verificado y operativo
POSThttps://toolswitch.dev/v1/tools/google-analytics.realtimeBeta- Usa la cuota de la plataforma
- Respuesta síncrona
- Lee datos públicos
Parámetros
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
| Parámetro | Tipo | Obligatorio | Descripción | Ejemplo |
|---|---|---|---|---|
| Parámetros de ruta | ||||
property_id | cadena | Obligatorio | 123456789 | |
| Cuerpo (JSON) | ||||
limit | entero | Opcional | 20 | |
metrics | matriz | Obligatorio | activeUsers, screenPageViews, conversions | [{"name":"activeUsers"}] |
dimensions | matriz | Opcional | realtime has its OWN smaller dimension set — unifiedScreenName, country, deviceCategory, audienceName; pagePath is not among them | [{"name":"unifiedScreenName"}] |
minuteRanges | matriz | Opcional | windows within the last 30 minutes, e.g. [{"startMinutesAgo":29,"endMinutesAgo":0}] | |
- Parámetros de ruta
property_idcadenaObligatorioEjemplo:
123456789- Cuerpo (JSON)
limitenteroOpcionalEjemplo:
20metricsmatrizObligatorioactiveUsers, screenPageViews, conversions
Ejemplo:
[{"name":"activeUsers"}]dimensionsmatrizOpcionalrealtime has its OWN smaller dimension set — unifiedScreenName, country, deviceCategory, audienceName; pagePath is not among them
Ejemplo:
[{"name":"unifiedScreenName"}]minuteRangesmatrizOpcionalwindows within the last 30 minutes, e.g. [{"startMinutesAgo":29,"endMinutesAgo":0}]
Ejemplos de código
Sustituye $TOOLSWITCH_KEY por la clave que creaste en la consola.
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());La API de la pasarela está en Beta; su URL y autenticación pueden cambiar. Los parámetros del ejemplo son datos de muestra. Las llamadas se facturan a free, incluida la tarifa de servicio.