Agent context
Google Analytics 4 models
6 SQL models that turn the raw Google Analytics 4 tables into the reports people ask about. Deploy them in Weld and your agent queries the definitions behind every number.
How the set is built
- 5Raw tables
- 6Core
- 6Analytics
Staging cleans each raw table once, core holds the logic, and analytics is the table dashboards and agents read.
- Account ReportThis SQL template generates a comprehensive account report by aggregating user statistics, campaign performance, and event data from Google Analytics. It combines these metrics to provide insights on total users, new users, sessions, user engagement, campaign details, and event revenue for each day. The results are ordered by date in descending order.grain: day x property x campaign · 3 raw tables
- User Activity OverviewThis SQL template aggregates monthly user activity data from Google Analytics, including total users, new users, sessions, average sessions per user, screen page views, and user engagement duration.grain: month x property · 1 raw table
- Campaign ReportThis SQL template generates a monthly summary report of campaign performance metrics from Google Analytics data. It aggregates data such as total users, sessions, engaged sessions, events per session, engagement rate, event count, conversions, total revenue, and user engagement duration. The results are ordered by period and total users in descending order.1 raw table
- Channel Traffic OverviewThis SQL template provides a monthly overview of channel traffic from Google Analytics, summarizing metrics such as total users, sessions, engaged sessions, events per session, engagement rate, event count, conversions, total revenue, and user engagement duration, grouped by channel.1 raw table
- Event PerformanceThis SQL template aggregates Google Analytics event data by month, summarizing event counts, user counts, average events per user, and total revenue for each event. It groups the data by period and event name, then orders the results by event count in descending order.1 raw table
- Page Path AnalysisThis SQL template aggregates Google Analytics data to provide a monthly overview of page paths, including metrics such as screen page views, total users, new users, event count, conversions, total revenue, and user engagement duration, grouped by traffic source.grain: month x property x page path · 1 raw table
- Weld or dbt
- The same SQL in both dialects. Sync the folder with GitHub Sync, or copy the dbt models into your project.
- Check before you rely on it
- Reconcile a month against Google Analytics 4's own reports first. Each model's notes say what the synced data can and can't support.
Connect Google Analytics 4.
Your agents start with context.
Sync Google Analytics 4 to your warehouse, deploy these models, and query them from Claude, Cursor or ChatGPT over MCP. Free for 14 days, no credit card.