google-analytics
Installation
SKILL.md
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
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}'