Logo vun Google Analytics

Google Analytics

Communautéit
danicat
google-analytics

Collect and analyze Google Analytics 4 (GA4) website data in a local SQLite database. Stores pageviews, active users, reading dwell time, traffic sources, and outbound clicks so you can run SQL queries or view reports on site performance. Activate when analyzing website traffic, measuring reader engagement and dwell time, evaluating the impact of site updates or milestones, or querying Google Analytics with SQL.

Iwwersiicht

Editeurdanicat
Repositoryskills
Skill-Nummgoogle-analytics
Stären
24
Forks
4
Matgeliwwert Fichieren
5
LizenzApache-2.0
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 5 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    Vum danicat op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Google Analytics an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/danicat/skills/tree/main/analytics/google-analytics
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

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/google-analytics .claude/skills/google-analytics
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Google Analytics an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Google Analytics automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Google Analytics net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Google Analytics 4 SQLite Ingestion & SQL Analytics

The google-analytics skill ingests Google Analytics 4 (GA4) traffic, reading depth, acquisition channels, event streams, and outbound clicks into a local SQLite analytics database (google_analytics.db or $XDG_DATA_HOME/google-analytics/analytics.db) without data loss, preserving raw JSON payloads on all records, and providing a fast SQL interface for website analytics.

Available scripts

  • scripts/google_analytics.py: Automated sync, reporting, and annotation CLI for Google Analytics 4. Executed via uv run scripts/google_analytics.py (requires Google Cloud ADC or OAuth credentials).
  • scripts/test_google_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 CLI script:

bash
# 1. Authorize OAuth 2.0 (with analytics.edit & readonly scopes)
uv run scripts/google_analytics.py auth --port 8080

# 2. Discover accessible GA4 properties
uv run scripts/google_analytics.py properties

# 3. Create Deployment / Milestone Annotation (Cloud API + Local SQLite)
uv run scripts/google_analytics.py annotate \
  --title "Major Release / Architecture Overhaul" \
  --date 2026-08-18 \
  --commit abc1234 \
  --description "Milestone description and release context."

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

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

# 6. Run Pre-Built Reports
uv run scripts/google_analytics.py report overview --db path/to/database.db
uv run scripts/google_analytics.py report top-pages --db path/to/database.db
uv run scripts/google_analytics.py report channels --db path/to/database.db
uv run scripts/google_analytics.py report geo --db path/to/database.db
uv run scripts/google_analytics.py report events --db path/to/database.db
uv run scripts/google_analytics.py report outbound --db path/to/database.db
uv run scripts/google_analytics.py report milestone-impact --db path/to/database.db

# 7. Execute Ad-Hoc SQL Query
uv run scripts/google_analytics.py query "SELECT page_path, total_views, total_users, avg_dwell_sec, avg_bounce_pct FROM v_page_performance LIMIT 10" --db path/to/database.db

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


🗄️ Database Schema & Relational Structure

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

Tables

  1. daily_pages: Granular daily page metrics by URL, country, device, and traffic source.
    • Key columns: id (PK), property_id, date, page_path, page_title, country, device_category, source_medium, screen_page_views, active_users, sessions, user_engagement_duration, bounce_rate, raw_json, synced_at.
  2. daily_traffic: Acquisition channels and source/medium pairs.
    • Key columns: id (PK), property_id, date, session_source_medium, session_default_channel_group, country, device_category, sessions, active_users, new_users, engaged_sessions, user_engagement_duration, bounce_rate, raw_json, synced_at.
  3. daily_events: User interaction event stream (scroll, click, first_visit, user_engagement, page_view).
    • Key columns: id (PK), property_id, date, event_name, page_path, country, device_category, event_count, total_users, raw_json, synced_at.
  4. outbound_clicks: External link exit destinations and click counts.
    • Key columns: id (PK), property_id, date, link_url, page_path, country, event_count, total_users, raw_json, synced_at.
  5. properties: Verified GA4 property metadata, timezone, and settings.
    • Key columns: property_id (PK), name, account_id, display_name, industry_category, time_zone, currency_code, service_level, raw_json, last_synced_at.
  6. site_milestones: Release milestones and publication events.
    • Key columns: commit_hash (PK), event_date, title, description, category, scope, author, created_at.
  7. sync_history: Audit log of sync executions and row counts.
    • Key columns: id (PK), property_id, sync_type, start_date, end_date, pages_synced, traffic_synced, events_synced, outbound_synced, status, error_message, started_at, finished_at.

📊 Analytical SQL Views

View NameDescriptionKey Columns
v_daily_summaryDaily aggregated traffic metricsdate, total_sessions, total_active_users, total_page_views, total_engagement_min, avg_bounce_pct
v_page_performancePage rollup with views, active users, dwell time, and bounce ratepage_path, page_title, total_views, total_users, total_sessions, avg_dwell_sec, total_dwell_min, avg_bounce_pct
v_channel_performanceAcquisition channel breakdownchannel_group, source_medium, total_sessions, total_users, total_new_users, total_engaged_sessions, engagement_rate_pct, avg_dwell_sec, engaged_dwell_sec, total_dwell_min, avg_bounce_pct
v_geo_breakdownCountry traffic and dwell timecountry, total_sessions, total_users, total_page_views, avg_dwell_sec, avg_bounce_pct
v_events_summaryAggregate event countsevent_name, total_events, total_users
v_outbound_linksOutbound destination rankingslink_url, total_clicks, total_users, referring_pages_count
v_milestone_impactPre vs. Post milestone comparisonmilestone_title, milestone_date, cohort, days_tracked, total_views, total_users, total_sessions, avg_engagement_sec, avg_bounce_pct

