← Back to Skills Marketplace
rich-song

Google Analytics

by rich-song · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
1862
Downloads
1
Stars
6
Active Installs
1
Versions
Install in OpenClaw
/install google-analytics-api
Description
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).
README (SKILL.md)

Google Analytics

Access 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).

Quick Start

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

Base URLs

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.

Authentication

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"

Getting Your API Key

  1. Sign in or create an account at maton.ai
  2. Go to maton.ai/settings
  3. Copy your API key

Connection Management

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 Connections

# 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 Connection

# 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"}'

Get Connection

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.

Delete Connection

curl -s -X DELETE "https://ctrl.maton.ai/connections/{connection_id}" -H "Authorization: Bearer $MATON_API_KEY"

Specifying Connection

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.

Admin API Reference

Accounts

GET /google-analytics-admin/v1beta/accounts
GET /google-analytics-admin/v1beta/accounts/{accountId}
GET /google-analytics-admin/v1beta/accountSummaries

Properties

GET /google-analytics-admin/v1beta/properties?filter=parent:accounts/{accountId}
GET /google-analytics-admin/v1beta/properties/{propertyId}

Create Property

POST /google-analytics-admin/v1beta/properties
Content-Type: application/json

{
  "parent": "accounts/{accountId}",
  "displayName": "My New Property",
  "timeZone": "America/Los_Angeles",
  "currencyCode": "USD"
}

Data Streams

GET /google-analytics-admin/v1beta/properties/{propertyId}/dataStreams

Create Web Data Stream

POST /google-analytics-admin/v1beta/properties/{propertyId}/dataStreams
Content-Type: application/json

{
  "type": "WEB_DATA_STREAM",
  "displayName": "My Website",
  "webStreamData": {"defaultUri": "https://example.com"}
}

Custom Dimensions

GET /google-analytics-admin/v1beta/properties/{propertyId}/customDimensions

Create Custom Dimension

POST /google-analytics-admin/v1beta/properties/{propertyId}/customDimensions
Content-Type: application/json

{
  "parameterName": "user_type",
  "displayName": "User Type",
  "scope": "USER"
}

Conversion Events

GET /google-analytics-admin/v1beta/properties/{propertyId}/conversionEvents
POST /google-analytics-admin/v1beta/properties/{propertyId}/conversionEvents

Data API Reference

Run Report

POST /google-analytics-data/v1beta/properties/{propertyId}:runReport
Content-Type: application/json

{
  "dateRanges": [{"startDate": "30daysAgo", "endDate": "today"}],
  "dimensions": [{"name": "city"}],
  "metrics": [{"name": "activeUsers"}]
}

Run Realtime Report

POST /google-analytics-data/v1beta/properties/{propertyId}:runRealtimeReport
Content-Type: application/json

{
  "dimensions": [{"name": "country"}],
  "metrics": [{"name": "activeUsers"}]
}

Batch Run Reports

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 Metadata

GET /google-analytics-data/v1beta/properties/{propertyId}/metadata

Common Report Examples

Page Views by Page

{
  "dateRanges": [{"startDate": "30daysAgo", "endDate": "today"}],
  "dimensions": [{"name": "pagePath"}],
  "metrics": [{"name": "screenPageViews"}],
  "orderBys": [{"metric": {"metricName": "screenPageViews"}, "desc": true}],
  "limit": 10
}

Users by Country

{
  "dateRanges": [{"startDate": "30daysAgo", "endDate": "today"}],
  "dimensions": [{"name": "country"}],
  "metrics": [{"name": "activeUsers"}, {"name": "sessions"}]
}

Traffic Sources

{
  "dateRanges": [{"startDate": "30daysAgo", "endDate": "today"}],
  "dimensions": [{"name": "sessionSource"}, {"name": "sessionMedium"}],
  "metrics": [{"name": "sessions"}, {"name": "conversions"}]
}

Common Dimensions

  • date, country, city, deviceCategory
  • pagePath, pageTitle, landingPage
  • sessionSource, sessionMedium, sessionCampaignName

Common Metrics

  • activeUsers, newUsers, sessions
  • screenPageViews, bounceRate, averageSessionDuration
  • conversions, eventCount

Date Formats

  • Relative: today, yesterday, 7daysAgo, 30daysAgo
  • Absolute: 2026-01-01

Code Examples

JavaScript

// 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' }]
    })
  }
);

Python

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'}]
    }
)

Notes

  • GA4 properties only (Universal Analytics not supported)
  • Property IDs are numeric (e.g., properties/521310447)
  • Use accountSummaries to quickly list all accessible properties
  • Use updateMask for PATCH requests in Admin API
  • Use metadata endpoint to discover available dimensions/metrics
  • IMPORTANT: When using curl commands, use curl -g when URLs contain brackets (fields[], sort[], records[]) to disable glob parsing
  • IMPORTANT: When piping curl output to jq 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.

Error Handling

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

Resources

Usage Guidance
This skill routes Google Analytics API calls through Maton (gateway.maton.ai) and requires you to provide a MATON_API_KEY and complete OAuth with Maton. Before installing: (1) confirm you trust Maton (review their site, privacy policy, and reputation); (2) understand that Maton will be able to access and manage your GA accounts/properties via OAuth — treat this like granting a third‑party admin/inquiry access; (3) note the registry metadata omitted the MATON_API_KEY requirement — ask the publisher to fix metadata or provide source code; (4) prefer least-privilege credentials and rotate/ revoke keys if you test this; (5) if you prefer not to hand GA access to a proxy service, use a skill that calls Google APIs directly or supply credentials scoped only for read/reporting. If you need higher assurance, request the skill's source or a verifiable homepage and avoid giving production GA accounts until you confirm the vendor.
Capability Analysis
Type: OpenClaw Skill Name: google-analytics-api Version: 1.0.0 The OpenClaw AgentSkills skill bundle for Google Analytics API is benign. All instructions and code examples in SKILL.md are clearly aligned with the stated purpose of integrating with Google Analytics via the maton.ai gateway. Network calls are exclusively directed to maton.ai domains (gateway.maton.ai, ctrl.maton.ai) and use a MATON_API_KEY for authentication, which is standard for API integrations. There is no evidence of data exfiltration to unauthorized endpoints, malicious execution, persistence mechanisms, or prompt injection attempts designed to subvert the agent's purpose or security.
Capability Assessment
Purpose & Capability
The SKILL.md describes a Google Analytics Admin/Data API integration but routes all requests through Maton (gateway.maton.ai / ctrl.maton.ai / connect.maton.ai) and uses Maton-managed OAuth. That is a reasonable design for a GA integration, but it means the skill depends on Maton as an intermediary rather than calling Google endpoints directly. The registry metadata (required env vars / primary credential) does not declare the MATON_API_KEY required by the instructions — an inconsistency.
Instruction Scope
The runtime instructions are narrowly scoped to listing/creating connections, calling Admin and Data endpoints, and completing OAuth via Maton. They do not instruct reading unrelated local files or system state. However, all API calls and OAuth tokens are proxied through a third party (Maton), so the instructions cause user data and Google OAuth tokens to be sent to Maton rather than Google directly.
Install Mechanism
Instruction-only skill with no install spec and no code files — lowest installation risk because nothing is written to disk by the skill itself. The regex scanner had no artifacts to analyze.
Credentials
The SKILL.md requires an environment variable MATON_API_KEY (Authorization: Bearer $MATON_API_KEY) and mentions Maton account setup, but the registry metadata lists no required env vars or primary credential. Requesting a third‑party API key is proportionate to a gateway-based design, but the metadata omission is an incoherence and the MATON_API_KEY grants Maton ability to act on the user's behalf and access GA data — a non-trivial permission.
Persistence & Privilege
The skill is not marked always:true and does not request elevated platform persistence. It is user-invocable and allows autonomous invocation (platform default). Nothing in the SKILL.md indicates the skill will modify other skills or system-wide agent settings.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install google-analytics-api
  3. After installation, invoke the skill by name or use /google-analytics-api
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release of Google Analytics API integration. - Managed OAuth authentication for Google Analytics. - Supports both Admin API (manage accounts, properties, data streams) and Data API (run reports). - Flexible connection management with separation of Admin and Data API connections. - Example queries and common report templates provided. - Requires valid Maton API key and network access.
Metadata
Slug google-analytics-api
Version 1.0.0
License
All-time Installs 6
Active Installs 6
Total Versions 1
Frequently Asked Questions

What is Google Analytics?

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). It is an AI Agent Skill for Claude Code / OpenClaw, with 1862 downloads so far.

How do I install Google Analytics?

Run "/install google-analytics-api" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Google Analytics free?

Yes, Google Analytics is completely free (open-source). You can download, install and use it at no cost.

Which platforms does Google Analytics support?

Google Analytics is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Google Analytics?

It is built and maintained by rich-song (@rich-song); the current version is v1.0.0.

💬 Comments