analytics.md +172 −47
2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt
3> Use this file to discover all available pages before exploring further.3> Use this file to discover all available pages before exploring further.
4 4
55# Analytics# Track team usage with analytics
6 6
77> View detailed usage insights and productivity metrics for your organization's Claude Code deployment.> View Claude Code usage metrics, track adoption, and measure engineering velocity in the analytics dashboard.
8 8
99Claude Code provides an analytics dashboard that helps organizations understand developer usage patterns, track productivity metrics, and optimize their Claude Code adoption.Claude Code provides analytics dashboards to help organizations understand developer usage patterns, track contribution metrics, and measure how Claude Code impacts engineering velocity. Access the dashboard for your plan:
10 10
1111<Note>| Plan | Dashboard URL | Includes | Read more |
1212 Analytics are currently available only for organizations using Claude Code with the Claude API through the Claude Console.| ----------------------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ----------------------------------------------------- |
1313</Note>| Claude for Teams / Enterprise | [claude.ai/analytics/claude-code](https://claude.ai/analytics/claude-code) | Usage metrics, contribution metrics with GitHub integration, leaderboard, data export | [Details](#access-analytics-for-teams-and-enterprise) |
14| API (Claude Console) | [platform.claude.com/claude-code](https://platform.claude.com/claude-code) | Usage metrics, spend tracking, team insights | [Details](#access-analytics-for-api-customers) |
14 15
1516## Access analytics## Access analytics for Teams and Enterprise
16 17
1718Navigate to the analytics dashboard at [console.anthropic.com/claude-code](https://console.anthropic.com/claude-code).Navigate to [claude.ai/analytics/claude-code](https://claude.ai/analytics/claude-code). Admins and Owners can view the dashboard.
18 19
1920### Required rolesThe Teams and Enterprise dashboard includes:
20 21
2122* **Primary Owner*** **Usage metrics**: lines of code accepted, suggestion accept rate, daily active users and sessions
2223* **Owner*** **Contribution metrics**: PRs and lines of code shipped with Claude Code assistance, with [GitHub integration](#enable-contribution-metrics)
2324* **Billing*** **Leaderboard**: top contributors ranked by Claude Code usage
2425* **Admin*** **Data export**: download contribution data as CSV for custom reporting
2526* **Developer**
27### Enable contribution metrics
26 28
27<Note>29<Note>
2830 Users with **User**, **Claude Code User** or **Membership Admin** roles cannot access analytics. Contribution metrics are in public beta and available on Claude for Teams and Claude for Enterprise plans.
29</Note>31</Note>
30 32
3133## Available metricsUsage and adoption data is available for all Claude for Teams and Claude for Enterprise accounts. Contribution metrics require additional setup to connect your GitHub organization.
34
35You need the Owner role to configure analytics settings. A GitHub admin must install the GitHub app.
36
37<Steps>
38 <Step title="Install the GitHub app">
39 A GitHub admin installs the Claude GitHub app on your organization's GitHub account at [github.com/apps/claude](https://github.com/apps/claude).
40 </Step>
41
42 <Step title="Enable Claude Code analytics">
43 A Claude Owner navigates to [claude.ai/admin-settings/claude-code](https://claude.ai/admin-settings/claude-code) and enables the Claude Code analytics feature.
44 </Step>
45
46 <Step title="Enable GitHub analytics">
47 On the same page, enable the "GitHub analytics" toggle.
48 </Step>
49
50 <Step title="Authenticate with GitHub">
51 Complete the GitHub authentication flow and select which GitHub organizations to include in the analysis.
52 </Step>
53</Steps>
54
55Data typically appears within 24 hours after enabling, with daily updates. If no data appears, you may see one of these messages:
56
57* **"GitHub app required"**: install the GitHub app to view contribution metrics
58* **"Data processing in progress"**: check back in a few days and confirm the GitHub app is installed if data doesn't appear
59
60Contribution metrics support GitHub Cloud and GitHub Enterprise Server.
61
62### Review summary metrics
63
64The dashboard displays these summary metrics at the top:
65
66* **PRs with CC**: total count of merged pull requests that contain at least one line of code written with Claude Code
67* **Lines of code with CC**: total lines of code across all merged PRs that were written with Claude Code assistance. Only "effective lines" are counted: lines with more than 3 characters after normalization, excluding empty lines and lines with only brackets or trivial punctuation.
68* **PRs with Claude Code (%)**: percentage of all merged PRs that contain Claude Code-assisted code
69* **Suggestion accept rate**: percentage of times users accept Claude Code's code editing suggestions, including Edit, Write, and NotebookEdit tool usage
70* **Lines of code accepted**: total lines of code written by Claude Code that users have accepted in their sessions. This excludes rejected suggestions and does not track subsequent deletions.
71
72### Explore the charts
73
74The dashboard includes several charts to visualize trends over time.
75
76#### Track adoption
77
78The Adoption chart shows daily usage trends:
79
80* **users**: daily active users
81* **sessions**: number of active Claude Code sessions per day
82
83#### Measure PRs per user
84
85This chart displays individual developer activity over time:
86
87* **PRs per user**: total number of PRs merged per day divided by daily active users
88* **users**: daily active users
89
90Use this to understand how individual productivity changes as Claude Code adoption increases.
91
92#### View pull requests breakdown
93
94The Pull requests chart shows a daily breakdown of merged PRs:
32 95
3396### Lines of code accepted* **PRs with CC**: pull requests containing Claude Code-assisted code
97* **PRs without CC**: pull requests without Claude Code-assisted code
34 98
3599Total lines of code written by Claude Code that users have accepted in their sessions.Toggle to **Lines of code** view to see the same breakdown by lines of code rather than PR count.
36 100
37101* Excludes rejected code suggestions#### Find top contributors
38* Doesn't track subsequent deletions
39 102
40103### Suggestion accept rateThe Leaderboard shows the top 10 users ranked by contribution volume. Toggle between:
41 104
42105Percentage of times users accept code editing tool usage, including:* **Pull requests**: shows PRs with Claude Code vs All PRs for each user
106* **Lines of code**: shows lines with Claude Code vs All lines for each user
43 107
44108* EditClick **Export all users** to download complete contribution data for all users as a CSV file. The export includes all users, not just the top 10 displayed.
45* Write
46* NotebookEdit
47 109
48110### Activity### PR attribution
49 111
50112**users**: Number of active users in a given day (number on left Y-axis)When contribution metrics are enabled, Claude Code analyzes merged pull requests to determine which code was written with Claude Code assistance. This is done by matching Claude Code session activity against the code in each PR.
51 113
52114**sessions**: Number of active sessions in a given day (number on right Y-axis)#### Tagging criteria
53 115
54116### SpendPRs are tagged as "with Claude Code" if they contain at least one line of code written during a Claude Code session. The system uses conservative matching: only code where there is high confidence in Claude Code's involvement is counted as assisted.
55 117
56118**users**: Number of active users in a given day (number on left Y-axis)#### Attribution process
57 119
58120**spend**: Total dollars spent in a given day (number on right Y-axis)When a pull request is merged:
59 121
60122### Team insights1. Added lines are extracted from the PR diff
1232. Claude Code sessions that edited matching files within a time window are identified
1243. PR lines are matched against Claude Code output using multiple strategies
1254. Metrics are calculated for AI-assisted lines and total lines
61 126
62127**Members**: All users who have authenticated to Claude CodeBefore comparison, lines are normalized: whitespace is trimmed, multiple spaces are collapsed, quotes are standardized, and text is converted to lowercase.
63 128
64129* API key users are displayed by **API key identifier**Merged pull requests containing Claude Code-assisted lines are labeled as `claude-code-assisted` in GitHub.
65* OAuth users are displayed by **email address**
66 130
67131**Spend this month:** Per-user total spend for the current month.#### Time window
68 132
69133**Lines this month:** Per-user total of accepted code lines for the current month.Sessions from 21 days before to 2 days after the PR merge date are considered for attribution matching.
70 134
71135## Using analytics effectively#### Excluded files
72 136
73137### Monitor adoptionCertain files are automatically excluded from analysis because they are auto-generated:
74 138
75139Track team member status to identify:* Lock files: package-lock.json, yarn.lock, Cargo.lock, and similar
140* Generated code: Protobuf outputs, build artifacts, minified files
141* Build directories: dist/, build/, node\_modules/, target/
142* Test fixtures: snapshots, cassettes, mock data
143* Lines over 1,000 characters, which are likely minified or generated
144
145#### Attribution notes
146
147Keep these additional details in mind when interpreting attribution data:
148
149* Code substantially rewritten by developers, with more than 20% difference, is not attributed to Claude Code
150* Sessions outside the 21-day window are not considered
151* The algorithm does not consider the PR source or destination branch when performing attribution
152
153### Get the most from analytics
154
155Use contribution metrics to demonstrate ROI, identify adoption patterns, and find team members who can help others get started.
156
157#### Monitor adoption
158
159Track the Adoption chart and user counts to identify:
76 160
77* Active users who can share best practices161* Active users who can share best practices
78* Overall adoption trends across your organization162* Overall adoption trends across your organization
163* Dips in usage that may indicate friction or issues
164
165#### Measure ROI
166
167Contribution metrics help answer "Is this tool worth the investment?" with data from your own codebase:
168
169* Track changes in PRs per user over time as adoption increases
170* Compare PRs and lines of code shipped with vs. without Claude Code
171* Use alongside [DORA metrics](https://dora.dev/), sprint velocity, or other engineering KPIs to understand changes from adopting Claude Code
172
173#### Identify power users
174
175The Leaderboard helps you find team members with high Claude Code adoption who can:
176
177* Share prompting techniques and workflows with the team
178* Provide feedback on what's working well
179* Help onboard new users
79 180
80181### Measure productivity#### Access data programmatically
81 182
82183Tool acceptance rates and code metrics help you:To query this data through GitHub, search for PRs labeled with `claude-code-assisted`.
83 184
84185* Understand developer satisfaction with Claude Code suggestions## Access analytics for API customers
85186* Track code generation effectiveness
86187* Identify opportunities for training or process improvementsAPI customers using the Claude Console can access analytics at [platform.claude.com/claude-code](https://platform.claude.com/claude-code). You need the UsageView permission to access the dashboard, which is granted to Developer, Billing, Admin, Owner, and Primary Owner roles.
188
189<Note>
190 Contribution metrics with GitHub integration are not currently available for API customers. The Console dashboard shows usage and spend metrics only.
191</Note>
192
193The Console dashboard displays:
194
195* **Lines of code accepted**: total lines of code written by Claude Code that users have accepted in their sessions. This excludes rejected suggestions and does not track subsequent deletions.
196* **Suggestion accept rate**: percentage of times users accept code editing tool usage, including Edit, Write, and NotebookEdit tools.
197* **Activity**: daily active users and sessions shown on a chart.
198* **Spend**: daily API costs in dollars alongside user count.
199
200### View team insights
201
202The team insights table shows per-user metrics:
203
204* **Members**: all users who have authenticated to Claude Code. API key users display by key identifier, OAuth users display by email address.
205* **Spend this month**: per-user total API costs for the current month.
206* **Lines this month**: per-user total of accepted code lines for the current month.
207
208<Note>
209 Spend figures in the Console dashboard are estimates for analytics purposes. For actual costs, refer to your billing page.
210</Note>
87 211
88## Related resources212## Related resources
89 213
90214* [Monitoring usage with OpenTelemetry](/en/monitoring-usage) for custom metrics and alerting* [Monitoring with OpenTelemetry](/en/monitoring-usage): export real-time metrics and events to your observability stack
91215* [Identity and access management](/en/iam) for role configuration* [Manage costs effectively](/en/costs): set spend limits and optimize token usage
216* [Identity and access management](/en/iam): configure roles and permissions