Skip to main content

google-analytics

Query Google Analytics 4 — reports, realtime data, dimensions, and metrics via the Data API.

ソース情報

リポジトリ
ThinkfleetAI/thinkfleet-engine
ソースの最終更新活動
2026年2月1日 16:21
検出された SKILL.md の言語
英語
スター
0
フォーク
0

インストール方法

デフォルトでは、最初にソースを確認する Prompt が選択されています。直接コマンドに切り替えるか、ローカルコピーをダウンロードすることもできます。

ソースファイルを確認

インストールを決める前に、SKILL.md と SkillsMP に表示されている付属ファイルをお読みください。

SKILL.md を表示中

SKILL.md
ソースの指示 · 読み取り専用プレビュー
name
google-analytics
description
Query Google Analytics 4 — reports, realtime data, dimensions, and metrics via the Data API.
metadata
{"thinkfleetbot":{"emoji":"📈","requires":{"bins":"[Truncated]","env":"[Truncated]"}}}
# Google Analytics 4 Query reports, realtime data, and metrics via the GA4 Data API. ## Environment Variables - `GOOGLE_ACCESS_TOKEN` - OAuth 2.0 access token with Analytics scope ## Run report ```bash curl -s -X POST -H "Authorization: Bearer $GOOGLE_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ "https://analyticsdata.googleapis.com/v1beta/properties/PROPERTY_ID:runReport" \ -d '{"dateRanges":[{"startDate":"7daysAgo","endDate":"today"}],"dimensions":[{"name":"pagePath"}],"metrics":[{"name":"activeUsers"},{"name":"screenPageViews"}],"limit":10}' | jq '.rows[] | {page: .dimensionValues[0].value, users: .metricValues[0].value, views: .metricValues[1].value}' ``` ## Realtime report ```bash curl -s -X POST -H "Authorization: Bearer $GOOGLE_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ "https://analyticsdata.googleapis.com/v1beta/properties/PROPERTY_ID:runRealtimeReport" \ -d '{"dimensions":[{"name":"country"}],"metrics":[{"name":"activeUsers"}],"limit":10}' | jq '.rows[] | {country: .dimensionValues[0].value, users: .metricValues[0].value}' ``` ## List properties ```bash curl -s -H "Authorization: Bearer $GOOGLE_ACCESS_TOKEN" \ "https://analyticsadmin.googleapis.com/v1beta/properties?filter=parent:accounts/ACCOUNT_ID" | jq '.properties[] | {name, displayName}' ``` ## Notes - Replace `PROPERTY_ID` with your GA4 property ID (numeric). - Access token must have `https://www.googleapis.com/auth/analytics.readonly` scope.
GitHubで見る