agent-analytics
БесплатноБез исполняемых скриптовНе проверенWeb analytics platform that AI agents can query via CLI. Track page views, custom events, run A/B experiments, analyze funnels, retention cohorts, and traffic…
от modbender★ 21 звезда на GitHubОб этом скилле
Agent Analytics — Stop juggling dashboards. Let your agent do it.
You are adding analytics tracking using Agent Analytics — the analytics platform your AI agent can actually use. Built for developers who ship lots of projects and want their AI agent to track, analyze, experiment, and optimize across all of them.
Philosophy
You are NOT Mixpanel. Don't track everything. Track only what answers: "Is this project alive and growing?"
For a typical site, that's 3-5 custom events max on top of automatic page views.
First-time setup
Get an API key: Sign up at agentanalytics.sh and generate a key from the dashboard. Alternatively, self-host the open-source version from GitHub.
If the project doesn't have tracking yet:
# 1. Login (one time — uses your API key)
npx @agent-analytics/cli login --token aak_YOUR_API_KEY
# 2. Create the project (returns a project write token)
npx @agent-analytics/cli create my-site --domain https://mysite.com
# 3. Add the snippet (Step 1 below) using the returned token
# 4. Deploy, click around, verify:
npx @agent-analytics/cli events my-site
The create command returns a project write token — use it as data-token in the snippet below. This is separate from your API key (which is for reading/querying).
Step 1: Add the tracking snippet
The create command returns a tracking snippet with your project token — add it before </body>. It auto-tracks page_view events with path, referrer, browser, OS, device, screen size, and UTM params. You do NOT need to add custom page_view events.
Step 1b: Discover existing events (existing projects)
If tracking is already set up, check what events and property keys are already in use so you match the naming:
npx @agent-analytics/cli properties-received PROJECT_NAME
This shows which property keys each event type uses (e.g. cta_click → id, signup → method). Match existing naming before adding new events.
Step 2: Add custom events to important actions
Use onclick handlers on the elements that matter:
<a href="..." onclick="window.aa?.track('EVENT_NAME', {id: 'ELEMENT_ID'})">
The ?. operator ensures no error if the tracker hasn't loaded yet.
Standard events for 80% of SaaS sites
Pick the ones that apply. Most sites need 2-4:
| Event | When to fire | Properties |
|---|---|---|
cta_click |
User clicks a call-to-action button | id (which button) |
signup |
User creates an account | method (github/google/email) |
login |
User returns and logs in | method |
feature_used |
User engages with a core feature | feature (which one) |
checkout |
User starts a payment flow | plan (free/pro/etc) |
error |
Something went wrong visibly | message, page |
What to track as cta_click
Only buttons that indicate conversion intent:
- "Get Started" / "Sign Up" / "Try Free" buttons
- "Upgrade" / "Buy" / pricing CTAs
- Primary navigation to signup/dashboard
- "View on GitHub" / "Star" (for open source projects)
What NOT to track
- Every link or button (too noisy)
- Scroll depth (not actionable)
- Form field interactions (too granular)
- Footer links (low signal)
Property naming rules
- Use
snake_case:hero_get_startednotheroGetStarted - The
idproperty identifies WHICH element: short, descriptive - Name IDs as
section_action:hero_signup,pricing_pro,nav_dashboard - Don't encode data the page_view already captures (path, referrer, browser)
Step 2a: Measure time-on-page
Add data-heartbeat="15" to the tracking snippet to get accurate time-on-page:
<script defer src="https://api.agentanalytics.sh/tracker.js"
data-project="my-site" data-token="aat_..."
data-heartbeat="15"></script>
Why it matters: Without this, time-on-page is just the gap between two page views. If someone reads a 10-minute article and closes the tab, the recorded time is 0 seconds. This fixes it by measuring actual engaged time.
How it works:
- The tracker silently counts seconds while the tab is visible (no events sent during)
- When the user leaves the page (tab hidden, closes tab, or SPA navigation), the
time_on_pageproperty is added to the originalpage_viewevent — zero extra events - The timer pauses when the tab is hidden and resumes when visible
- Minimum interval is 15 seconds (values below 15 are clamped)
- Works with SPA navigation — each page gets its own time_on_page
Querying time-on-page data:
# Pages with time_on_page data
npx @agent-analytics/cli query my-site \
--filter '[{"field":"event","op":"eq","value":"page_view"},{"field":"properties.time_on_page","op":"gt","value":"0"}]' \
--group-by properties.path --metrics event_count,unique_users
Ste
Установить agent-analytics в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл agent-analytics?
Web analytics platform that AI agents can query via CLI. Track page views, custom events, run A/B experiments, analyze funnels, retention cohorts, and traffic heatmaps. Use when the user needs web analytics, visitor tracking, event tracking, conversion optimization, growth insights, A/B testing, or wants to add analytics to their website or app. Also available as an MCP server at mcp.agentanalytics.sh.
Как установить скилл agent-analytics?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл agent-analytics запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic