By aneym
Track Claude Code usage: tools, hooks, skills, sessions. Sends to PostHog for team-wide analytics.
Track Claude Code usage with PostHog. See what tools your team uses, how long sessions last, which skills get invoked, and more.
| Event | Description |
|---|---|
cc_session_start/end | Session lifecycle and duration |
cc_tool_use | Core tool usage (Edit, Read, Bash, etc.) |
cc_mcp_call | MCP tool invocations by server |
cc_skill_invoke | Skill usage and arguments |
cc_subagent | Subagent spawning and completion |
cc_hook_execute | Hook execution timing |
/plugin marketplace add aneym/claude-code-analytics
/plugin install claude-code-analytics
Then run setup:
/claude-code-analytics:setup
Restart Claude Code to activate hooks.
git clone [email protected]:aneym/claude-code-analytics.git ~/.claude/plugins/claude-code-analytics
cd ~/.claude/plugins/claude-code-analytics
bun install
cp config.template.json config.json
# Edit config.json with your PostHog API key
Edit config.json (created by setup or manually):
{
"enabled": true,
"posthog": {
"apiKey": "phc_YOUR_PROJECT_KEY",
"host": "https://us.i.posthog.com"
},
"user": {
"email": "[email protected]",
"name": "Your Name",
"team": "engineering"
},
"tracking": {
"tools": true,
"mcp": true,
"skills": true,
"hooks": true,
"prompts": false,
"subagents": true
},
"privacy": {
"hashFilePaths": true,
"sanitizeCommands": true,
"truncatePrompts": 100
}
}
By default, the plugin protects sensitive data:
| Setting | Default | Effect |
|---|---|---|
hashFilePaths | true | SHA256 hash instead of full path |
sanitizeCommands | true | First word only (git, npm, curl) |
truncatePrompts | 100 | Max chars if prompt tracking enabled |
tracking.prompts | false | Prompt content NOT tracked by default |
File contents are never captured.
| Skill | Description |
|---|---|
/claude-code-analytics:setup | Configure API key and user details |
/claude-code-analytics:dashboard | View analytics summary |
Marketplace handles auto-updates. To manually update:
/plugin marketplace update
# Clone for development
git clone [email protected]:aneym/claude-code-analytics.git
cd claude-code-analytics
bun install
# Lint & typecheck
bun run check
# Test locally (without installing)
claude --plugin-dir .
Create these insights in PostHog:
tool_nameduration_msmcp_serverdistinct_idMIT
Matches all tools
Hooks run on every tool call, not just specific ones
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
npx claudepluginhub aneym/cc-analyticsTracks Claude Code session usage (tokens, costs, skills, MCP, subagents) and sends data to a self-hosted dashboard.
OTel + Hooks analytics for Claude Code. Run /init-claudalytics to configure telemetry and hooks capture for this project.
Track per-device Claude Code usage, rejection reasons, and per-session stats from a single dashboard.
Session analytics hook for Claude Code — 15 configurable sections (models, cost, cache, tools, files, git diff, RTK savings...)
Claude Code skill pack for PostHog (24 skills)
Visual dashboard for Claude Code & Codex — usage/token analysis of skills, agents, plugins, hooks, memory, MCP servers, rules, and principles