google-analytics-apiGoogle Analytics API integration with managed OAuth. Manage accounts, properties, and data streams (Admin API). Run reports on sessions, users, page views, and conversions (Data API). Use this skill when users want to configure or query Google Analytics. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway).
Install via ClawdBot CLI:
clawdbot install rich-song/google-analytics-apiAccess Google Analytics with managed OAuth authentication. This skill covers both the Admin API (manage accounts, properties, data streams) and the Data API (run reports on metrics).
# List account summaries (Admin API)
curl -s -X GET "https://gateway.maton.ai/google-analytics-admin/v1beta/accountSummaries" -H "Authorization: Bearer $MATON_API_KEY"
# Run a report (Data API)
curl -s -X POST "https://gateway.maton.ai/google-analytics-data/v1beta/properties/{propertyId}:runReport" -H "Content-Type: application/json" -H "Authorization: Bearer $MATON_API_KEY" -d '{"dateRanges": [{"startDate": "30daysAgo", "endDate": "today"}], "dimensions": [{"name": "city"}], "metrics": [{"name": "activeUsers"}]}'
Admin API (manage accounts, properties, data streams):
https://gateway.maton.ai/google-analytics-admin/{native-api-path}
Data API (run reports):
https://gateway.maton.ai/google-analytics-data/{native-api-path}
Replace {native-api-path} with the actual Google Analytics API endpoint path. The gateway proxies requests to analyticsadmin.googleapis.com and analyticsdata.googleapis.com and automatically injects your OAuth token.
All requests require the Maton API key in the Authorization header:
Authorization: Bearer $MATON_API_KEY
Environment Variable: Set your API key as MATON_API_KEY:
export MATON_API_KEY="YOUR_API_KEY"
Manage your Google OAuth connections at https://ctrl.maton.ai.
Important: The Admin API and Data API use separate connections:
google-analytics-admin - Required for Admin API endpoints (manage accounts, properties, data streams)google-analytics-data - Required for Data API endpoints (run reports)Create the connection(s) you need based on which API you want to use.
# List Admin API connections
curl -s -X GET "https://ctrl.maton.ai/connections?app=google-analytics-admin&status=ACTIVE" -H "Authorization: Bearer $MATON_API_KEY"
# List Data API connections
curl -s -X GET "https://ctrl.maton.ai/connections?app=google-analytics-data&status=ACTIVE" -H "Authorization: Bearer $MATON_API_KEY"
# Create Admin API connection (for managing accounts, properties, data streams)
curl -s -X POST "https://ctrl.maton.ai/connections" -H "Content-Type: application/json" -H "Authorization: Bearer $MATON_API_KEY" -d '{"app": "google-analytics-admin"}'
# Create Data API connection (for running reports)
curl -s -X POST "https://ctrl.maton.ai/connections" -H "Content-Type: application/json" -H "Authorization: Bearer $MATON_API_KEY" -d '{"app": "google-analytics-data"}'
curl -s -X GET "https://ctrl.maton.ai/connections/{connection_id}" -H "Authorization: Bearer $MATON_API_KEY"
Response:
{
"connection": {
"connection_id": "21fd90f9-5935-43cd-b6c8-bde9d915ca80",
"status": "ACTIVE",
"creation_time": "2025-12-08T07:20:53.488460Z",
"last_updated_time": "2026-01-31T20:03:32.593153Z",
"url": "https://connect.maton.ai/?session_token=...",
"app": "google-analytics-admin",
"metadata": {}
}
}
Open the returned url in a browser to complete OAuth authorization.
curl -s -X DELETE "https://ctrl.maton.ai/connections/{connection_id}" -H "Authorization: Bearer $MATON_API_KEY"
If you have multiple Google Analytics connections, specify which one to use with the Maton-Connection header:
curl -s -X GET "https://gateway.maton.ai/google-analytics-admin/v1beta/accountSummaries" -H "Authorization: Bearer $MATON_API_KEY" -H "Maton-Connection: 21fd90f9-5935-43cd-b6c8-bde9d915ca80"
If omitted, the gateway uses the default (oldest) active connection.
GET /google-analytics-admin/v1beta/accounts
GET /google-analytics-admin/v1beta/accounts/{accountId}
GET /google-analytics-admin/v1beta/accountSummaries
GET /google-analytics-admin/v1beta/properties?filter=parent:accounts/{accountId}
GET /google-analytics-admin/v1beta/properties/{propertyId}
POST /google-analytics-admin/v1beta/properties
Content-Type: application/json
{
"parent": "accounts/{accountId}",
"displayName": "My New Property",
"timeZone": "America/Los_Angeles",
"currencyCode": "USD"
}
GET /google-analytics-admin/v1beta/properties/{propertyId}/dataStreams
POST /google-analytics-admin/v1beta/properties/{propertyId}/dataStreams
Content-Type: application/json
{
"type": "WEB_DATA_STREAM",
"displayName": "My Website",
"webStreamData": {"defaultUri": "https://example.com"}
}
GET /google-analytics-admin/v1beta/properties/{propertyId}/customDimensions
POST /google-analytics-admin/v1beta/properties/{propertyId}/customDimensions
Content-Type: application/json
{
"parameterName": "user_type",
"displayName": "User Type",
"scope": "USER"
}
GET /google-analytics-admin/v1beta/properties/{propertyId}/conversionEvents
POST /google-analytics-admin/v1beta/properties/{propertyId}/conversionEvents
POST /google-analytics-data/v1beta/properties/{propertyId}:runReport
Content-Type: application/json
{
"dateRanges": [{"startDate": "30daysAgo", "endDate": "today"}],
"dimensions": [{"name": "city"}],
"metrics": [{"name": "activeUsers"}]
}
POST /google-analytics-data/v1beta/properties/{propertyId}:runRealtimeReport
Content-Type: application/json
{
"dimensions": [{"name": "country"}],
"metrics": [{"name": "activeUsers"}]
}
POST /google-analytics-data/v1beta/properties/{propertyId}:batchRunReports
Content-Type: application/json
{
"requests": [
{
"dateRanges": [{"startDate": "7daysAgo", "endDate": "today"}],
"dimensions": [{"name": "country"}],
"metrics": [{"name": "sessions"}]
}
]
}
GET /google-analytics-data/v1beta/properties/{propertyId}/metadata
{
"dateRanges": [{"startDate": "30daysAgo", "endDate": "today"}],
"dimensions": [{"name": "pagePath"}],
"metrics": [{"name": "screenPageViews"}],
"orderBys": [{"metric": {"metricName": "screenPageViews"}, "desc": true}],
"limit": 10
}
{
"dateRanges": [{"startDate": "30daysAgo", "endDate": "today"}],
"dimensions": [{"name": "country"}],
"metrics": [{"name": "activeUsers"}, {"name": "sessions"}]
}
{
"dateRanges": [{"startDate": "30daysAgo", "endDate": "today"}],
"dimensions": [{"name": "sessionSource"}, {"name": "sessionMedium"}],
"metrics": [{"name": "sessions"}, {"name": "conversions"}]
}
date, country, city, deviceCategorypagePath, pageTitle, landingPagesessionSource, sessionMedium, sessionCampaignNameactiveUsers, newUsers, sessionsscreenPageViews, bounceRate, averageSessionDurationconversions, eventCounttoday, yesterday, 7daysAgo, 30daysAgo2026-01-01// List account summaries (Admin API)
const accounts = await fetch(
'https://gateway.maton.ai/google-analytics-admin/v1beta/accountSummaries',
{
headers: {
'Authorization': `Bearer ${process.env.MATON_API_KEY}`
}
}
);
// Run a report (Data API)
const report = await fetch(
'https://gateway.maton.ai/google-analytics-data/v1beta/properties/123456:runReport',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${process.env.MATON_API_KEY}`
},
body: JSON.stringify({
dateRanges: [{ startDate: '30daysAgo', endDate: 'today' }],
dimensions: [{ name: 'country' }],
metrics: [{ name: 'activeUsers' }]
})
}
);
import os
import requests
# List account summaries (Admin API)
accounts = requests.get(
'https://gateway.maton.ai/google-analytics-admin/v1beta/accountSummaries',
headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'}
)
# Run a report (Data API)
report = requests.post(
'https://gateway.maton.ai/google-analytics-data/v1beta/properties/123456:runReport',
headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'},
json={
'dateRanges': [{'startDate': '30daysAgo', 'endDate': 'today'}],
'dimensions': [{'name': 'country'}],
'metrics': [{'name': 'activeUsers'}]
}
)
properties/521310447)accountSummaries to quickly list all accessible propertiesupdateMask for PATCH requests in Admin APIcurl -g when URLs contain brackets (fields[], sort[], records[]) to disable glob parsingjq or other commands, environment variables like $MATON_API_KEY may not expand correctly in some shell environments. You may get "Invalid API key" errors when piping.| Status | Meaning |
|--------|---------|
| 400 | Missing Google Analytics connection |
| 401 | Invalid or missing Maton API key |
| 429 | Rate limited (10 req/sec per account) |
| 4xx/5xx | Passthrough error from Google Analytics API |
Generated Mar 1, 2026
An online retailer uses the Data API to run daily reports on sessions, page views, and conversion metrics by product category and city. This helps track sales trends, optimize marketing spend, and identify high-performing regions for targeted campaigns.
A media company leverages the Data API to analyze active users, session duration, and traffic sources for their website. They use this data to understand reader engagement, tailor content strategies, and report audience metrics to advertisers for ad placement decisions.
A software startup uses the Admin API to create a new Google Analytics property and configure custom dimensions for user roles and feature usage. This enables them to track user behavior within their application, monitor adoption rates, and gather insights for product development.
A digital marketing agency employs both APIs: the Admin API to manage data streams for multiple client websites, and the Data API to generate automated weekly reports on user acquisition and conversion events. This streamlines client reporting and helps demonstrate campaign ROI.
A large corporation uses the Admin API to audit account summaries, properties, and data streams across departments. This ensures proper access controls, maintains data hygiene, and supports compliance with internal policies for analytics usage across the organization.
Companies offering analytics dashboards or reporting tools as a service can integrate this skill to pull Google Analytics data for their customers. This enables recurring revenue through monthly subscriptions while providing value-added insights on top of raw data.
Marketing and consulting agencies use this skill to automate data collection and reporting for clients, reducing manual work. They charge project-based or retainer fees for setup, ongoing analysis, and optimization services based on the insights derived.
Businesses build and sell custom analytics products or integrations that leverage Google Analytics data, such as competitive intelligence tools or industry benchmarks. Revenue comes from one-time sales or licensing fees for these specialized data solutions.
💬 Integration Tip
Start by setting up the Data API connection for basic reporting before adding Admin API features; use the Maton-Connection header to manage multiple client accounts efficiently in agency workflows.
Quick system diagnostics: CPU, memory, disk, uptime
Query Google Analytics 4 (GA4) data via the Analytics Data API. Use when you need to pull website analytics like top pages, traffic sources, user counts, ses...
Google Analytics 4, Search Console, and Indexing API toolkit. Analyze website traffic, page performance, user demographics, real-time visitors, search queries, and SEO metrics. Use when the user asks to: check site traffic, analyze page views, see traffic sources, view user demographics, get real-time visitor data, check search console queries, analyze SEO performance, request URL re-indexing, inspect index status, compare date ranges, check bounce rates, view conversion data, or get e-commerce revenue. Requires a Google Cloud service account with GA4 and Search Console access.
Google Analytics API integration with managed OAuth. Manage accounts, properties, and data streams (Admin API). Run reports on sessions, users, page views, and conversions (Data API). Use this skill when users want to configure or query Google Analytics. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway).
Deploy privacy-first analytics with correct API patterns, rate limits, and GDPR compliance.
Google Analytics 4, Search Console, and Indexing API toolkit. Analyze website traffic, page performance, user demographics, real-time visitors, search queries, and SEO metrics. Use when the user asks to: check site traffic, analyze page views, see traffic sources, view user demographics, get real-time visitor data, check search console queries, analyze SEO performance, request URL re-indexing, inspect index status, compare date ranges, check bounce rates, view conversion data, or get e-commerce revenue. Requires a Google Cloud service account with GA4 and Search Console access.