I connected Google Search Console and GA4 to Claude without a paid connector. The whole setup is one Google Sheet, two Apps Script files and a free Google Cloud project.
Every morning, the sheet pulls fresh data and rebuilds one export tab. When I ask Claude a question about my site, it reads that tab through Google Drive and answers from real numbers.
Below is the exact setup, step by step, including the three errors that blocked me and how I fixed each one. At the end: what the tracker found on my own site on its first read.
How the connection works
Claude doesn't talk to Search Console directly. A Google Sheet sits in the middle:
- Apps Script pulls the data. It calls the Search Console API and the GA4 Data API and writes the results into tabs.
- One export tab flattens everything. Every report is copied into a single table,
Claude_Export, with the same columns throughout. - Claude reads the sheet. With Google Drive connected in Claude, it opens the sheet and works from that tab.
Cost: zero. Everything runs inside Google Sheets, Apps Script and a free Google Cloud project.
What you need before you start:
- Owner or full access to a Search Console property, and the Google account that has it
- A GA4 property on the same Google account, plus its numeric property ID (GA4 → Admin → Property details). The
G-measurement ID won't work for the API. - A Claude account with Google Drive connected
Step 1: Create the sheet and its Apps Script project
- Create a new Google Sheet, signed in as the account that owns Search Console and GA4.
- Open Extensions → Apps Script. This creates a script attached to that sheet.
- Create two script files:
Code.gs: pulls Search Console and GA4 data into the raw tabs. Main function:refreshAll.ClaudeExport.gs: builds theClaude_Exporttab from those tabs. Main function:cx_runClaudeExport.
Splitting the work into two files matters later. If the data pull fails, you can see it before the export copies the failure.
Step 2: Add the manifest (permissions file)
Apps Script only asks for permissions it can detect. A direct call to the Search Console API isn't one of them, so you declare the permissions yourself.
In Apps Script: Project Settings → tick "Show appsscript.json manifest file in editor". Then replace the file's contents with:
{
"timeZone": "Asia/Kolkata",
"dependencies": {
"enabledAdvancedServices": [
{ "userSymbol": "AnalyticsData", "version": "v1beta", "serviceId": "analyticsdata" }
]
},
"exceptionLogging": "STACKDRIVER",
"runtimeVersion": "V8",
"oauthScopes": [
"https://www.googleapis.com/auth/spreadsheets",
"https://www.googleapis.com/auth/script.external_request",
"https://www.googleapis.com/auth/script.scriptapp",
"https://www.googleapis.com/auth/webmasters.readonly",
"https://www.googleapis.com/auth/analytics.readonly"
]
}
What each piece does:
AnalyticsDataturns on the GA4 Data API inside Apps Script.webmasters.readonlyandanalytics.readonlygive read-only access to Search Console and GA4. The script can never change anything in either.script.external_requestallows the direct call to the Search Console API.script.scriptappallows the daily triggers.timeZonemakes those triggers fire on your local time. Change it to yours.
Step 3: Set up a Google Cloud project
Apps Script's default project can't call the Search Console API. You need your own, free.
- In Google Cloud Console, create a new project.
- Enable two APIs: Google Search Console API and Google Analytics Data API.
- Set up the OAuth consent screen: choose External, fill in the basics, then Publish app → In production.
- Copy the project number from the project dashboard.
- Back in Apps Script: Project Settings → Change project → paste the number.
On first run, Google shows an "unverified app" warning. That's expected for a tool only you use: Advanced → Go to (project name) → Allow.
Step 4: Configure what counts
At the top of Code.gs, one config block decides how the data gets labelled. This is where your marketing judgement goes in:
const CFG = {
gscSiteUrl: 'sc-domain:yourdomain.com', // or 'https://yourdomain.com/' for a URL-prefix property
ga4PropertyId: 'YOUR_NUMERIC_ID',
brandTerms: ['your name', 'yourname'], // splits brand vs non-brand queries
targetMarkets: ['india'], // flags visitors in the markets you sell to
localModifiers: ['seo', 'marketing', 'consultant', 'ppc'], // service-intent words
enquiryDomains: ['linkedin.com'], // outbound clicks that count as enquiries
sitemapIndexUrl: 'https://yourdomain.com/sitemap.xml',
};
Two choices worth thinking about:
- Brand terms. If your surname is common, a loose brand term will count other people's searches as yours. Be strict or accept the noise.
- Enquiry signal. My site has no contact form, so a click to my LinkedIn profile is the closest thing to a lead. GA4 records those as outbound clicks when Enhanced measurement is on (Admin → Data streams → Enhanced measurement → Outbound clicks).
Step 5: Pull Search Console and GA4 into tabs
refreshAll fills one tab per report.
Search Console is called directly over its REST API, using the script's own login token. A simplified version of the pattern:
function gscQuery_(body) {
const url = 'https://searchconsole.googleapis.com/webmasters/v3/sites/' +
encodeURIComponent(CFG.gscSiteUrl) + '/searchAnalytics/query';
const res = UrlFetchApp.fetch(url, {
method: 'post',
contentType: 'application/json',
headers: { Authorization: 'Bearer ' + ScriptApp.getOAuthToken() },
payload: JSON.stringify(body),
muteHttpExceptions: true,
});
return JSON.parse(res.getContentText()).rows || [];
}
GA4 goes through the AnalyticsData service enabled in the manifest:
const report = AnalyticsData.Properties.runReport({
dateRanges: [{ startDate: '28daysAgo', endDate: 'yesterday' }],
dimensions: [{ name: 'landingPage' }, { name: 'sessionDefaultChannelGroup' }],
metrics: [{ name: 'sessions' }, { name: 'engagedSessions' }, { name: 'keyEvents' }],
}, 'properties/' + CFG.ga4PropertyId);
The tabs it produces:
| Tab | What it answers |
|---|---|
| GSC_Daily | Clicks, impressions, CTR and position per day |
| GSC_Queries / GSC_Pages | Which queries and pages earn impressions, brand vs non-brand |
| GSC_URL_Inspection | Index status, fetch state and last crawl per URL, with day-over-day history |
| GSC_Sitemaps / Sitemap_URLs | What Google downloaded, and what the live sitemap actually lists |
| GA4_Daily / GA4_Landing | Sessions, engaged sessions and key events by channel and landing page |
| GA4_Click_Destinations | Where visitors click out to, with enquiry clicks flagged |
| GA4_Organic_Page_Geo | Where organic visitors are, and whether they're in a target market |
| Dashboard | 28-day totals against the prior 28 days, plus non-brand share of clicks |
One rule from experience: write each tab in one batch (setValues on a whole range), not row by row with appendRow. Row-by-row writes are slow, and Apps Script stops any run that goes past 6 minutes.
The sitemap check also has to handle two layouts. WordPress publishes a sitemap index that points to child sitemaps. My Next.js site publishes one flat list. The script checks for <sitemapindex and handles both.
Step 6: Build the Claude_Export tab
This is the step that makes the sheet usable by Claude.
Fifteen tabs with fifteen layouts is how you get confident, wrong answers. So cx_runClaudeExport copies every report into one table with fixed columns:
| Column | Purpose |
|---|---|
| block | Which report the row came from (e.g. GSC_PAGE_MONTH) |
| period | Week, month or rolling window |
| page / query / link_url / channel | The dimension, blank when not relevant |
| clicks / impressions / ctr / position | Search Console metrics |
| sessions / engaged_sessions / key_events / event_count | GA4 metrics |
| status / note | Flags (like ENQUIRY) and metadata |
Three rules make it work:
- META rows go first. Each run writes one row per block with its date range and row count, plus the refresh time and the latest date Search Console has data for. Claude knows which window it's reading before it reads a number.
- The script does the maths. Totals, shares and flags (like India's share of impressions) are calculated in code and written into the notes. Claude only interprets them. It never has to add up 500 rows.
- The export tab must be the first tab. When Claude downloads a Google Sheet through Drive as CSV, it gets only the first tab. A one-time setup function,
cx_setup, movesClaude_Exportto position one. The export also moves it back on every run in case someone drags it.
Step 7: Schedule it
Two daily time-based triggers, an hour apart:
- 06:00:
refreshAllpulls fresh Search Console and GA4 data. - 07:00:
cx_runClaudeExportrebuilds the export from the fresh tabs.
The gap matters. If the export runs before the pull finishes, it copies yesterday's data, or yesterday's error.
Step 8: Ask Claude
With Google Drive connected in Claude, ask about the sheet by name. For example:
- "Read my organic tracker. Which pages earn impressions but no clicks, and why?"
- "Is the impressions drop in the last 28 days site-wide or one page? When did it start?"
- "What share of clicks is non-brand, and which non-brand queries should I write for?"
Specific questions get specific answers. "Analyse my SEO" gets a generic one.
What broke during setup (and the fixes)
Three errors stopped me. All three are setup issues, not code issues.
| Error | Cause | Fix |
|---|---|---|
| "Access blocked" on sign-in | The Apps Script was still on its default project, not the Cloud project with the APIs and consent screen | Project Settings → Change project → paste your project number |
| "Google Search Console API has not been used in project … or it is disabled" | The API wasn't enabled on the new Cloud project | APIs & Services → Library → Google Search Console API → Enable |
| Daily runs stop after about a week | The consent screen was left in Testing, where Google expires the login after 7 days | Publish the consent screen to In production |
Run the first refreshAll by hand and check the Dashboard tab before you trust the triggers. If Search Console fails, the export will faithfully copy the error, and Claude will read it.
What it found on my own site
This is why the setup is worth an afternoon. On the first read, Claude found a story Search Console's interface had hidden for months.
1. 44,027 impressions, 4 clicks. One case study, how I built and scaled a cricket news site, carried almost all of my site's impressions:
| Month (2026) | Impressions | Clicks | Avg. position |
|---|---|---|---|
| April | 2,537 | 2 | 5.8 |
| May | 9,329 | 1 | 6.4 |
| June | 6,715 | 0 | 4.8 |
| July | 4,370 | 0 | 5.1 |
| August | 6,296 | 1 | 4.9 |
| September | 14,108 | 0 | 4.4 |
| October | 672 | 0 | 4.5 |
2. The queries had no intent. They were company-lookup questions about the site in the case study: who its CEO is, when it was founded, what industry it's in. Google answers those without a click. A better title tag wouldn't fix it.
3. Wrong market. India's share of impressions was 0.9% (394 of 46,243). Every organic session GA4 recorded from May to early November came from India. The impressions came from a different audience than my actual visitors.
4. The drop wasn't my migration. Weekly impressions fell from 4,650 (week of 7 Sep) to 363 (week of 5 Oct), before the site moved from WordPress to Next.js on 16 October. URL inspection confirmed every page on the new site was indexed and passing.
5. Non-brand clicks: 0%. Every click in the last 28 days came from people searching my name. The one non-brand query with real intent was "google search console to claude", at position 52. That's why this article exists.
Without the tracker, I'd have read 14,108 monthly impressions as a win and spent a week debugging a migration that wasn't broken. The number I watch now is non-brand clicks from my target market.
For the GA4 side of the same setup, see how to connect GA4 to Claude. If you'd rather run a one-off audit than keep a tracker running, I covered that in how I automated my Search Console audit with Claude Code. More of what I've built is on my systems page.
FAQ
Do I need a connector to use Google Search Console data in Claude?
No. Pull the data with the Search Console API through Google Apps Script into a Google Sheet, then let Claude read the sheet through Google Drive. A connector is optional.
Is the Apps Script method free?
Yes. Google Sheets, Apps Script, the Search Console API and the GA4 Data API are free at this scale. The only setup is a free Google Cloud project.
Why does my Apps Script say "Access blocked" when connecting to Search Console?
Usually because the script is still on its default Google Cloud project. Link it to the project where you enabled the APIs and set up the consent screen: Apps Script → Project Settings → Change project.
Why does Claude only see one tab of my Google Sheet?
When a Google Sheet is downloaded as CSV through Drive, only the first tab comes through. Put the tab you want Claude to read first.
Can the script change anything in Search Console or GA4?
No. With the webmasters.readonly and analytics.readonly scopes, it can only read data.
I'm Rohan Babbar, a digital marketing manager who builds the systems that measure paid media and SEO. If you're working on something similar, connect with me on LinkedIn.





