The Analytics Dashboard provides comprehensive visualization and insights into tip statistics, trends, and platform activity. It includes interactive charts, date range filtering, and data export capabilities.
Four key metrics displayed prominently:
- Total Tips: Total number of tips sent on the platform
- Total Volume: Aggregate STX volume across all tips
- Average Tip: Mean tip amount in STX
- Unique Users: Combined count of unique senders and recipients
Interactive time-series visualization showing:
- Number of tips per day
- Volume (STX) per day
- Dual Y-axis for tips count and volume
- Toggle between line and bar chart views
- Responsive design for mobile and desktop
Horizontal bar chart and detailed rankings showing:
- Top 10 senders by volume
- Number of tips sent
- Total volume sent
- Abbreviated addresses with full address on hover
Horizontal bar chart and detailed rankings showing:
- Top 10 recipients by volume
- Number of tips received
- Total volume received
- Abbreviated addresses with full address on hover
Flexible date filtering with:
- Custom start and end date selection
- Quick preset buttons (7, 30, 90 days)
- Apply and reset functionality
- Real-time data updates
Export analytics data in multiple formats:
- CSV: Time-series data for spreadsheet analysis
- JSON: Complete analytics data including all metrics
Returns comprehensive analytics data with optional date filtering.
Query Parameters:
startDate(optional): ISO 8601 date string for range startendDate(optional): ISO 8601 date string for range end
Response:
{
"summary": {
"totalTips": 1234,
"totalVolume": 5000000000,
"totalFees": 50000000,
"avgTipAmount": 4048582,
"uniqueSenders": 456,
"uniqueRecipients": 789
},
"topSenders": [
{
"address": "SP1ABC...",
"count": 50,
"volume": 250000000
}
],
"topRecipients": [
{
"address": "SP2DEF...",
"count": 75,
"volume": 300000000
}
],
"timeSeriesData": [
{
"date": "2024-01-15",
"count": 25,
"volume": 100000000
}
]
}Main dashboard component that orchestrates all sub-components and manages state.
Displays summary statistics in card format with icons.
Line/bar chart showing tip volume over time using Recharts.
Horizontal bar chart and rankings for top senders.
Horizontal bar chart and rankings for top recipients.
Date range selection with presets and custom dates.
Dropdown menu for exporting data in CSV or JSON format.
Utility functions for:
fetchAnalytics(startDate, endDate): Fetch analytics data from APIfetchStats(): Fetch basic statisticsformatAmount(amount): Format microSTX to STXformatAddress(address): Abbreviate Stacks addressesexportToCSV(data, filename): Export data as CSVexportToJSON(data, filename): Export data as JSON
- Mobile-first approach
- Grid layouts adapt to screen size
- Charts scale appropriately
- Touch-friendly controls
- Blue: Primary actions and tip counts
- Green: Volume and financial metrics
- Purple: Recipients
- Orange: User metrics
- Smooth transitions on hover
- Loading states with pulse animation
- Slide-down menu animations
- Fade-in tooltips
Navigate to /analytics or click "Analytics" in the main navigation.
- Click on the date inputs to select custom dates
- Or use preset buttons for common ranges
- Click "Apply" to update the dashboard
- Click "Reset" to clear filters
- Click the "Export Data" button
- Select CSV or JSON format
- File downloads automatically with timestamp
- Hover over data points for detailed tooltips
- Toggle between line and bar views
- Charts are fully responsive
- recharts: Chart library for data visualization
- lucide-react: Icon library
- react-router-dom: Routing
- Lazy loading of chart components
- Efficient data aggregation on backend
- Memoized calculations
- Optimized re-renders
- Modern browsers (Chrome, Firefox, Safari, Edge)
- Mobile browsers (iOS Safari, Chrome Mobile)
- Responsive down to 320px width
Run analytics tests:
npm test -- analytics.test.jsTests cover:
- API endpoint responses
- Date filtering
- Data structure validation
- Top senders/recipients limits
- Summary calculations
Potential improvements:
- Real-time updates via WebSocket
- More chart types (pie, scatter)
- Advanced filtering (by address, amount range)
- Comparison views (period over period)
- Downloadable PDF reports
- Scheduled email reports
- Custom dashboard layouts
- Saved filter presets
- Check browser console for errors
- Verify API endpoint is accessible
- Ensure data is being returned
- Verify date format is correct
- Check that dates are within valid range
- Ensure API supports date parameters
- Check browser download settings
- Verify popup blocker is not interfering
- Ensure data exists to export
When adding new analytics features:
- Update API endpoint if needed
- Add corresponding tests
- Update this documentation
- Ensure responsive design
- Add appropriate error handling