Run a custom GA4 report by property id
google-analytics.reportRun a traffic or behaviour report on your own Google Analytics property
- 価格
- freeカタログ価格で提供
- 成功率
- 100%直近 30 日 · 15,619 回
- レイテンシ p50
- 545 msp95 2.3 s
- 最終確認
- 2026/07/28動作確認済み
POSThttps://toolswitch.dev/v1/tools/google-analytics.reportBeta- プラットフォームのクォータを使用
- 同期レスポンス
- 公開データを読み取る
パラメータ
request shape previously live-verified via the registry entry's examples. An incompatible dimension/metric pair fails the whole call — check google.analytics.metadata for what combines. Sampling and thresholding are reported back in the response metadata, not as an error
| パラメータ | 型 | 必須 | 説明 | 例 |
|---|---|---|---|---|
| パスパラメータ | ||||
property_id | 文字列 | 必須 | numeric GA4 property id (the digits only — the admin API returns it as 'properties/123456789') | 123456789 |
| リクエストボディ(JSON) | ||||
limit | 整数 | 任意 | default 10000, max 250000 | 100 |
offset | 整数 | 任意 | 0 | |
metrics | 配列 | 任意 | [{name: …}] — e.g. screenPageViews, sessions, activeUsers, conversions, engagementRate | [{"name":"screenPageViews"}] |
orderBys | 配列 | 任意 | e.g. [{"metric":{"metricName":"sessions"},"desc":true}] | |
dateRanges | 配列 | 必須 | up to 4 ranges. Use 'yesterday' or 'NdaysAgo', not 'today' — today is a partial day and always reads low | [{"endDate":"yesterday","startDate":"28daysAgo"}] |
dimensions | 配列 | 任意 | [{name: …}] — e.g. pagePath, sessionSource, sessionDefaultChannelGroup, country, deviceCategory, date | [{"name":"pagePath"}] |
keepEmptyRows | 真偽値 | 任意 | ||
dimensionFilter | オブジェクト | 任意 | e.g. {"filter":{"fieldName":"pagePath","stringFilter":{"matchType":"CONTAINS","value":"/blog/"}}} | |
- パスパラメータ
property_id文字列必須numeric GA4 property id (the digits only — the admin API returns it as 'properties/123456789')
例:
123456789- リクエストボディ(JSON)
limit整数任意default 10000, max 250000
例:
100offset整数任意例:
0metrics配列任意[{name: …}] — e.g. screenPageViews, sessions, activeUsers, conversions, engagementRate
例:
[{"name":"screenPageViews"}]orderBys配列任意e.g. [{"metric":{"metricName":"sessions"},"desc":true}]
dateRanges配列必須up to 4 ranges. Use 'yesterday' or 'NdaysAgo', not 'today' — today is a partial day and always reads low
例:
[{"endDate":"yesterday","startDate":"28daysAgo"}]dimensions配列任意[{name: …}] — e.g. pagePath, sessionSource, sessionDefaultChannelGroup, country, deviceCategory, date
例:
[{"name":"pagePath"}]keepEmptyRows真偽値任意dimensionFilterオブジェクト任意e.g. {"filter":{"fieldName":"pagePath","stringFilter":{"matchType":"CONTAINS","value":"/blog/"}}}
コード例
$TOOLSWITCH_KEY をコンソールで作成したキーに置き換えてください。
curl -X POST 'https://toolswitch.dev/v1/tools/google-analytics.report' \
-H "X-Toolswitch-Key: $TOOLSWITCH_KEY" \
-H "Content-Type: application/json" \
--data-raw '{"limit":3,"metrics":[{"name":"sessions"}],"dateRanges":[{"endDate":"yesterday","startDate":"28daysAgo"}],"dimensions":[{"name":"sessionDefaultChannelGroup"}]}'import os
import json
import requests
response = requests.request(
"POST",
"https://toolswitch.dev/v1/tools/google-analytics.report",
headers={"X-Toolswitch-Key": os.environ["TOOLSWITCH_KEY"]},
json=json.loads("{\"limit\":3,\"metrics\":[{\"name\":\"sessions\"}],\"dateRanges\":[{\"endDate\":\"yesterday\",\"startDate\":\"28daysAgo\"}],\"dimensions\":[{\"name\":\"sessionDefaultChannelGroup\"}]}"),
)
response.raise_for_status()
print(response.text)const response = await fetch("https://toolswitch.dev/v1/tools/google-analytics.report", {
method: "POST",
headers: {
"X-Toolswitch-Key": process.env.TOOLSWITCH_KEY ?? "",
"Content-Type": "application/json",
},
body: JSON.stringify(JSON.parse("{\"limit\":3,\"metrics\":[{\"name\":\"sessions\"}],\"dateRanges\":[{\"endDate\":\"yesterday\",\"startDate\":\"28daysAgo\"}],\"dimensions\":[{\"name\":\"sessionDefaultChannelGroup\"}]}")),
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
console.log(await response.text());このゲートウェイ API は Beta です。URL や認証方式は変更される場合があります。 パラメータはサンプルデータです。 呼び出し料金は free です。サービス料を含みます。