360 Secure SkillHub
360 安全技能中心

Google Analytics

该技能通过GA4 Data API对接谷歌分析,无需自行配置API,经OAuth安全认证。核心功能包括查询GA4账户、属性、受众及数据流,运行标准、实时、漏斗等多种报告,验证维度与指标兼容性,部分写操作需用户确认。典型场景为分析网站流量、对比营销活动表现、查看转化事件等,输入为ClawLink工具调用命令,输出对应GA4数据或操作结果。

hith3sh
hith3sh
热度 87.04
最近更新 2026-06-09 15:09:11
分类:数据依赖:MCP 服务 / 第三方 API应用场景:市场分析 / 报告撰写 / 数据处理

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add google-analytics-reporting
Metadata
name
google-analytics-reporting
description
Run GA4 reports, inspect properties, list audiences and data streams, and analyze traffic and conversion data via the Google Analytics Data API. Use this skill when users want to list account summaries and properties, run standard or realtime GA4 reports with chosen dimensions and metrics, inspect available fields and compatibility, list audiences, data streams and key events, compare traffic and campaign performance, or create key events after confirmation.

Google Analytics

Google Analytics

Access Google Analytics via the GA4 Data API with OAuth authentication. Run GA4 reports, inspect properties, list audiences and data streams, and analyze traffic and conversion data.

This skill uses ClawLink for hosted connection flows and credentials so you do not need to configure Google Analytics API access yourself.

Setup in 3 Steps

Step 1: Install Step 2: Pair Account Step 3: Connect Google Analytics
Install Pair App-specific connection GIF coming soon
Run the install command in OpenClaw Sign in and approve the device Open the dashboard and connect Google Analytics

How It Works

┌─────────────────┐     ┌──────────────┐     ┌──────────────────┐
│   OpenClaw      │────▶│   ClawLink   │────▶│  GA4 Data API    │
│   (User Chat)   │     │   (OAuth)    │     │   (REST)         │
└─────────────────┘     └──────────────┘     └──────────────────┘
         │                       │                       │
         │  1. Install Plugin    │                       │
         │  2. Pair Device       │                       │
         │  3. Connect Google Analytics                   │
         │                       │  4. Secure Token      │
         │                       │  5. Proxy Requests    │
         │                       │                       │
         ▼                       ▼                       ▼
   ┌──────────┐           ┌──────────┐           ┌──────────┐
   │  SKILL   │           │ Dashboard│           │ GA4      │
   │  File    │           │ Auth     │           │ Reports  │
   └──────────┘           └──────────┘           └──────────┘

Install

Install the verified ClawLink plugin from ClawHub. After the user confirms, complete the full setup so ClawLink tools are visible in the next OpenClaw chat.

openclaw plugins install clawhub:clawlink-plugin
openclaw config set tools.alsoAllow '["clawlink-plugin"]' --strict-json
openclaw gateway restart

Then tell the user: "OpenClaw has been restarted. Send /new as a standalone message to start a fresh chat, then ask for Google Analytics again."

Quick Start

# List accessible accounts and properties
clawlink_call_tool --tool "google_analytics_list_account_summaries" --params '{}'

# Run a basic GA4 report
clawlink_call_tool --tool "google_analytics_run_report" --params '{"property": "properties/123456789", "dimensions": [{"name": "country"}, {"name": "deviceCategory"}], "metrics": [{"name": "sessions"}, {"name": "totalRevenue"}]}'

# Run a realtime report
clawlink_call_tool --tool "google_analytics_run_realtime_report" --params '{"property": "properties/123456789", "dimensions": [{"name": "country"}], "metrics": [{"name": "activeUsers"}]}'

Authentication

All Google Analytics tool calls are authenticated automatically by ClawLink using the user's connected Google account.

No API key is required in chat. ClawLink stores the OAuth token securely and injects it into every GA4 API request on the user's behalf.

Getting Connected

  1. Install the ClawLink plugin (see Install above).
  2. Pair the plugin with clawlink_begin_pairing if it is not configured yet.
  3. Open https://claw-link.dev/dashboard?add=google-analytics and connect Google Analytics.
  4. Call clawlink_list_integrations to verify the connection is active.

Connection Management

List Connections

clawlink_list_integrations

Response: Returns all connected integrations. Look for google-analytics in the list.

Verify Connection

clawlink_list_tools --integration google-analytics

Response: Returns the live tool catalog for Google Analytics.

Reconnect

If Google Analytics tools are missing or the connection shows an error:

  1. Direct the user to https://claw-link.dev/dashboard?add=google-analytics
  2. After they confirm, call clawlink_list_integrations to verify
  3. Then call clawlink_list_tools --integration google-analytics

Security & Permissions

  • Access is scoped to GA4 properties accessible to the connected Google account.
  • All write operations require explicit user confirmation. Before executing any key event creation or property update, confirm the intended effect with the user.
  • Reports and analytics queries are read-only and do not modify account data.

Tool Reference

Account & Property Discovery

Tool Description Mode
google_analytics_list_account_summaries List all accessible accounts and properties Read
google_analytics_list_accounts_v1_beta List all Google Analytics accounts Read
google_analytics_list_properties_filtered List GA4 properties with filtering Read
google_analytics_get_property Get GA4 property details Read
google_analytics_get_account Get account details Read

Reporting

Tool Description Mode
google_analytics_run_report Run a customized GA4 data report Read
google_analytics_run_realtime_report Run a realtime report (last 30-60 min) Read
google_analytics_run_pivot_report Run a pivot table report Read
google_analytics_run_funnel_report Run a funnel analysis report Read
google_analytics_batch_run_reports Run multiple reports in one batch Read
google_analytics_check_compatibility Check dimension/metric compatibility Read

Metadata & Configuration

Tool Description Mode
google_analytics_get_metadata Get available dimensions, metrics, comparisons Read
google_analytics_get_property_quotas_snapshot Get API quota usage for a property Read
google_analytics_get_data_retention_settings Get data retention configuration Read
google_analytics_get_attribution_settings Get attribution model settings Read
google_analytics_get_google_signals_settings Get Google Signals configuration Read

Audiences & Data Streams

Tool Description Mode
google_analytics_list_audiences List configured audiences Read
google_analytics_get_audience Get audience configuration details Read
google_analytics_list_data_streams List data streams for a property Read
google_analytics_list_key_events List key events (conversions) Read
google_analytics_get_key_event Get key event details Read

Audience Lists

Tool Description Mode
google_analytics_create_audience_list Create an audience list snapshot Write
google_analytics_create_recurring_audience_list Create a recurring audience list Write
google_analytics_list_audience_lists List all audience lists Read
google_analytics_query_audience_list Query audience list results Read

Custom Definitions

Tool Description Mode
google_analytics_list_custom_dimensions List custom dimensions Read
google_analytics_create_custom_dimension Create a custom dimension Write
google_analytics_list_custom_metrics List custom metrics Read
google_analytics_create_custom_metric Create a custom metric Write

Property Management

Tool Description Mode
google_analytics_update_property Update property settings Write
google_analytics_create_rollup_property Create a roll-up property Write

Code Examples

Run a basic traffic report

clawlink_call_tool --tool "google_analytics_run_report" \
  --params '{
    "property": "properties/123456789",
    "dimensions": [{"name": "date"}, {"name": "country"}, {"name": "deviceCategory"}],
    "metrics": [{"name": "sessions"}, {"name": "totalUsers"}, {"name": "bounceRate"}],
    "dateRanges": [{"startDate": "30daysAgo", "endDate": "today"}]
  }'

Run a realtime report

clawlink_call_tool --tool "google_analytics_run_realtime_report" \
  --params '{
    "property": "properties/123456789",
    "dimensions": [{"name": "country"}, {"name": "city"}],
    "metrics": [{"name": "activeUsers"}]
  }'