🔍 SQL Analytics Recipes

Pre-tested SQL query recipes are documented in references/queries.md.

1. Top Landing Pages by Active Dwell Time

sql
SELECT
    page_path,
    page_title,
    total_views,
    total_users,
    avg_dwell_sec || 's' AS avg_dwell,
    total_dwell_min || 'm' AS total_dwell,
    avg_bounce_pct || '%' AS bounce_pct
FROM v_page_performance
ORDER BY total_dwell_min DESC
LIMIT 15;

2. Category / Subdirectory Rollup

sql
SELECT
    CASE
        WHEN page_path LIKE '/docs/%' THEN 'Docs'
        WHEN page_path LIKE '/blog/%' THEN 'Blog'
        WHEN page_path = '/' THEN 'Homepage'
        ELSE 'Other'
    END AS category,
    COUNT(DISTINCT page_path) AS page_count,
    SUM(total_views) AS total_views,
    SUM(total_users) AS total_users,
    ROUND(SUM(total_dwell_min), 1) AS total_dwell_min
FROM v_page_performance
GROUP BY category
ORDER BY total_views DESC;

🧭 Analytical Guardrails & Engagement Methodology

When analyzing GA4 metrics, apply these four structural checks to avoid misinterpreting raw totals:

  1. Two-Stage Engagement Decomposition (avg_dwell_sec vs. engaged_dwell_sec + Interaction Density):
    • GA4 calculates user_engagement_duration as the elapsed time between session_start and the final engagement event. Single-page visits that exit without firing a follow-up event record 0s duration.
    • Always report Engaged Session Dwell (engaged_dwell_sec) alongside raw session dwell (avg_dwell_sec), and pair time metrics with Interaction Density (scroll completion and outbound_clicks per user) using Recipe #11 in references/queries.md.
  2. Unengaged Direct Anomaly Gate (Bot & Scraper Filtering):
    • Headless crawlers, link previewers, and cloud monitors typically omit the HTTP Referer header (landing in Direct) and exit before firing a second event (<2s dwell and <15% engagement rate).
    • Before reporting site-wide dwell or bounce averages, inspect Direct traffic for localized (month, country, device_category) spikes with near-zero engagement (Recipe #9 in references/queries.md) and segment human discovery metrics separately from unengaged Direct spikes.
  3. Generative Search Channel Split (Organic vs. AI Assistants vs. Social):
    • GA4's built-in session_default_channel_group groups AI assistants (chatgpt.com, perplexity.ai, claude.ai, gemini.google.com, copilot.microsoft.com) into generic Referral or Organic Search.
    • Use session_source_medium pattern matching (Recipe #8 in references/queries.md) to separate Generative AI, Organic Search, Social Referrals, and Web Referrals.
  4. Custom Telemetry Discovery Gate (daily_events Inventory):
    • Standard page views (v_page_performance) query only daily_pages. Any custom instrumentation (such as scroll_25, scroll_50, scroll_75, code_copy, or form_submit) lands in daily_events.
    • Always run an event inventory query (WHERE event_name NOT IN ('page_view', 'user_engagement', 'session_start', 'first_visit'), Recipe #10 in references/queries.md) before concluding page-level analysis so custom events are joined into your findings.

⚠️ Cross-Tool Alignment: GA4 Organic Search vs. Search Console Property Totals

When cross-referencing GA4 acquisition metrics with Google Search Console data:

  1. Multi-Engine Organic Reach: GA4 Organic Search aggregates landing sessions and active users across all search engines (Google Search, Bing, DuckDuckGo, Ecosia, Yahoo, AI search engines). Search Console exclusively measures Google Search impressions and clicks.
  2. Session Arrivals vs. SERP Clicks: GA4 tracks 100% of landing sessions without query-level privacy truncation. In contrast, Search Console API keyword exports filter out "anonymized queries".
  3. Property-Level Reconciliation: For organic traffic reporting, GA4 v_channel_performance (filtering for channel_group = 'Organic Search') naturally aligns with Search Console property-level totals (Google Search Console property-level totals and GSC Web UI Performance cards), while Search Console's search_performance table provides the granular ranking breakdown for identifiable keywords.

📚 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 reading depth, acquisition channels, and exit destinations.
  • Authentication Guide: references/setup_auth.md — Google Cloud ADC login, API enablement, and GA4 property permissions.

Matgeliwwert Fichieren

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Google Analytics?

Collect and analyze Google Analytics 4 (GA4) website data in a local SQLite database. Stores pageviews, active users, reading dwell time, traffic sources, and outbound clicks so you can run SQL queries or view reports on site performance. Activate when analyzing website traffic, measuring reader engagement and dwell time, evaluating the impact of site updates or milestones, or querying Google Analytics with SQL.

Firwat Google Analytics op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Google Analytics besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Google Analytics an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/danicat/skills/tree/main/analytics/google-analytics an. TypingMind liest d'Datei SKILL.md, bündelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Google Analytics benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Google Analytics benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Google Analytics domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Google Analytics gratis?

Jo. De Skill gëtt vum danicat ënner der Lizenz Apache-2.0 op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