Skip to content

feat(analytics): add Google Analytics and Google Search Console commands#402

Open
haresh-seenivasagan wants to merge 3 commits intosteipete:mainfrom
haresh-seenivasagan:feat/analytics-searchconsole-tests
Open

feat(analytics): add Google Analytics and Google Search Console commands#402
haresh-seenivasagan wants to merge 3 commits intosteipete:mainfrom
haresh-seenivasagan:feat/analytics-searchconsole-tests

Conversation

@haresh-seenivasagan
Copy link

@haresh-seenivasagan haresh-seenivasagan commented Mar 3, 2026

Motivation

I wanted to give my companies Claw🦞 access to Google Analytics and Search Console data for SEO audits and traffic analysis.

Summary

Command What it does
gog analytics accounts List GA4 account summaries (--all for pagination)
gog analytics report <property> Run a GA4 report (dimensions, metrics, date ranges)
gog searchconsole sites List Search Console properties
gog searchconsole sites get <site> Show one Search Console property
gog searchconsole query <site> Run a Search Analytics query
gog searchconsole searchanalytics query <site> Explicit Search Analytics subcommand
gog searchconsole sitemaps <site> List sitemaps for a property
gog searchconsole sitemaps get <site> <feed> Show one sitemap
gog searchconsole sitemaps submit <site> <feed> Submit a sitemap
gog searchconsole sitemaps delete <site> <feed> Delete a sitemap

Analytics is read-only. Search Console supports read/query operations plus sitemap submit/delete when authorized with non-readonly Search Console scope. Aliases: ga, gsc, webmasters.

gog analytics accounts --all --json
gog analytics report 123456789 --from 7daysAgo --to today --dimensions date,country --metrics activeUsers,sessions
gog searchconsole sites
gog searchconsole searchanalytics query sc-domain:example.com --from 2026-02-01 --to 2026-02-07 --dimensions query,page --filter query:contains:gog --aggregation byPage
gog searchconsole sitemaps submit sc-domain:example.com https://example.com/sitemap.xml

Follows existing patterns (collectAllPages, tableWriter, failEmptyExit, same flag names). Property IDs normalized so 123456789 and properties/123456789 both work.

Tests

go test ./...

haresh-seenivasagan pushed a commit to haresh-seenivasagan/gogcli that referenced this pull request Mar 3, 2026
@haresh-seenivasagan haresh-seenivasagan changed the title feat(analytics): add GA4 and Search Console commands feat(analytics): add GA4 and Google Search Console commands Mar 3, 2026
@haresh-seenivasagan haresh-seenivasagan changed the title feat(analytics): add GA4 and Google Search Console commands feat(analytics): add Google Analytics and Google Search Console commands Mar 3, 2026
haresh-seenivasagan added a commit to haresh-seenivasagan/gogcli that referenced this pull request Mar 3, 2026
@haresh-seenivasagan haresh-seenivasagan force-pushed the feat/analytics-searchconsole-tests branch from 6beeef1 to b82cc1a Compare March 3, 2026 14:30
@steipete
Copy link
Owner

steipete commented Mar 8, 2026

Deep overlap with #404 on the Search Console slice. Same hot files: internal/cmd/searchconsole.go, internal/googleapi/searchconsole.go, internal/googleauth/service.go, internal/cmd/root.go, README. My read: #402 = GA4 + a smaller read-only Search Console surface; #404 = alternate Search Console implementation with broader site/sitemap support and different auth/API choices. I do not think these stack cleanly. Best dedupe path: split GA4 out of #402, then pick one Search Console design/impl.

@aesadde
Copy link

aesadde commented Mar 12, 2026

Hey @haresh-seenivasagan I'll happily close my PR in favor of this one with the additions? Also happy to take over if you need instead. Let's get this over the line soon!

@haresh-seenivasagan
Copy link
Author

Hey @aesadde sounds good! We can go with this one with the additions. I'll make them soon

@haresh-seenivasagan haresh-seenivasagan force-pushed the feat/analytics-searchconsole-tests branch from b82cc1a to c6520ed Compare March 14, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants