跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
数据与分析

search-analytics

Collect and analyze Google Search Console organic search data in a local SQLite database. Stores clicks, impressions, click-through rates (CTR), average ranking positions, and landing pages so you can run SQL queries or view performance reports. Activate when analyzing Google Search traffic, tracking keyword rankings, finding SEO content optimization opportunities, or querying Search Console data with SQL.

danicat · 已有 AI 审核记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add danicat/skills --skill search-analytics

技能说明


name: search-analytics description: > Collect and analyze Google Search Console organic search data in a local SQLite database. Stores clicks, impressions, click-through rates (CTR), average ranking positions, and landing pages so you can run SQL queries or view performance reports. Activate when analyzing Google Search traffic, tracking keyword rankings, finding SEO content optimization opportunities, or querying Search Console data with SQL. license: Apache-2.0 metadata: category: analytics tags: "google-search, analytics, seo, geo, optimization" author: Daniela Petruzalek (daniela@danicat.dev) version: "0.2.0" catalog: https://skills.danicat.dev

Google Search Console SQLite Ingestion & SQL Analytics

The search-analytics skill ingests Google Search Console performance metrics into a local SQLite analytics database (search_analytics.db or $XDG_DATA_HOME/search-analytics/analytics.db) without data loss, preserving all raw JSON payloads, handling API quotas via 25,000 batch chunks, and providing direct SQL querying over indexed search traffic.

Available scripts

  • scripts/search_analytics.py: Automated sync, reporting, and OAuth CLI for Google Search Console. Executed via uv run scripts/search_analytics.py (requires Google Cloud OAuth credentials).
  • scripts/test_search_analytics.py: Unit and regression test suite validating schema, query extraction, and CLI flags.

⚡ Quick Start & Primary Actions

All operations are driven via the bundled Python script in scripts/search_analytics.py:

# 1. Authenticate with Google OAuth 2.0
uv run scripts/search_analytics.py auth --port 8080

# 2. Incremental Sync (Updates newest days + 3-day latency overlap)
uv run scripts/search_analytics.py sync --db path/to/database.db

# 3. Full Historical Backfill (Ingests up to 16 months of granular daily data)
uv run scripts/search_analytics.py sync --full --db path/to/database.db

# 4. Run Pre-Built SQL Reports
uv run scripts/search_analytics.py report overview --db path/to/database.db
uv run scripts/search_analytics.py report top-queries --db path/to/database.db
uv run scripts/search_analytics.py report top-pages --db path/to/database.db
uv run scripts/search_analytics.py report countries --db path/to/database.db
uv run scripts/search_analytics.py report devices --db path/to/database.db
uv run scripts/search_analytics.py report timing --db path/to/database.db
uv run scripts/search_analytics.py report milestone-impact --db path/to/database.db

# 5. Run Ad-Hoc SQL Query
uv run scripts/search_analytics.py query "SELECT query, SUM(clicks), SUM(impressions) FROM search_performance GROUP BY query ORDER BY SUM(clicks) DESC LIMIT 10" --db path/to/database.db

If --db is omitted, the script defaults to search_analytics.db in the current working directory.


🗄️ Database Schema & Relational Structure

The database maintains 6 relational tables and 7 high-performance analytical views. Detailed DDL and schema definitions are in references/schema.md.

Tables

  1. daily_site_performance: Unfiltered property-level daily totals (dimensions: ['date']). Matches 100% of property clicks/impressions in the Search Console web interface and 28-day Achievement badges.
    • Key columns: id (PK), site_url, date, search_type, clicks, impressions, ctr, position, raw_json, synced_at.
  2. search_performance: Granular keyword-level performance partitioned by query, page, country, and device.
    • Key columns: id (PK), site_url, date, query, page, country, device, search_appearance, search_type, clicks, impressions, ctr, position, raw_json, synced_at.
  3. properties: Verified Search Console web properties.
    • Key columns: site_url (PK), permission_level, raw_json, synced_at.
  4. sitemaps: Submitted XML sitemaps, error counts, and indexed URL counts.
    • Key columns: site_url, path (PK), type, last_downloaded, last_submitted, errors, warnings, indexed_count, raw_json, synced_at.
  5. site_milestones: Release milestones and publication launches for cohort impact analysis.
    • Key columns: commit_hash (PK), event_date, title, description, category, scope, author, created_at.
  6. sync_history: Audit log of backfill and incremental sync operations.
    • Key columns: id (PK), site_url, sync_type, start_date, end_date, rows_synced, status, error_message, started_at, completed_at.

📊 Analytical SQL Views

View NameDescriptionKey Columns
v_search_performanceGranular performance with computed calendar dimensionsdate, year_month, day_of_week, query, page, country, device, clicks, impressions, ctr_pct, avg_position
v_daily_summaryDaily aggregated traffic metrics per sitedate, distinct_queries, distinct_pages, total_clicks, total_impressions, avg_ctr_pct, avg_position
v_top_queriesAggregated search term rankings & click sharequery, active_days, total_clicks, total_impressions, avg_ctr_pct, avg_position
v_top_pagesAggregated landing page performance & query breadthpage, ranking_queries, active_days, total_clicks, total_impressions, avg_ctr_pct, avg_position
v_country_breakdownGeographic traffic distributioncountry, total_clicks, total_impressions, avg_ctr_pct, avg_position
v_device_breakdownDesktop vs. Mobile vs. Tablet comparisondevice, total_clicks, total_impressions, avg_ctr_pct, avg_position
v_milestone_impactPre vs. Post milestone search traffic cohort impactmilestone_title, milestone_date, cohort, days_tracked, total_clicks, total_impressions, avg_ctr_pct

🔍 Common SQL Analytics Recipes

Pre-tested SQL query recipes are documented in [references/queries.md](referenc

阅读完整来源 ↗