A Python-based dashboard generator for analyzing Cursor AI usage within teams. Generate beautiful HTML reports showing usage statistics, trends, and team insights.
Here's what the dashboard looks like:
- Team Analytics: Generate comprehensive usage reports for your entire team
- Predefined Groups: Create reports for specific groups (AI Champions, Engineering, QA, etc.)
- Interactive Dashboards: Beautiful HTML reports with charts and visualizations
- Flexible Filtering: Include/exclude specific users, analyze custom date ranges
- Command Line Interface: Easy-to-use CLI for quick report generation
- Python 3.8+
- uv package manager
-
Clone the repository:
gh repo clone galprz/cursor-analytics cd cursor-analytics
Or using git directly:
git clone https://github.com/galprz/cursor-analytics.git cd cursor-analytics
-
Install dependencies:
uv sync
-
Set up environment variables:
cp .env.example .env
Edit
.env
and add your configuration (see Environment Setup)
# Generate report for all team members
uv run python generate_live_dashboard.py
# Generate report for AI Champions group
uv run python generate_live_dashboard.py --group ai_champs
# Generate report for specific group with custom time period
uv run python generate_live_dashboard.py --group engineering --days 14
# List all available groups
uv run python generate_live_dashboard.py --list-groups
Create a .env
file in the project root with the following variables:
# Cursor Admin Authentication Cookie
# Required: Get this from your browser's developer tools when logged into Cursor Admin
CURSOR_COOKIE_STRING="your_cookie_string_here"
# Team Configuration
# Required: Your team ID from Cursor Admin
CURSOR_TEAM_ID=1234567
# Report Configuration (Optional)
# Default number of days to analyze
DEFAULT_DAYS=7
# Optional: Custom excluded emails (comma-separated)
EXCLUDED_EMAILS="user1@example.com,user2@example.com"
- Log into Cursor Admin Dashboard
- Open Developer Tools (F12)
- Go to Network tab
- Refresh the page
- Find any request to
cursor.com
- Copy the entire
Cookie
header value - Add it to your
.env
file asCURSOR_COOKIE_STRING
- In Cursor Admin Dashboard, check the URL
- The team ID appears in URLs like:
https://cursor.com/admin/team/1234567
- Use that number as your
CURSOR_TEAM_ID
Configure team groups in generate_live_dashboard.py
:
PREDEFINED_GROUPS = {
"ai_champs": [
"user1@example.com",
"user2@example.com",
# Add your AI champions here
],
"engineering": [
# Add engineering team emails
],
"management": [
# Add management team emails
],
# ... other groups
}
# All team members (default)
uv run python generate_live_dashboard.py
# Specific group
uv run python generate_live_dashboard.py --group ai_champs
uv run python generate_live_dashboard.py -g engineering
# Custom time period
uv run python generate_live_dashboard.py --days 30
uv run python generate_live_dashboard.py -d 14
# List available groups
uv run python generate_live_dashboard.py --list-groups
# Custom team ID
uv run python generate_live_dashboard.py --team-id 1234567
# AI Champions report for last 30 days
uv run python generate_live_dashboard.py -g ai_champs -d 30
# Engineering team report for last 14 days
uv run python generate_live_dashboard.py -g engineering -d 14
# Management report with custom team ID
uv run python generate_live_dashboard.py -g management --team-id 1234567
Reports are generated in the reports/
directory with timestamped filenames:
reports/
├── cursor_analytics_live_ai_champs_20240705_1556.html
├── cursor_analytics_live_engineering_20240705_1627.html
└── cursor_analytics_live_all_20240705_1641.html
- Lines of Agent: Total lines of AI-generated code
- Chat Interactions: Number of chat sessions with Cursor AI
- Tab Completions: Autocomplete suggestions accepted
- Active Users: Team members using Cursor regularly
- Weekly Trends: Line charts showing activity over time
- User Filtering: Toggle individual users on/off in charts
- Multiple Views: Switch between Lines, Chats, and Completions
- Growth Tracking: Week-over-week percentage changes
- Top Performers: Ranked by total lines of agent code
- Growth Champions: Biggest week-over-week improvements
- Persistence Leaders: Most consistent daily usage (500+ lines/day)
- User Performance: Comprehensive metrics per team member
- Usage Distribution: Pie chart showing feature adoption
- Export Functionality: Download data as JSON for further analysis
cursor-analytics-portal/
├── cursor_admin_sdk/ # Cursor Admin API SDK
│ ├── client.py # Main API client
│ ├── models.py # Data models
│ └── exceptions.py # Custom exceptions
├── generate_live_dashboard.py # Main dashboard generator
├── email_mapping.json # User email to ID mappings (auto-generated)
├── reports/ # Generated HTML reports
├── screenshots/ # Dashboard screenshots
├── .env # Environment configuration
└── pyproject.toml # Project dependencies
Error: CursorAuthError: Authentication failed
Solutions:
- Refresh your cookie string from browser
- Ensure you're logged into Cursor Admin
- Check cookie expiration
Error: Group 'xyz' not found
Solutions:
- Run
--list-groups
to see available groups - Check spelling of group name
- Add the group to
PREDEFINED_GROUPS
if needed
Issue: Report shows no data
Solutions:
- Verify team ID is correct
- Check if users have any Cursor usage in the specified period
- Ensure email addresses in groups are correct
- Edit
PREDEFINED_GROUPS
ingenerate_live_dashboard.py
- Add group name and email list:
"new_group": [ "user1@example.com", "user2@example.com" ]
- Modify HTML templates in
_generate_template_inline()
method - Adjust chart configurations in the template
- Add new metrics by extending the analytics aggregation
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
For issues and questions:
- Check the troubleshooting section
- Review existing issues
- Create a new issue with detailed information