AI agent for BigQuery: marketing spend and first-party revenue analysis
The agent reads from BigQuery — running SQL it writes itself from a plain-language question — so you can join Google Ads or DV360 spend with your own Google Analytics, CRM or revenue tables and compute estimated ROAS from numbers you trust, not platform-reported conversions. Reads are ungated: the agent queries whatever project and dataset you select in the context picker. One approval-gated write tool exists (mutate_query) for a CREATE / INSERT / UPDATE / DELETE you explicitly approve after seeing the SQL; it is not exposed over MCP or to the autonomous loop.
- Availability
- Available
- Connection method
- Provider sign-in (OAuth)
How can an AI agent use BigQuery for marketing analysis?
Agent Planners can query authorized BigQuery tables to reconcile campaign spend with first-party revenue. Specify the datasets, time zone, refund treatment and campaign join keys. Ask for unmatched rows before calculating return on ad spend. The result depends on the data and attribution rules you supply.
Connect BigQuery and check permissions
- 1Open Integrations and click Connect on the BigQuery card.
- 2Sign in with a Google account that can read the project.
- 3Name the dataset in your goal; the agent writes its own SQL against it.
bigquery.readonly plus two project-listing scopes. Read-only by construction: there is no scope here that could write a table. A first goal worth typing: Join last quarter of ad cost with my orders table and give me estimated ROAS per campaign, with unmatched orders shown separately, refunds netted out.What the agent does with BigQuery
- Writes and runs SQL against your chosen project/dataset from a plain-language question.
- Joins ad-platform cost data (Google Ads, DV360) with your own Google Analytics, CRM or order tables for true, margin-aware ROAS.
- Hands off to the Python sandbox for anything SQL can't express cleanly — cohort/LTV math, custom charts.
Example tasks for BigQuery
| Goal you'd type | What the agent does |
|---|---|
| "Join last month's Google Ads cost with our Shopify order revenue and give me estimated ROAS per campaign, with unmatched orders shown separately." | Writes the SQL join keyed on campaign/date/order id and returns per-campaign profit-aware ROAS. |
| "What's the 90-day repeat-purchase rate for customers who came from paid search vs. organic?" | Queries your CRM/orders tables joined with attribution data and computes the cohort comparison. |
| "Pull a custom report: spend, impressions and margin by DV360 line item for Q2." | Runs the SQL directly against whatever tables hold that data in your warehouse. |
Guardrails
- Reads run ungated. Exactly one write tool exists (mutate_query, for CREATE / INSERT / UPDATE / DELETE), and every real statement pauses for a person, who reads the SQL, in a task and over MCP (unless an admin set that API key to apply such changes, or the connection is the workspace's own app); dryRun:true validates and sends nothing. Autonomous runs do not have this tool.
- Scoped to the project/dataset you select in the context picker; it doesn't discover or query tables outside that scope.
Frequently asked questions
- Can the agent write to my BigQuery tables?
- Only through one approval-gated tool. Reads run freely; a CREATE / INSERT / UPDATE / DELETE (mutate_query) is drafted, shown to you with the exact SQL, and runs only after you approve it, over MCP too. Autonomous runs do not have this tool. The standard connection is read-only (BigQuery's read-only scope); the full BigQuery scope that an approved write needs is a separate upgrade you choose, and without it a write cannot run.
- Do I need to know SQL to use this?
- No — describe the question in plain language and the agent writes the SQL. If you already know exactly what query you want, you can also just ask for that directly.
- How is this different from just trusting Google Ads' reported conversions?
- Platform-reported conversions use the platform's own attribution and can miss refunds or offline revenue. Joining spend with your own warehouse data gives you a ROAS number built from what actually happened.