AI-Powered GA4 Client Dashboards
Without BigQuery Complexity

Empower your clients with standard monthly reporting and real-time AI Chat & Claude MCP queries—using Google's Open Knowledge Format (OKF) directly over the GA4 Data API.

Why This Architecture Works

A modern, lightweight approach to client analytics that gives AI agents true business context.

Direct GA4 Data API

No need to set up complex, expensive BigQuery data streaming pipelines. We query Google's official ga_run_report API on-demand for fast, aggregated answers.

🧠

OKF Context Overlay

Open Knowledge Format provides a clean Markdown + YAML semantic blueprint. The AI agent instantly knows how your business defines "Leads", "AI Referrals", and key metrics.

💬

Chat & MCP Ready

Clients can view standard monthly dashboard cards or ask custom questions directly via an interactive web chat or connect via Claude Desktop MCP.

How It Works Step-by-Step

How a client prompt turns into an accurate, context-aware GA4 answer.

1

Client Asks Question

Client types a prompt in Web Chat or Claude Desktop (e.g. "How did AI referral traffic perform in June?").

2

Agent Traverses OKF

Agent inspects okf/rules/ai_referrals.md to learn which referrer domains (ChatGPT, Perplexity, Claude) to filter.

3

Queries GA4 API

Agent sends a precise, valid JSON request to ga_run_report for the client's GA4 Property ID.

4

Renders Answer

Live JSON results are formatted into human-readable insights and interactive dashboard cards.

Interactive AI Query Playground

Click a sample prompt below to simulate how the OKF Knowledge Bundle guides the AI Agent.

⚙️ OKF + GA4 Data API Query Simulator
Live Preview
Select a Client Prompt
Loaded: okf/business_rules/ai_referrals.md
Loading simulation...

Frequently Asked Questions

Everything you need to know about implementing OKF with GA4.

Do we need BigQuery to use OKF with GA4?
No! While Google's initial sample code used BigQuery to demonstrate automated schema extraction, OKF is completely storage-agnostic. Pairing OKF directly with the GA4 Data API (ga_run_report) is much simpler, cheaper, and faster for standard reporting and Q&A.
Why use OKF instead of hardcoding rules in Python code?
OKF stores business rules in clean Markdown + YAML files in Git. This means you can update client event mappings, AI domain lists, or metric definitions in seconds without re-deploying web servers or writing complex if/else code blocks. Plus, LLMs read Markdown natively far better than code variables!
What data is gathered and is it overwritten next month?
Your server doesn't hold or overwrite raw files. Google holds the analytics data in GA4. Whenever a client views a report or asks a question, your app requests a live JSON snapshot for that specific date range via the GA4 API. You can cache monthly snapshots in a database so historical reports load instantly.
Can we track referrals from AI search engines & assistants?
Yes! Browsers send referrer headers when users click links in ChatGPT, Perplexity, Claude, Gemini, or Copilot. By defining an OKF rule for sessionSource matching these domains, the AI agent can track traffic, landing pages, and conversion rates specifically originating from AI assistants.