Data to AI™ / Gemini/Google Analytics 4

Query GA4 from Gemini CLI and Gemini Code Assist

Pull GA4 channels, campaigns, events and revenue into the terminal or VS Code, save them as files next to your code, and check each release against real traffic.

Better answers, fewer tokens.

  • Lower AI costs for the same work
  • More accurate, reliable answers
  • Read-only
  • Uses the Google Analytics 4 data you already sync
  • SOC 2 Type II certified
Gemini CLI
Connected to Dataddo

Which channel brought the most key events for its traffic last month?

Gemini Answer · Google Analytics 4

Organic Search brought the most Key Events, 1,446. Email converted best, with 7 key events per 100 sessions against 5 for Paid Search and 3 for Organic Search.

ChannelSessionsKey EventsEngagement Rate
Organic Search google / organic 48,2001,44661%
Paid Search google / cpc 21,5001,07558%
Email newsletter / email 6,40044872%

Sessions are taken by channel without a Page Path breakdown, so no session is counted twice.

source
Google Analytics 4 · as of Mon 06:40 UTC
covers
1-30 Sep 2026
Example answer · fictional account and figures
Google Analytics 4 in Gemini

Questions Gemini can answer from your Google Analytics 4 data

Google Analytics 4 measures how people reach and use your website and apps. Dataddo extracts one flexible GA4 dataset: pick from 184 standard metrics and 374 dimensions, plus custom ones defined in your property.

Weekly extract kept in git

Ask Gemini

Get Sessions, Engagement Rate and Key Events by Session Default Channel Grouping for each of the last 8 weeks and save it as reports/ga4-weekly.csv.

An analytics engineer runs this from the reporting repository every Monday. The CSV is versioned, so the pull request diff shows which channel moved since last week.

Checkout release verified in VS Code

Ask Gemini

Compare Ecommerce Purchases and Add To Carts per day for the seven days before and after the checkout release on 14 October, and tell me if either fell by more than 10%.

A frontend developer asks Gemini Code Assist in agent mode before closing the release ticket. If purchases dipped while carts held steady, the payment step in the open diff is the first suspect.

UTM naming lint for campaign tags

Ask Gemini

List every Session Campaign Name from the last 30 days that breaks the pattern in config/utm-naming.md, with its Session Source Medium and Sessions.

A technical marketer keeps the naming convention as a file in the marketing ops repo. Gemini CLI reads the rule from disk and the campaigns from Dataddo, so badly tagged links are fixed before the month-end report is built.

Google Analytics 4 datasets and the questions they answer in Gemini →
Pricing

Priced per seat.

Data to AI™ is priced per seat, like the AI assistants your team already uses, with ~25% off on annual billing. Need tailored contracts or volume pricing? Talk to us about Enterprise.

Data to AITM

Serve governed business data to Claude, ChatGPT and other AI tools over MCP.

$10.49/month

per seat

3 seats minimum

Enterprise

Flexibly deploy Dataddo in any cloud or hybrid environment.

Custom

We have a payment model that works for you

See all plans and features →
Setup

Connect Google Analytics 4 to Gemini step by step

  1. 1
    Connect Gemini to Dataddo Add the Dataddo server to settings.json in Gemini CLI, restart it and run /mcp auth dataddo to sign in. Gemini Code Assist in VS Code reads the same file.
  2. 2
    Connect Google Analytics 4 to Dataddo Sign in with your Google Analytics 4 account in Dataddo and choose the datasets to sync, such as Users and engagement and Acquisition.
  3. 3
    Choose what Gemini can see Select the Google Analytics 4 data Gemini may query. Access is read-only, and data you don't select stays out of reach.
Gemini setup guide →
With vs. without

Google Analytics 4 in Gemini, with and without Dataddo

Without Dataddo With Dataddo Outcome for you
Getting GA4 into a script Analysts write and maintain their own Google Analytics Data API script, with a cloud project, credentials and paging code that breaks whenever someone leaves. Gemini CLI calls the Dataddo tools against the GA4 source you already scheduled and asks you to confirm each call, or you pick Always allow per tool. No custom extraction code
Provisional days in committed files A CSV committed on Monday includes days that Google can still revise for up to 72 hours, and nothing in the file says so. Ask Gemini to check data_status and to write the last three days to a separate column or leave them out, so the file states its own cut-off. Files that state their freshness
Configuration across repositories Every repository gets its own copy of API keys in a .env file, and sooner or later one of them is committed by mistake. Put the Dataddo server in ~/.gemini/settings.json once for all projects, or in .gemini/settings.json for one; sign-in tokens live outside the repo in ~/.gemini/mcp-oauth-tokens.json. No secrets in the codebase
Token consumption Gemini spends tokens exploring raw Google Analytics 4 columns, sampling rows and retrying until it understands the data. Field definitions and relations are supplied up front, so the model skips the exploration and goes straight to the answer. Fewer tokens per answer
Answer quality Prone to wrong joins, invented fields and numbers that are hard to check. Answers grounded in defined fields. In the Dataddo benchmark, 78.5% of questions were answered correctly, against 65.5% with plain CSV files. Better answers
Datasets

