Chameleon

Credit Statistics

View comprehensive credit system statistics and transaction history

Credit Statistics

The Credit Statistics dashboard provides administrators with comprehensive insights into the credit system's performance, user activity, and transaction patterns.

Overview

The statistics dashboard displays:

  • Total Credits Granted: Sum of all credits given to users
  • Total Credits Consumed: Sum of all credits used by users
  • Active Users: Number of users with credit transactions
  • Net Credits: Difference between granted and consumed credits
  • Recent Transactions: Latest credit transactions
  • Credit Distribution: Breakdown by transaction type

Key Metrics

Credit Overview Cards

Total Credits Granted

  • Purpose: Shows total credits distributed to users
  • Calculation: Sum of all positive credit transactions
  • Display: Green indicator with upward arrow
  • Includes: Registration bonuses, purchase bonuses, manual grants

Total Credits Consumed

  • Purpose: Shows total credits used by users
  • Calculation: Sum of all negative credit transactions
  • Display: Red indicator with downward arrow
  • Includes: AI generation costs, system operations

Active Users

  • Purpose: Shows users with credit activity
  • Calculation: Count of unique users with transactions
  • Display: Blue indicator with user icon
  • Note: Users with zero balance but transaction history

Net Credits

  • Purpose: Shows system credit balance
  • Calculation: Granted credits minus consumed credits
  • Display: Purple indicator with coin icon
  • Usage: Monitor overall system credit health

Transaction History

Recent Transactions Table

Displays the latest credit transactions with:

  • Time: Transaction timestamp
  • User: User UUID (truncated for privacy)
  • Type: Transaction type with color-coded badges
  • Credits: Amount with positive/negative formatting
  • Order No: Associated order number (if applicable)
  • Transaction No: Unique transaction identifier

Transaction Types

  • New User: Registration bonus (green)
  • Order Pay: Purchase bonus (blue)
  • AI Generation: AI usage cost (purple)
  • Ping: System ping cost (orange)
  • System Add: Manual admin grant (emerald)
  • System Subtract: Manual admin deduction (red)

Credit Distribution

Type Distribution Chart

Shows credit amounts by transaction type:

  • Visual Breakdown: Credits distributed across different types
  • Usage Patterns: Identify most common transaction types
  • System Health: Monitor credit flow patterns

System Overview

  • Credit Balance: Current system credit balance
  • Utilization Rate: Percentage of granted credits consumed
  • Average per User: Net credits per active user

Usage

Accessing Statistics

  1. Navigate to Admin SystemCredit Stats
  2. View real-time statistics and charts
  3. Click Refresh to update data
  4. Analyze transaction patterns and trends

Interpreting Data

Healthy Credit System

  • Balanced Flow: Reasonable ratio of granted to consumed
  • Active Users: Growing number of users with transactions
  • Diverse Types: Multiple transaction types represented

Warning Signs

  • High Consumption: Credits consumed faster than granted
  • Low Utilization: Many granted credits unused
  • Single Type Dominance: One transaction type overwhelming others

Monitoring Trends

Daily Monitoring

  • Check total credits granted vs consumed
  • Monitor active user growth
  • Review recent transaction patterns

Weekly Analysis

  • Analyze credit distribution changes
  • Identify usage pattern shifts
  • Review system health metrics

File Locations

  • Admin Interface: src/app/[locale]/(admin)/admin/credit-stats/page.tsx
  • API Routes: src/app/api/admin/credit-stats/
  • Types: src/types/credit-config.ts
  • Models: src/models/credit.ts

Common Tasks

Daily Credit Review

  1. Check total credits granted and consumed
  2. Review recent transactions for anomalies
  3. Monitor active user count
  4. Verify system credit balance

Weekly Analysis

  1. Analyze credit distribution patterns
  2. Review utilization rates
  3. Identify trending transaction types
  4. Plan credit rule adjustments

Monthly Reporting

  1. Generate comprehensive credit reports
  2. Analyze user engagement patterns
  3. Review system performance metrics
  4. Plan credit system optimizations

Troubleshooting

Statistics Not Loading

  • API Issues: Check admin credit stats API endpoint
  • Database Connection: Verify database connectivity
  • Permissions: Ensure admin user has proper access

Inaccurate Data

  • Transaction Sync: Verify all transactions are properly recorded
  • Rule Application: Check credit rules are correctly applied
  • Data Integrity: Review database for missing transactions

Performance Issues

  • Large Datasets: Consider pagination for transaction history
  • Database Optimization: Index credit transaction tables
  • Caching: Implement caching for frequently accessed statistics