List key events

clawlink_call_tool --tool "google_analytics_list_key_events" \
  --params '{
    "property": "properties/123456789"
  }'

Check dimension/metric compatibility

clawlink_call_tool --tool "google_analytics_check_compatibility" \
  --params '{
    "property": "properties/123456789",
    "dimensions": [{"name": "userAgeBracket"}, {"name": "sessionCampaignName"}],
    "metrics": [{"name": "sessions"}]
  }'

Discovery Workflow

  1. Call clawlink_list_integrations to confirm Google Analytics is connected.
  2. Call clawlink_list_tools --integration google-analytics to see the live catalog.
  3. Treat the returned list as the source of truth. Do not guess or assume what tools exist.
  4. If the user describes a capability but the exact tool is unclear, call clawlink_search_tools with a short query and integration google-analytics.
  5. If no Google Analytics tools appear, direct the user to https://claw-link.dev/dashboard?add=google-analytics.

Execution Workflow

┌─────────────────────────────────────────────────────────────┐
│  READ OPERATIONS (Safe)                                     │
│  list → get → run_report → check_compatibility              │
│                                                             │
│  Example: List properties → Run report → Show results       │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│  WRITE OPERATIONS (Require Confirmation)                    │
│  describe → preview → confirm → create/update               │
│                                                             │
│  Example: Preview key event creation → User confirms        │
│           → Execute create                                   │
└─────────────────────────────────────────────────────────────┘
  1. For unfamiliar tools, ambiguous requests, or any write action, call clawlink_describe_tool first.
  2. Use the returned guidance, schema, whenToUse, askBefore, safeDefaults, examples, and followups to shape the call.
  3. Prefer listing accounts, properties, metadata, compatibility, and read-only reports before writes.
  4. For key event creation, property updates, or anything marked as requiring confirmation, call clawlink_preview_tool first, then confirm with the user.
  5. Execute with clawlink_call_tool. Pass confirmation only after the preview matches the user's intent.
  6. If the tool call fails, report the real error. Do not invent results or restate the failure as a missing capability unless the live catalog supports that conclusion.

Notes

  • GA4 property IDs use format properties/123456789 in API calls.
  • Dimension and metric names in GAQL use camelCase (e.g., date, sessionCampaignName, totalUsers).
  • GA4 Data API has strict dimension/metric compatibility rules. Not all combinations are valid. Use check_compatibility to validate before running complex reports.
  • Realtime data covers the last 30-60 minutes and may not be available for all custom dimensions.
  • Key events (conversions) are read-only via API — creation and deletion require the Google Analytics UI.

Error Handling

Status / Error Meaning
Tool not found The tool name does not exist in the current catalog. Verify with clawlink_list_tools --integration google-analytics.
Missing connection Google Analytics is not connected. Direct the user to https://claw-link.dev/dashboard?add=google-analytics.
400 INVALID_ARGUMENT Incompatible dimension/metric combination. Use check_compatibility to validate.
403 Forbidden Insufficient OAuth scopes or permissions.
Write rejected User did not confirm a write action. Always confirm before executing writes.

Troubleshooting: Tools Not Visible

  1. Check that the ClawLink plugin is installed:
    openclaw plugins list
    
  2. If the plugin is installed but tools are missing, tell the user to send /new as a standalone message to reload the catalog.
  3. If a fresh chat does not help, run:
    openclaw config set tools.alsoAllow '["clawlink-plugin"]' --strict-json
    openclaw gateway restart
    
  4. After restart, tell the user to send /new again and retry.

Troubleshooting: Invalid Tool Call

  1. Ensure the integration slug is exactly google-analytics.
  2. Use clawlink_describe_tool to verify parameter names and types before calling.
  3. For write operations, always call clawlink_preview_tool first.

Resources


Powered by ClawLink — an integration hub for OpenClaw

ClawLink Logo