google-analytics
하는 일
이 스킬은 오류 없이 잘못된 답을 주는 GA4 보고 함정을 나열합니다. 웹사이트 트래픽, 전환, 매출을 보고하는 분석가와 에이전트를 위한 스킬입니다.
사용하는 경우
- ✓GA4에서 사이트 트래픽, 페이지뷰, 채널에 관한 질문에 답할 때.
- ✓전환이나 매출을 보고하는데 수치가 0으로 나올 때.
- ✓오늘이 포함된 날짜 범위를 비교할 때.
스킬 링크
https://github.com/superdesigndev/treg/blob/main/.agents/skills/google-analytics/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“지난 28일 동안 제 사이트에 방문자가 몇 명 왔고, 매출은 얼마였는지 알려 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 특별한 요청이 없으면 오늘 대신 어제 날짜를 씁니다. 0을 보고하기 전에 전환이 추적되고 있는지 확인합니다. 적용한 부분 집계일 주의 사항은 설명합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
GA4 via treg — what will silently mislead you
You already know the GA4 Data API. This file is only the things that return a plausible wrong answer with no error. Everything here was verified live on 2026-07-22, and each trap was confirmed by watching three independent agents walk into it.
Property id: treg connections ls → the google-analytics row's resource_ref.
1. endDate:"today" silently includes a partial day
3 of 3 agents did this. It inflates every number and you will not notice.
28daysAgo → today /top-page = 45,120 ← includes a partial day
28daysAgo → yesterday /top-page = 44,300
Use yesterday unless the user explicitly asks about today. If you must use today, say the
last day is partial.
2. Zero does not mean zero — check whether it's even tracked
3 of 3 agents reported "$0 revenue and 0 conversions" for a business with real revenue. Two
rated it high confidence; one argued the zero was trustworthy because eventCount was large.
keyEvents, conversions, and totalRevenue all return 0 when nothing is instrumented,
which is indistinguishable from genuinely zero. Before reporting any zero:
# does this property have ANY key events configured?
--data '{"dateRanges":[...],"metrics":[{"name":"keyEvents"}]}'
Don't request keyEvents and conversions in the same call — they're aliases and GA4 rejects
it with 400 Found duplicate metrics: conversions. Pick one.
If keyEvents is 0 across a long window on a site with traffic, the correct answer is
"conversions are not instrumented in GA4; this question can't be answered from this source" —
never "revenue is $0". Revenue almost certainly lives in Stripe/PostHog instead.
3. A zero-row response has NO rows key at all
Not rows: [] — the key is absent, and so is rowCount. The shape varies by query:
| Query | Top-level keys returned |
|---|---|
| grouped by a dimension | ['dimensionHeaders','metricHeaders','metadata','kind'] |
metrics only (e.g. keyEvents) |
['metadata','kind'] — headers gone too |
A naive d['rows'] raises KeyError, which reads as a malformed request. All three unskilled
agents were confused by this. Use d.get('rows', []), treat empty as "no data", then apply
trap #2.
3b. Don't list dateRange as a dimension
Comparing two periods is a standard ask, and the obvious move errors:
400: "Field dateRange is not a dimension. This field can be used in a Pivot or
OrderBy like a dimension, but does not need to be listed in the Dimensions."
Pass 2+ entries in dateRanges and the API auto-appends the range as an extra dimension
value. Give the ranges names to label them in the output.
4. Dimension sums do NOT equal totals — they overcount
Measured against a dimensionless true total (illustrative, ratios are the point):
| Grouped by | Sum | vs true total |
|---|---|---|
sessionDefaultChannelGroup |
~104% | |
country |
~104% | |
pagePath |
~189% |
Sessions span multiple pages, so per-page sums double-count badly. Never sum a dimension to report a total — run a separate dimensionless query.
5. limit defaults to 10,000 and truncates silently
An unlimited pagePath query returned exactly 10,000 rows with "rowCount": 42613 — 32,613 rows
dropped, no warning. rowCount is the truth; len(rows) is not. Compare them before saying
"all" or "every".
6. The Admin API is a different host and is unreachable via /call/
The tool is bound to analyticsdata.googleapis.com. Anything on
analyticsadmin.googleapis.com — accountSummaries, property metadata — returns a Google HTML
404, not JSON. Two of three agents burned several attempts here, including trying to pass an
absolute URL (which gets concatenated into garbage).
To list properties, use treg, not the proxy:
treg connections resources <connection-id> # hits the Admin API server-side
Everything else
Standard GA4 Data API. runReport, runRealtimeReport, batchRunReports, runPivotReport,
checkCompatibility, /metadata all verified working through /call/. Two minor notes:
metric values are strings (cast before arithmetic), and metadata.timeZone governs what
"today" means (a property reports in its own timezone, e.g. Australia/Sydney).
⚠️ Reported but not observed here: high-cardinality dimensions can collapse into an (other) row.
- API schema: https://developers.google.com/analytics/
자주 묻는 질문
종료일을 오늘로 하면 안 되나요?
오늘은 부분 집계일을 포함해 합계를 부풀리므로 안 된다고 스킬은 말합니다.
매출이 0으로 나오면 어떻게 하나요?
핵심 이벤트가 설정되어 있는지 확인하라고 스킬은 말합니다. 0은 아무것도 추적되지 않는다는 뜻일 수 있기 때문입니다.
서로 충돌하는 두 지표를 함께 요청할 수 있나요?
일부 지표는 별칭이라 같은 호출에서 함께 요청할 수 없다고 스킬은 경고합니다.
상세 정보
작성자의 원본 설명
Traps to avoid when querying Google Analytics 4 through treg — cases where the GA4 Data API returns a confident wrong answer instead of an error. Use whenever answering questions about site traffic, visitors, pageviews, channels, conversions, or revenue from GA4.
repo: superdesigndev/treg
인기도
- GitHub 스타
- 7.0k
- 순위
- #13698
- 라이선스
- —
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
code-quality
7.0k에이전트가 도구로 규칙을 강제하고 주석은 줄이며, 실패할 수 있는 테스트와 짧은 문서를 쓰도록 돕습니다.
google-ads
7.0k에이전트가 API 버전과 예산 실수를 피하며 Google Ads 보고서를 만들고 캠페인을 안전하게 바꾸도록 돕습니다.
google-search-console
7.0k에이전트가 Search Console 데이터를 보고하며, 최근의 불완전한 날짜를 하락으로 오해하지 않도록 돕습니다.
portrait-clone
7.0k에이전트가 인물 참고 사진을 모든 시각 요소를 고정한 상세 JSON 이미지 프롬프트로 바꾸도록 돕습니다.
비슷한 스킬
gitcrawl
394k에이전트가 저장된 GitHub 이슈와 풀 리퀘스트 보관본을 검색하고, 중복 항목을 묶고, GitHub에서 현재 상태를 확인하도록 돕습니다.
slacrawl
394k에이전트가 로컬 Slack 보관본에서 메시지를 검색하고 개수를 세며, 보관본이 얼마나 최신인지 확인하고 필요할 때 새로 고치도록 돕습니다.
goplaces
394k에이전트가 Google Places로 장소를 검색하고, 세부 정보와 리뷰를 가져오고, 장소 이름을 확인하며, 스크립트용 JSON을 출력하도록 돕습니다.