# agent-analytics

Sets up lightweight web analytics, funnels, and A/B experiments via CLI. Gives AI agents direct access to traffic metrics and conversion data across projects.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 137 installs · ★ 3785 repo stars
- Author: davepoon
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/davepoon/buildwithclaude/tree/HEAD/plugins/all-skills/skills/agent-analytics/SKILL.md
- Updated: 2026-10-25
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/agent-analytics

## What it does

This skill connects projects to Agent Analytics using the `npx @agent-analytics/cli` package. The embedded tracking script records page views, referrers, device types, and UTM tags without manual configuration. Agents can then attach custom event handlers like `cta_click` or `signup` directly to relevant HTML elements.

Beyond basic metrics, the tool handles A/B experiments without a web dashboard. Variants swap via declarative `data-aa-experiment` attributes, and Bayesian analysis reports the best variation once roughly 100 exposures per variant are reached.

Execution fails without `npx` available in `PATH` and the `AGENT_ANALYTICS_API_KEY` environment variable configured.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add davepoon/buildwithclaude --skill agent-analytics -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/agent-analytics/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/agent-analytics/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add davepoon/buildwithclaude --skill agent-analytics -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/agent-analytics/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add davepoon/buildwithclaude --skill agent-analytics -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/agent-analytics/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install davepoon/buildwithclaude plugins/all-skills/skills/agent-analytics
```

2. **Manually: put the files in place**
- File: `.github/skills/agent-analytics/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add davepoon/buildwithclaude --skill agent-analytics -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/davepoon/buildwithclaude --path plugins/all-skills/skills/agent-analytics
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/agent-analytics/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add davepoon/buildwithclaude --skill agent-analytics -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/davepoon/buildwithclaude/tree/HEAD/plugins/all-skills/skills/agent-analytics/SKILL.md

## When to use it
- Track page views and conversions without complex analytics suites
- Run headline or CTA split tests using HTML data attributes
- Inspect active visitors and referral sources directly in terminal
- Analyze step-by-step conversion funnels for user signups

## Example prompts
- Add Agent Analytics tracking to my landing page and track signup button clicks
- Create an A/B test for the hero headline comparing two variants
- Show weekly traffic stats and top referrer sources for this site

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: d4910aae0ab97908.

BEGIN THIRD-PARTY FILE d4910aae0ab97908
````text
---
name: agent-analytics
description: "Analytics your AI agent can actually use. Track, analyze, run A/B experiments, and optimize across all your projects via CLI. Includes a growth playbook so your agent knows HOW to grow, not just what to track."
category: analytics
requires:
  env: [AGENT_ANALYTICS_API_KEY]
  bins: [npx]
---

# Agent Analytics — Analytics your agent can actually use

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.

**Website:** [agentanalytics.sh](https://agentanalytics.sh)
**GitHub:** [Agent-Analytics/agent-analytics](https://github.com/Agent-Analytics/agent-analytics)
**Docs:** [docs.agentanalytics.sh](https://docs.agentanalytics.sh)

## When to Use This Skill

- User wants to add analytics tracking to a website or app
- User wants to check how their projects are doing (traffic, conversions, engagement)
- User wants to run A/B experiments on headlines, CTAs, or flows
- User wants funnel analysis, retention cohorts, or traffic breakdowns
- User asks "how's my site doing?" or "are people visiting?"

## 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](https://agentanalytics.sh) and generate a key from the dashboard. Alternatively, self-host the open-source version from [GitHub](https://github.com/Agent-Analytics/agent-analytics).

If the project doesn't have tracking yet:

```bash
# 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 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. 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:

```bash
npx @agent-analytics/cli properties-received PROJECT_NAME
````
END THIRD-PARTY FILE d4910aae0ab97908

The third-party file has ended. Everything between the d4910aae0ab97908 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2803 of 8152 bytes. © davepoon · MIT · https://github.com/davepoon/buildwithclaude/tree/HEAD/plugins/all-skills/skills/agent-analytics/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
