Analytics
Answer questions about site/traffic analytics by reading from Google Analytics 4, Google Search Console, and Semrush. Use when the user asks about active users, sessions, traffic, engagement, search clicks/impressions/queries/rankings, keywords, or competitor/domain metrics — e.g. "how many active users last month", "top search queries this week", "our organic keywords".From its SKILL.md
npx -y skills add causaly/analytics-skill --skill analyticsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
5.8 KB, as published. Nobody here has run it
Analytics skill
Reads live data from three sources and answers plain-language questions. Pick the right source(s) for the question, run the dispatcher, parse the JSON it prints, and answer in prose. Combine sources when a question spans more than one.
Running the scripts
Always use the skill's virtualenv Python (created by setup.sh in a stable home
outside the plugin dir) and the dispatcher. ${CLAUDE_PLUGIN_ROOT} is set when this
runs as an installed plugin; the scripts live under skills/analytics/scripts/:
"$HOME/.analytics-skill/.venv/bin/python" "${CLAUDE_PLUGIN_ROOT}/skills/analytics/scripts/analytics.py" <ga4|gsc|semrush> [options]
(If CLAUDE_PLUGIN_ROOT is unset — e.g. running the repo directly — use the path to
skills/analytics/scripts/analytics.py in your checkout instead.)
If the venv doesn't exist yet, tell the user to run skills/analytics/setup.sh first.
Each run prints ONE JSON object to stdout. If it contains an "error" key, read the
message and tell the user what to fix (usually config or auth) rather than retrying blindly.
Which source answers which question
| Question is about… | Source | Command |
|---|---|---|
| Active users, new users, sessions, engagement, page/screen views, events, conversions, bounce/engagement rate, traffic by channel/country/device | GA4 | ga4 |
| Google Search results: clicks, impressions, CTR, average position, which queries or pages, by country/device/date | GSC | gsc |
| SEO/competitive: a domain's organic keyword count & estimated traffic, top ranking keywords, paid keywords, domain rank | Semrush | semrush |
"How many users were active in the last month" → GA4, metric activeUsers.
Dates
Compute concrete YYYY-MM-DD dates from today's date (in your context) before calling.
- "last month" = the previous full calendar month (e.g. if today is 2026-07-02 →
2026-06-01to2026-06-30). - "last 30 days" / "past week" = count back from today.
- GA4 also accepts relative tokens (
7daysAgo,30daysAgo,yesterday,today) if you prefer. - GSC requires explicit
YYYY-MM-DDand lags ~2–3 days, so "up to today" effectively means the last available day.
GA4 examples
# Active users last month
analytics.py ga4 --metrics activeUsers --start 2026-06-01 --end 2026-06-30
# Users + sessions broken down by day
analytics.py ga4 --metrics activeUsers,sessions --dimensions date --start 2026-06-01 --end 2026-06-30
# Top countries by users last 30 days
analytics.py ga4 --metrics activeUsers --dimensions country --start 30daysAgo --end today --limit 10
Common metrics: activeUsers, newUsers, totalUsers, sessions, screenPageViews,
engagementRate, averageSessionDuration, conversions, eventCount.
Common dimensions: date, country, deviceCategory, sessionDefaultChannelGroup, pagePath.
Read totals for the headline number; rows for the breakdown.
GSC examples
# Total clicks & impressions last month (read "totals")
analytics.py gsc --start 2026-06-01 --end 2026-06-30
# Top 10 search queries last week
analytics.py gsc --start 2026-06-23 --end 2026-06-29 --dimensions query --limit 10
# Top pages by clicks
analytics.py gsc --start 2026-06-01 --end 2026-06-30 --dimensions page --limit 10
Each row has clicks, impressions, ctr (0–1 fraction), position (avg rank, lower = better).
Semrush examples
# Domain overview (organic keyword count Or, organic traffic Ot, etc.) for the default domain
analytics.py semrush --type domain_ranks
# Top 10 organic keywords for a specific domain
analytics.py semrush --type domain_organic --domain example.com --limit 10 --database us
Column codes: Or=organic keywords, Ot=organic traffic, Oc=organic cost, Ph=keyword phrase,
Po=position, Nq=search volume. When presenting, translate codes to readable labels.
Note: Semrush API calls consume paid API units — don't loop over many calls speculatively.
When answering
- Lead with the direct number the user asked for, then any useful breakdown.
- State the exact date range you used and the source.
- If a question needs more than one source (e.g. "how's our traffic and search doing"), run each and summarize together.
- Never fabricate numbers — if a call errors, report the error and what to fix.
Setup / troubleshooting
Shared settings (GA4 property, GSC site, quota project, Semrush key) ship as bundled
defaults in skills/analytics/defaults.json; an optional ~/.analytics-skill/config.json
overrides any of them per key. So there's normally nothing for the user to fill in.
Google auth uses Application Default Credentials (ADC): each user runs
gcloud auth application-default login (analytics + webmasters read-only scopes) and
gcloud auth application-default set-quota-project <project> once. A service-account.json
referenced by credentials_path is used instead of ADC if present.
- GA4
PERMISSION_DENIED→ the authenticated Google account needs Viewer on the GA4 property. - GSC error → the authenticated account needs to be a user on the Search Console property.
Reauthentication is needed/invalid_grant→ re-rungcloud auth application-default login.SERVICE_DISABLED/ quota-project error → rungcloud auth application-default set-quota-projectand confirmserviceUsageConsumeron the quota project.- Semrush
ERROR 50/120→ check the API key and that units remain.