Analyzing Search Console, GA4, YouTube, and Instagram with Claude Code
Contents
- What kind of analysis does Claude Code do?
- What I did: have Claude Code write scripts, fetch CSVs, and analyze them
- What you need, the cost, and cautions
- How to connect each service
- ① Preparing Google Cloud (shared by Google Search Console, GA4, and YouTube)
- ② Connecting Google Search Console and GA4
- ③ Connecting YouTube (OAuth)
- ④ Connecting Instagram
- After connecting: how I ask Claude Code
- Summary: the tedious number-checking got easy

This post was automatically translated by AI from the Japanese original. The screenshot is in Japanese.
Every month, I analyze the traffic and numbers from Google Search Console, Google Analytics, YouTube, and Instagram.
Honestly, I found this a huge hassle.
First, every channel has a different dashboard.
Every month I’d open Google Search Console to check keyword rankings.
Google Analytics has so many metrics that I’d spend tens of minutes figuring out how to find what I wanted.
I had pulled the key figures together in Looker Studio, but setting up that report was a bit tricky too.
And on top of that, I check my Instagram numbers in the app.
So I thought, why not have Claude Code analyze everything together? and had it build a setup for me. Now I just ask it to “analyze,” and it looks at all four sets of data at once.
This post is a record of the steps.
I didn’t write any code myself; I went through it by asking Claude Code as I went.
This reflects the situation as of October 2026. Screens and specs of each service can change, so go by what you actually see.
What kind of analysis does Claude Code do?
First, here’s what I have it put in my report:
- The numbers I want to see every month
- Analysis for each channel
- What went well and what caught my eye
- Improvements (revising content, reader navigation)
- The effect of past measures
↓ Here’s roughly what the report it made looks like. (The numbers in the table are samples for illustration.)
| Category | Metric | Sep | Aug | MoM | Goal note |
|---|---|---|---|---|---|
| Blog | ① Search clicks | 1,250 | 1,100 | +14% | Aim for 1,400 in Oct |
| Blog | ② Inquiries | 3 | 2 | +1 | |
| Blog | ③ Readers | 2,400 | 2,150 | +12% | |
| YouTube | ① Views | 480 | 420 | +14% | |
| YouTube | ② Total watch time | 36 hrs | 30 hrs | +20% | |
| YouTube | ③ Visits to the blog from the description | 25 | 18 | +39% | |
| ① Reach (views) | 5,200 | 4,000 | +30% | ||
| ② Saves | 85 | 60 | +42% | Analyze the most-saved posts | |
| ③ Profile visits + link clicks | 140 | 110 | +27% | ||
| Overall | Visits to the blog from social media | 65 | 48 | +35% |
What I like most is that it also comments on the numbers and points out directions for improvement.
I happened to be chatting with Claude about how “going forward, I might want to write about Obsidian and similar topics rather than WordPress and blogging,” and it replied:
- The topics that grow when I write about them are the ones I like: Obsidian, English Hanon, and Pilates. Their CTR (the share of impressions that got a click) is 5–9%. For the next article topic, I can pick from the ideas I’d noted in my to-do list, choosing ones whose search terms are confirmed.
It was also helpful that it listed ideas for improving titles and descriptions of articles with many impressions but a low CTR (articles that show up in search a lot but aren’t getting clicked).
| Article | Issue | Idea (a guess) |
|---|---|---|
| Sample article A | 1,200 impressions / 1.2% CTR / position 8 | Match the query “sample keyword” (900 impressions, position 9) by putting “sample keyword” in the title |
Instead of just looking at the numbers and thinking “huh, OK,” I now find ideas that lead to the next step.
What I did: have Claude Code write scripts, fetch CSVs, and analyze them
So, how did I actually do it?
I connected through the APIs, had Claude Code write fetch scripts (Python programs), saved the numbers as CSV files, and then had it analyze them.
There’s another way to connect called MCP, but I chose scripts that leave a CSV on my machine.
There are two good points:
- The numbers stay on my machine as CSVs, so I can look back at them later
- It only costs what Claude Code costs
The flow looks like this:
Google Search Console / GA4 / YouTube / Instagram ↓ (API) Fetch scripts ↓ CSV files ↓Claude Code analyzes → monthly reportWhat you need, the cost, and cautions
What you need
- Claude Code (I use the Pro plan)
- A Google account (the one you use for Google Search Console, GA4, and YouTube)
- An Instagram professional account (Business or Creator)
- A Facebook account (I needed it to use the Instagram API)
Cost
You pay for Claude Code.
Since this is a small personal blog, I’m within the free tier and haven’t paid anything for API usage.
Cautions
Claude Code also tells you these as it works, but keep the following in mind to avoid trouble.
- Make permissions “view only” (so nothing can be changed or posted)
- Don’t paste the contents of keys or tokens into the chat
- If you accidentally paste one into a chat with AI, get a new one and set it up again.
- Keep key files somewhere other than your working folder (I store mine under
~/.config/, readable only by me)
Also, Google Search Console data lags by a few days, so I think it’s best to fetch the previous month’s data around the 5th.
How to connect each service
| Data | Method | Preparation |
|---|---|---|
| Google Search Console | Google Search Console API (service account) | Set up Google Cloud Grant view permission in Google Search Console |
| GA4 | GA4 Data API (service account) | Set up Google Cloud, grant view permission in GA4 |
| YouTube | YouTube Analytics API / Data API (OAuth) | Enable the APIs, set up the OAuth consent screen, sign in the first time |
| Instagram API (Instagram Login version) | Professional account, create a Meta app, issue a token |
A “service account” is like a robot account that exists only to run programs. Here, I prepare an account for the AI, give it “view only” permission, and let it read the data.
However, YouTube channel data can’t be fetched this way, so you sign in with your own account and click “Allow” (OAuth).
From here on, you only need to connect the channels you actually use.
I asked Claude Code about every step, and when I wasn’t sure, I pasted a screenshot and asked, “Is this setting right?” before moving on.
① Preparing Google Cloud (shared by Google Search Console, GA4, and YouTube)
All three Google services use the same Google Cloud project.
- Go to the Google Cloud Console
- From the project selector at the top of the screen, create a “New project”
- Any project name is fine
② Connecting Google Search Console and GA4
I followed this article (in Japanese).
https://note.com/karlovic/n/nc38a2845fd23
I asked Claude Code, “Using this article as a reference, I want to use the Google Search Console and GA4 APIs in Google Cloud. What are the exact steps?” and went through them one by one.
When I couldn’t find where a screen was or what to set, I took a screenshot and asked Claude Code, and it explained based on what was on my screen.
Setting up the Google Cloud project
-
Under “APIs & Services” > “Library,” enable the APIs you’ll use
- Google Analytics Data API
- Google Search Console API
-
“APIs & Services” > “Credentials” > “Create credentials” > “Service account”
- Download the service account’s key (a JSON file) and keep it safe
- For the key setup, I asked for the commands to type in the terminal and configured it that way
Granting the service account “view” permission
The service account you created has an email address like id@xxxxxxx.iam.gserviceaccount.com.

