Google AnalyticsGoogle AnalyticsSEO/AEO

Run a custom GA4 report by property id

google-analytics.report

Run a traffic or behaviour report on your own Google Analytics property

价格
free按目录价
成功率
100%近 30 天 · 15,619 次
延迟 p50
545 毫秒p95 2.3 秒
最后验证
2026年7月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 250000100
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

    示例: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/"}}}

代码示例

将 $TOOLSWITCH_KEY 替换为你在控制台创建的密钥。

Beta
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"}]}'

网关接口为 Beta,地址与鉴权方式可能变更。 示例参数仅为样例数据。 调用按 free 计费,已含服务费。