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)
- 価格
- freeカタログ価格で提供
- 成功率
- 100%直近 30 日 · 1,086 回
- レイテンシ p50
- 368 msp95 572 ms
- 最終確認
- 2026/07/28動作確認済み
POSThttps://toolswitch.dev/v1/tools/google-analytics.realtimeBeta- プラットフォームのクォータを使用
- 同期レスポンス
- 公開データを読み取る
パラメータ
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
| パラメータ | 型 | 必須 | 説明 | 例 |
|---|---|---|---|---|
| パスパラメータ | ||||
property_id | 文字列 | 必須 | 123456789 | |
| リクエストボディ(JSON) | ||||
limit | 整数 | 任意 | 20 | |
metrics | 配列 | 必須 | activeUsers, screenPageViews, conversions | [{"name":"activeUsers"}] |
dimensions | 配列 | 任意 | realtime has its OWN smaller dimension set — unifiedScreenName, country, deviceCategory, audienceName; pagePath is not among them | [{"name":"unifiedScreenName"}] |
minuteRanges | 配列 | 任意 | windows within the last 30 minutes, e.g. [{"startMinutesAgo":29,"endMinutesAgo":0}] | |
- パスパラメータ
property_id文字列必須例:
123456789- リクエストボディ(JSON)
limit整数任意例:
20metrics配列必須activeUsers, screenPageViews, conversions
例:
[{"name":"activeUsers"}]dimensions配列任意realtime has its OWN smaller dimension set — unifiedScreenName, country, deviceCategory, audienceName; pagePath is not among them
例:
[{"name":"unifiedScreenName"}]minuteRanges配列任意windows within the last 30 minutes, e.g. [{"startMinutesAgo":29,"endMinutesAgo":0}]
コード例
$TOOLSWITCH_KEY をコンソールで作成したキーに置き換えてください。
Beta
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());このゲートウェイ API は Beta です。URL や認証方式は変更される場合があります。 パラメータはサンプルデータです。 呼び出し料金は free です。サービス料を含みます。