Google Analytics 4 datasets and the questions they answer in Gemini

The Google Analytics 4 datasets marketing teams use most, with their real field names. Gemini queries them by name through the Dataddo semantic layer.

Dataset Metrics and attributes Ask Gemini
Users and engagement
  • Sessions
  • Engagement Rate
  • Active Users
  • New Users
  • Average Session Duration
  • + others
Write Sessions and Engagement Rate by day for the last 90 days to a CSV that my notebook can load.
Acquisition
  • Session Campaign Name
  • Session Default Channel Grouping
  • Session Source Medium
  • First User Source
  • + others
Which Session Campaign Name values from last week are missing from the UTM naming config in this repo?
Pages and events
  • Page Path
  • Landing Page
  • Screen Page Views
  • Event Name
  • Event Count
  • + others
Which Landing Page paths still collected Screen Page Views after we removed them from the sitemap?
Ecommerce
  • Ecommerce Purchases
  • Purchase Revenue
  • Add To Carts
  • Item Name
  • Item Category
  • + others
Did Ecommerce Purchases per day drop in the week after the checkout release compared with the week before?
Key events and ads
  • Key Events
  • Ads cost
  • Session Key Event Rate
  • Return on ad spend
  • + others
On which days did we record Ads cost but zero Key Events, so I can check the tag deploys from those dates?
Audience
  • Device Category
  • Country
  • New vs Returning
  • User Age Bracket
  • + others
How did the Device Category split change in the two weeks after the new mobile layout shipped?
See all Google Analytics 4 datasets, metrics and attributes on the connector page →
Benchmark

More right answers. Half the confident mistakes.

We asked 43 pre-registered questions of three real datasets - Google Search Console, HubSpot deals and Google Ads - and delivered the same rows to the same model in four ways. Only the data layer changed.

78.5%

of questions answered correctly - the best of the four delivery methods tested

2x

fewer confidently wrong answers - 14.0% of runs against 24.0% and 26.3%

2.8x

more correct answers on messy CRM data - better on 8 questions, worse on none

Answered correctly All 43 questions - higher is better
Wrong, but stated as fact Share of runs - lower is better

Same model, prompts and rows in every condition; 759 graded runs, ground truth frozen before any run. On Google Search Console alone, documented CSV files did as well as Data to AI™ - the advantage comes from messier data such as HubSpot deals.

Read the benchmark →
FAQ

Google Analytics 4 and Gemini: FAQ

How do I connect Google Analytics 4 to Gemini?

Create a Google Analytics 4 source in Dataddo and attach it to a Google Gemini destination or AI Model. Add Dataddo under mcpServers in ~/.gemini/settings.json with the httpUrl https://headless.dataddo.com/mcp-data, restart Gemini CLI and run /mcp auth dataddo to sign in. Gemini Code Assist in VS Code reads the same file.

Does Gemini read Google Analytics 4 through a Google link?

This setup does not use one. Dataddo extracts GA4 on the schedule you set and serves it through the Data Access MCP server. Gemini CLI signs in there with your Dataddo account, not with your Google Analytics login.

Why do I have to use httpUrl and not url in settings.json?

With url, Gemini CLI falls back to SSE, which Dataddo does not support. Use httpUrl with https://headless.dataddo.com/mcp-data and add no headers or oauth block; /mcp then shows whether the server is connected.

Can Gemini Code Assist use the same GA4 connection?

Yes. Agent mode in VS Code reads the same settings.json as Gemini CLI. In IntelliJ, Gemini Code Assist uses its own mcp.json, so add the Dataddo server there as well.

Which GA4 metrics and dimensions can Gemini query?

The ones you selected in the GA4 source in Dataddo, chosen from 184 standard metrics and 374 dimensions plus the custom ones defined in your property. To query another field, add it to the source first.

Will Gemini see GA4 flows I attached to other AI clients?

Yes. Once signed in, Gemini reaches every flow or Context attached to an AI destination or AI Model in that Dataddo account, not only the Google Gemini ones. Plan your attachments with that in mind.

What happens when my Gemini CLI session expires?

Tokens in ~/.gemini/mcp-oauth-tokens.json renew automatically. If a session expires or is revoked, run /mcp auth dataddo again and sign in with your Dataddo email and password, with MFA if prompted.

Can Gemini change anything in Google Analytics?

No. Access is read-only through the semantic layer. Gemini asks for GA4 entities and fields by name, Dataddo never accepts SQL from the model, and nothing is written back to your property.

New from Dataddo · Data to AI™

Ask Claude or ChatGPT about your ads, analytics and CRM

“What did a new lead cost us last week, by paid channel?”

Connect 400+ sources once and get the answer right in your AI chat, without building a report. Better answers: your metrics are defined once, so the AI doesn't have to guess.