Analytics Overview
Analytics data is collected for:- Project views - Page visits to your project
- Downloads - File downloads across versions
- Playtime - Time users spend with your project installed
- Revenue - Earnings from creator programs (requires
PAYOUTS_READscope)
Permission Requirements
API scope for viewing analytics dataRequired for:
- View counts
- Download counts
- Playtime statistics
Project permission to access analyticsYou must have this permission on projects you want to view analytics for.
Additional scope for viewing revenueRequired only if you want to see revenue/monetization data.
Fetching Analytics
Analytics Request
Fetch analytics data using the unified analytics endpoint:Time Range Configuration
Start of analytics period (ISO 8601 format)Example:
"2024-01-01T00:00:00Z"End of analytics period (ISO 8601 format)Must be after start time.
Example:
"2024-01-31T23:59:59Z"How to divide the time range into bucketsTwo options:By number of slices:Creates 30 equal time periods. Resolution is calculated automatically.By time duration:Each slice is 60 minutes. Number of slices calculated automatically.Constraints:
- Minimum resolution: 60 minutes
- Maximum slices: 1024
Metric Types
Project Views
Track page views to your project:Group views by these dimensions:
project_id- Which project was vieweddomain- Referrer domain (e.g., “youtube.com”, “discord.com”)site_path- Modrinth path visited (e.g., “/mod/sodium”)monetized- Whether views were monetizable (boolean)country- User’s country (anonymized to “XX” if < 50 views)
[] to aggregate all views together.Project Downloads
Track downloads of your project files:Group downloads by:
project_id- Which project was downloadedversion_id- Specific version downloadeddomain- Referrer domainsite_path- Download page pathcountry- User’s country (anonymized if < 50 downloads)
Project Playtime
Track how long users play with your project:Group playtime by:
project_id- Which projectversion_id- Which versionloader- Mod loader used (e.g., “fabric”, “forge”)game_version- Game version (e.g., “1.20.1”)
Project Revenue
Track earnings from your project (requiresPAYOUTS_READ scope):
Group revenue by:
project_id- Which project generated revenue
project_id is supported.Response Format
The response is an array of time slices:bucket_by fields.
Affiliate Code Analytics
Track performance of your affiliate codes:Affiliate Clicks
Affiliate Conversions
Affiliate Revenue
PAYOUTS_READ).
Example: Complete Analytics Request
Data Privacy and Anonymization
Modrinth respects user privacy:Country Data
- Countries with < 50 views/downloads are reported as
XX - Prevents identifying individual users from small countries
- Aggregate data remains accurate
Time Slices
- Data is bucketed into time periods
- Individual timestamps are not exposed
- Minimum resolution of 60 minutes
Allowed Projects
You can only fetch analytics for:- Projects where you have
VIEW_ANALYTICSpermission - As a team member or organization member
- The API automatically filters your projects
Understanding Monetization
Themonetized field in views indicates:
true- View counted toward creator revenuefalse- View did not generate revenue (e.g., from blocked regions, bot traffic)null- When not bucketing bymonetized
Best Practices
- Limit time ranges - Shorter ranges load faster and use fewer resources
- Choose appropriate resolution - Daily for month view, hourly for day view
- Bucket only what you need - Fewer dimensions = faster queries
- Cache results - Analytics data doesn’t change frequently
- Aggregate client-side - If you need custom groupings, post-process the data
- Monitor trends - Compare periods to identify growth or issues
Analytics Dashboard
Access analytics via the web UI:- Visual charts and graphs
- Downloads over time
- Top referrers
- Geographic distribution
- Revenue tracking
Rate Limits
Analytics endpoints have standard rate limits:- Respect the
X-RateLimit-*headers - Cache results when possible
- Fetch only the data you need
Troubleshooting
No data returned- Ensure you have
VIEW_ANALYTICSpermission on projects - Check that projects had activity in the time range
- Verify you’re using the correct project IDs
- Minimum resolution is 60 minutes
- Reduce number of slices or increase time range
- Maximum 1024 slices
- Use larger time increments or shorter range
- Requires
PAYOUTS_READscope in API token - Revenue only available for monetized projects
- May have 24-48 hour delay for processing
