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)
- Prix
- freeAu prix catalogue
- Taux de réussite
- 100 %30 derniers jours · 1 086 appels
- Latence p50
- 368 msp95 572 ms
- Dernière vérification
- 28 juil. 2026Vérifié et opérationnel
POSThttps://toolswitch.dev/v1/tools/google-analytics.realtimeBeta- Utilise le quota de la plateforme
- Réponse synchrone
- Lit des données publiques
Paramètres
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
| Paramètre | Type | Obligatoire | Description | Exemple |
|---|---|---|---|---|
| Paramètres de chemin | ||||
property_id | chaîne | Obligatoire | 123456789 | |
| Corps (JSON) | ||||
limit | entier | Facultatif | 20 | |
metrics | tableau | Obligatoire | activeUsers, screenPageViews, conversions | [{"name":"activeUsers"}] |
dimensions | tableau | Facultatif | realtime has its OWN smaller dimension set — unifiedScreenName, country, deviceCategory, audienceName; pagePath is not among them | [{"name":"unifiedScreenName"}] |
minuteRanges | tableau | Facultatif | windows within the last 30 minutes, e.g. [{"startMinutesAgo":29,"endMinutesAgo":0}] | |
- Paramètres de chemin
property_idchaîneObligatoireExemple :
123456789- Corps (JSON)
limitentierFacultatifExemple :
20metricstableauObligatoireactiveUsers, screenPageViews, conversions
Exemple :
[{"name":"activeUsers"}]dimensionstableauFacultatifrealtime has its OWN smaller dimension set — unifiedScreenName, country, deviceCategory, audienceName; pagePath is not among them
Exemple :
[{"name":"unifiedScreenName"}]minuteRangestableauFacultatifwindows within the last 30 minutes, e.g. [{"startMinutesAgo":29,"endMinutesAgo":0}]
Exemples de code
Remplacez $TOOLSWITCH_KEY par la clé créée dans la 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());Cette API de passerelle est en version Beta ; son URL et son authentification peuvent changer. Les paramètres de l’exemple sont des données fictives. Les appels sont facturés à free, frais de service inclus.