Add it as a viewer in both Google Search Console and GA4.
- Google Search Console: Settings → Users and permissions → Add user (permission: “Restricted”)
- GA4: Admin → Access management → Add user (role: “Viewer”)
Once that’s done, ask Claude Code for the script
At this point, have Claude Code write the fetch scripts and run a test fetch.
③ Connecting YouTube (OAuth)
Setting up the Google Cloud project
Do the following. Screens and the order of steps may change, so follow the actual guidance (for example, you may be asked to set up the OAuth consent screen first).
-
Under “APIs & Services” → “Library,” enable the APIs you’ll use
- YouTube Analytics API
- YouTube Data API v3
-
“APIs & Services” → “OAuth consent screen”
- Under “Data access,” add these two scopes
.../auth/yt-analytics.readonly.../auth/youtube.readonly- Both are view only
- Under “Data access,” add these two scopes
-
“APIs & Services” → “Credentials”
- “Create credentials” → “OAuth client ID”
- Application type: “Desktop app”
- Download the JSON and keep it safe
-
Set the publishing status to “In production”
- I couldn’t switch to production until I entered the app’s domain, home page, and privacy policy in the app information. I entered my own blog’s URL.
- If you leave it on “Testing,” you have to add yourself as a test user, and the authorization expires after 7 days. In production, you don’t need to register test users, and you avoid the expiry.
- Once you publish, a message says “App verification required. Once you’ve finished setting up the information, submit the app for review.” But since this is for personal use, no review is needed.
Once that’s done, have Claude Code check the settings and write the fetch script.
Allow access in the browser, the first time only
When you run the script for the first time, a browser opens.
Sign in with the account that owns your channel and allow access.
At this point, the browser shows a warning: “Google hasn’t verified this app.”
Click “Advanced” in small text at the bottom left, then “Go to (app name)” to continue.
After you allow it, a token is saved and refreshed automatically from then on.
The data you can fetch includes daily views, total watch time, and subscriber changes, per-video views and average view duration, and the types of traffic sources.
④ Connecting Instagram
Prerequisite: you need Facebook
To use the Instagram API with AI, I needed to register as a developer with a Facebook account, not just an Instagram account. I didn’t use Facebook, so at first I thought “then let’s skip it” and put it on hold.
I looked for other ways, but they all seemed to use an external connection service. They looked easy to set up, but monthly fees might apply later as my usage grows, so in the end I created a Facebook account just for this connection.
I don’t post or add friends, I set its visibility to the minimum, and I keep it only for developer registration.
The steps
- Switch Instagram to a professional account (Business or Creator)
- Sign up at Meta for Developers with your Facebook account
- Create an app
- Use case: “Manage messaging and content on Instagram”
- Business: don’t link a business portfolio (business verification and app review aren’t needed if you use it only for your own account)
- Requirements: go to the next step without configuring anything (even if the screen says “required,” you can proceed as long as the app stays in development and isn’t published)
- Customize the use case
- Add the permissions you need
- instagram_business_basic
- instagram_manage_insights
- Don’t add permissions you won’t use (managing messages and comments)
- Add and accept a tester
- Add your own Instagram account as a “tester” and accept the invitation
- Generate an access token
- “Add account” → sign in on Instagram and allow access
- Generate the token
- Save it with a terminal command
- Add the permissions you need
Once that’s done, have Claude Code check the settings and write the fetch script.
The token expires after about 60 days.
The script checks the expiry each time it runs and renews it automatically.
Where I got stuck
- During setup, I got several errors saying “Please try again later.”
- The test fetch after setup worked, but at the scheduled run it errored. When I checked the dashboard, it said suspicious activity had been detected, and I had to verify my identity. I’ve only run it once, so I can’t tell whether that was a one-off or will keep happening. (As of October 2026, I don’t know the cause. I’ll add an update when I find out.)
The numbers you can get
Reach, profile visits, link taps, and per-post reach, saves, and likes.
Note that Stories disappear after 24 hours, so a monthly fetch can’t capture them.
After connecting: how I ask Claude Code
Once the four CSVs are ready, you can ask Claude Code something like this:
Fetch last month’s four sets of data and make a monthly report.
Tell me which articles have many impressions but few clicks, and your hypotheses for why.
To make the analysis quick, I have it organize the following:
- The numbers I must always look at
- Facts from the data
- Hypotheses we can draw from them
- Guesses that are still unclear
I’ve asked Claude Code to “compile the analysis data into a report on the 5th of each month,” and now it runs automatically.
Summary: the tedious number-checking got easy
I used to check the numbers only when I really needed to; now I can look at them often, and the bar to doing analysis has dropped. I’m also grateful that the AI surfaces only the points worth looking at!
The initial setup is a high hurdle, but I’d like people who want to work on analysis but aren’t good with numbers to give it a try. Connect the channels you use!



