Search Analytics logo

Search Analytics

Community
danicat
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.

Overview

Publisherdanicat
Repositoryskills
Skill namesearch-analytics
Stars
24
Forks
4
Bundled files
5
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 5 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by danicat on GitHub. Read the source before you install it.

Installation

Install the Search Analytics AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/danicat/skills/tree/main/analytics/search-analytics
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/danicat/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/analytics/search-analytics .claude/skills/search-analytics
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Search Analytics in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Search Analytics on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Search Analytics is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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:

bash
# 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.

1. High-Opportunity Search Queries (Rank 1-10, Low CTR)

sql
SELECT
    query,
    page,
    ROUND(SUM(impressions), 0) AS imps,
    ROUND(SUM(clicks), 0) AS clks,
    ROUND((SUM(clicks)/SUM(impressions))*100, 2) AS ctr_pct,
    ROUND(AVG(position), 1) AS avg_rank
FROM search_performance
WHERE position <= 10
GROUP BY query, page
HAVING SUM(impressions) >= 500 AND ctr_pct < 3.0
ORDER BY imps DESC
LIMIT 15;

2. Keyword Cannibalization Detection

sql
SELECT
    query,
    COUNT(DISTINCT page) AS competing_pages,
    GROUP_CONCAT(DISTINCT page) AS pages,
    ROUND(SUM(clicks), 0) AS total_clicks,
    ROUND(SUM(impressions), 0) AS total_impressions
FROM search_performance
WHERE query != ''
GROUP BY query
HAVING COUNT(DISTINCT page) > 1
ORDER BY total_impressions DESC
LIMIT 10;

⚠️ Critical Architecture: Property-Level Totals vs. Keyword-Level Breakdown

When querying and analyzing Search Console data, note the two distinct API behaviors and database tables:

  1. Unfiltered Property-Level Totals (daily_site_performance):
    • Querying the GSC API with dimensions: ['date'] (and aggregationType: 'byProperty') returns 100% of property search traffic, including all rare and long-tail queries.
    • This data is ingested into daily_site_performance and powers v_daily_summary. It directly matches the Search Console Web UI Performance graphs, Total Clicks cards, and 28-day Achievement badges (e.g. 700 clicks in 28 days).
  2. Granular Keyword-Level Breakdown (search_performance):
    • When querying the GSC API with dimensions: ['query', 'page', 'country', 'device'], Google automatically applies anonymized query filtering to protect searcher privacy, stripping out rare/unique queries.
    • On technical and developer blogs, long-tail anonymized queries often represent 50%–70% of total search traffic. Therefore, search_performance should be used for keyword rankings and page distributions, while daily_site_performance (or v_daily_summary) must be used for aggregate traffic totals.
  3. Cross-Engine Reconciliation with Google Analytics 4:
    • GA4 records landing sessions under session_default_channel_group = 'Organic Search' across all search engines (Google, Bing, DuckDuckGo, etc.) without privacy filtering.
    • GA4 Organic Search traffic naturally aligns with Search Console property-level totals (daily_site_performance), rather than the query-filtered search_performance table.

📚 Progressive Disclosure & References

  • Full DDL Schema Reference: references/schema.md — Complete SQL table definitions, column types, constraints, and views.
  • SQL Query Cookbook: references/queries.md — Tested SQL recipes for CTR decay curves, keyword cannibalization, and MoM trends.
  • OAuth Setup Guide: references/setup_oauth.md — Step-by-step GCP project, API enablement, and credential setup.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Search Analytics AI skill do?

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.

Why use Search Analytics on TypingMind?

Because you install it once and use it with any model. Search Analytics is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Search Analytics in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/danicat/skills/tree/main/analytics/search-analytics. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Search Analytics?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Search Analytics?

As many as you like. As long as a model supports skills, you can use Search Analytics with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Search Analytics AI skill free?

Yes. It is published on GitHub by danicat under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