← 返回
数据分析 Key 中文

GA4 Analytics

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...
通过 Analytics Data API 查询 Google Analytics 4 (GA4) 数据。适用于获取热门页面、流量来源、用户数、会话数等网站分析数据。
jdrhyne
数据分析 clawhub v1.2.2 1 版本 99861.3 Key: 需要
★ 1
Stars
📥 4,299
下载
💾 142
安装
1
版本
#latest

概述

GA4 - Google Analytics 4 Data API

Query GA4 properties for analytics data: page views, sessions, users, traffic sources, conversions, and more.

Setup (one-time)

  1. Enable Google Analytics Data API: https://console.cloud.google.com/apis/library/analyticsdata.googleapis.com
  2. Create OAuth credentials or use existing Google Cloud project
  3. Set environment variables:
    • GA4_PROPERTY_ID - Your GA4 property ID (numeric, e.g., "123456789")
    • GOOGLE_CLIENT_ID - OAuth client ID
    • GOOGLE_CLIENT_SECRET - OAuth client secret
    • GOOGLE_REFRESH_TOKEN - OAuth refresh token (from initial auth flow)

Safety Boundaries

  • This skill only connects to Google Analytics Data API endpoints.
  • It does NOT write to or modify your GA4 property — read-only queries only.
  • It does NOT store or transmit credentials beyond the current session.
  • It requires OAuth credentials (client ID, secret, refresh token) set as environment variables.
  • Common Queries

Top Pages (by pageviews)

python3 scripts/ga4_query.py --metric screenPageViews --dimension pagePath --limit 30

Top Pages with Sessions & Users

python3 scripts/ga4_query.py --metrics screenPageViews,sessions,totalUsers --dimension pagePath --limit 20

Traffic Sources

python3 scripts/ga4_query.py --metric sessions --dimension sessionSource --limit 20

Landing Pages

python3 scripts/ga4_query.py --metric sessions --dimension landingPage --limit 30

Custom Date Range

python3 scripts/ga4_query.py --metric sessions --dimension pagePath --start 2026-01-01 --end 2026-01-15

Filter by Page Path

python3 scripts/ga4_query.py --metric screenPageViews --dimension pagePath --filter "pagePath=~/blog/"

Available Metrics

Common metrics: screenPageViews, sessions, totalUsers, newUsers, activeUsers, bounceRate, averageSessionDuration, conversions, eventCount

Available Dimensions

Common dimensions: pagePath, pageTitle, landingPage, sessionSource, sessionMedium, sessionCampaignName, country, city, deviceCategory, browser, date

Output Formats

Default: Table format

Add --json for JSON output

Add --csv for CSV output

版本历史

共 1 个版本

  • v1.2.2 当前
    2026-03-28 10:19 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

data-analysis

A股量化 AkShare

mbpz
A股量化数据分析工具,基于AkShare库获取A股行情、财务数据、板块信息等。用于回答关于A股股票查询、行情数据、财务分析、选股等问题。
★ 165 📥 60,086
productivity

TODO Tracker

jdrhyne
用于跨会话跟踪任务的持久化待办暂存区。当用户说“add to TODO”、“what's on the TODO”、“mark X done”、“show TODO list”、“remove from TODO”或询问待处理任务时使用。亦
★ 1 📥 9,174
data-analysis

Data Analysis

ivangdavila
{"answer":"数据分析与可视化。查询数据库、生成报告、自动化电子表格,将原始数据转化为清晰可行的见解。适用于:(1) 您……"}
★ 198 📥 65,167