GA4 Report CLI
GA4 속성 트래픽을 조회해 한국어로 요약하는 의존성 0 CLI. 일·주·월 단위, 유입 경로·페이지 Top, 전 사이트 DAU 한눈에.
#analytics#ga4#reporting#cli#cron#self-contained
Install
설치
/ga <속성ID|도메인|별칭> [-d|-w|-m] [from] [to]Requirements
- Node.js
- 조회 대상 GA4 속성에 최소 뷰어 권한
- 인증 하나 — 서비스 계정 키(JSON) 또는 gcloud ADC 로그인
Capabilities
주요 기능
- 01대상 3형태 해석 — 별칭 · GA4 속성ID(숫자) · 도메인/URL 모두 인식
- 02분석 단위 일간(-d) · 주간(-w) · 월간(-m) + 임의 기간(from~to, 생략 시 최근 7일)
- 03합계(사용자·세션·페이지뷰) + 구간별 표 + 유입 경로 Top 10 + 페이지 Top 10
- 04all 모드 — 여러 속성을 한 번에 돌려 사이트별 DAU를 평균 내림차순 보드로 (터미널=테이블 / 모바일=세로 블록)
- 05인증 이중 모드 — 서비스 계정 키(JWT 직접 서명) 우선, 없으면 gcloud ADC(사용자 OAuth) 자동 폴백
- 06의존성 0 — Node 내장 crypto로 JWT 서명, 외부 패키지 없이 스킬 디렉토리에 자기완결
- 07gcloud 실행 파일 자동 탐색(PATH → Homebrew Cask → 표준 경로) — cron·LaunchAgent 비대화 셸 대비
- 08데이터 0 감지 시 gtag 미설치 가능성 안내
About
About
ga is a self-contained CLI that reads GA4 property traffic through the Analytics Data API and prints a Korean summary — totals, a per-interval table (daily / weekly / monthly), a top-10 acquisition-channel breakdown, and a top-10 page list. An `all` mode sweeps several properties at once and ranks sites by average DAU, rendering a table on the terminal and a mobile-friendly vertical block for messaging apps.
It ships with no dependencies: JWTs are signed with Node's built-in crypto, so the skill directory is fully portable — copy it and it runs. Authentication is dual-mode and auto-detected: a service-account key (signed locally into an access token) takes priority, and if no key file is present it falls back to gcloud Application Default Credentials, so a new machine can authenticate with the user's own Google account without distributing any secret. The gcloud binary is discovered across PATH, Homebrew Cask, and standard install paths so it keeps working inside non-interactive shells (cron, LaunchAgent).
To reuse it, you bring your own inputs: pass your own numeric GA4 property ID (or register your domains in the alias map) and authenticate with your own account holding viewer access — the bundled aliases and service account point at SH Consulting's own sites and are only the demo fixtures. Built originally to power daily automated traffic briefings, it works equally well as an ad-hoc reporting command.