
Google Analytics
Traps to avoid when querying Google Analytics 4 through treg, cases where the GA4 Data...
Install
npx skills add superdesigndev/treg --skill google-analytics -g -a claude-code -y- Repository
- superdesigndev/treg7k
- Category
- Engineering
- Updated
- 3d ago
- License
- See repository
- Context cost
- Lightabout 1,184 tokens
- Runs scripts
- No, instructions only
What it does
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.
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:
