WP Manifestindependent plugin directory
manifest / analytics / wordpress-smart-dashboard-plugin

WP Smart Dashboard

WordPress plugin with analytics dashboard, REST API, interactive charts, and server monitoring. Built with PHP, MySQL, JavaScript & Chart.js.

by Your Name · github.com/dhairyadev26/wordpress-smart-dashboard-plugin · website

2stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/dhairyadev26/wordpress-smart-dashboard-plugin/archive/refs/heads/main.zip

Readme

🔥 WP Smart Dashboard

A comprehensive WordPress plugin that adds intelligent dashboard widgets displaying website analytics, blog statistics, and server health information with interactive charts and REST API integration.

� Screenshots

Dashboard Widget

Dashboard Widget

Settings Page

Settings Page

Interactive Charts

Charts

🌟 Features

📊 Analytics Dashboard

  • Real-time Statistics: Page views, unique visitors, bounce rate, session duration
  • Interactive Charts: Built with Chart.js for beautiful data visualization
  • Historical Data: 30-day analytics with daily breakdowns
  • Mock Data Integration: Realistic sample data for demonstration

📝 Blog Statistics

  • Content Metrics: Published posts, drafts, pending reviews
  • User Analytics: Total users, comments, and engagement stats
  • Recent Activity: Latest posts and comments with metadata
  • Posts Timeline: Monthly publication trends with visual charts

🖥️ Server Health Monitoring

  • System Information: PHP version, WordPress version, MySQL details
  • Performance Metrics: Memory usage, disk space, execution limits
  • Health Recommendations: Automated suggestions for optimization
  • Security Alerts: Outdated software and configuration warnings

REST API

  • Custom REST API endpoints for all dashboard data
  • Secure with WordPress nonces and permission checks
  • Endpoints:
    • /wp-json/smartdash/v1/stats - All statistics
    • /wp-json/smartdash/v1/blog-stats - Blog statistics only
    • /wp-json/smartdash/v1/analytics - Analytics data only
    • /wp-json/smartdash/v1/server-health - Server health only
    • /wp-json/smartdash/v1/posts-chart - Posts per month data

Settings Page

  • Customizable widget display options
  • Configurable refresh intervals
  • Analytics source selection (Mock data or Google Analytics - GA coming soon)
  • API testing functionality
  • Sample data management

Security & Best Practices

  • Input sanitization and validation
  • WordPress nonces for form security
  • Proper permission checks
  • Follows WordPress coding standards
  • Responsive design

📁 Project Structure

wp-smart-dashboard/
├── wp-smart-dashboard.php          # Main plugin file
├── includes/
│   ├── class-stats.php            # Statistics collection class
│   ├── rest-api.php               # REST API endpoints
│   └── class-settings.php         # Settings management
├── templates/
│   ├── dashboard-widget.php       # Dashboard widget template
│   └── settings-page.php          # Settings page template
├── assets/
│   ├── css/
│   │   └── admin.css              # Admin styles
│   └── js/
│       └── dashboard.js           # Dashboard JavaScript
└── README.md                      # This file

🛠 Installation

Method 1: Manual Installation

  1. Download or clone this repository
  2. Upload the wp-smart-dashboard folder to your /wp-content/plugins/ directory
  3. Activate the plugin through the 'Plugins' menu in WordPress
  4. Visit your WordPress dashboard to see the new "Smart Dashboard Stats" widget

Method 2: Development Setup

  1. Clone this repository into your WordPress plugins directory:
    cd /path/to/wordpress/wp-content/plugins/
    git clone https://github.com/dhairyadev26/Wordpress-Smart-Dashboard-Plugin.git wp-smart-dashboard
  2. Activate the plugin in WordPress admin
  3. Configure settings at Settings → WP Smart Dashboard

⚙️ Configuration

Settings Page

Navigate to Settings → WP Smart Dashboard to configure:

  • Widget Display Options: Choose which sections to show/hide
  • Refresh Interval: Set auto-refresh frequency (1 min to 1 hour)
  • Analytics Source: Currently uses mock data (Google Analytics integration planned)
  • API Testing: Test REST API endpoints

Dashboard Widget

The widget appears in your WordPress dashboard with sections for:

  • Website Analytics (with charts)
  • Blog Statistics (with recent activity)
  • Server Health (with recommendations)

🔧 Technical Implementation

Database

The plugin creates a custom table wp_smart_dashboard_analytics to store mock analytics data:

  • Daily page views and unique visitors
  • Bounce rates and session durations
  • 30 days of sample data on activation

REST API Usage

Access the API endpoints programmatically:

// Get all statistics
fetch('/wp-json/smartdash/v1/stats')
  .then(response => response.json())
  .then(data => console.log(data));

// Get only blog stats
fetch('/wp-json/smartdash/v1/blog-stats')
  .then(response => response.json())
  .then(data => console.log(data));

Hooks and Filters

The plugin provides several WordPress hooks for extensibility:

// Filter analytics data before display
add_filter('wp_smart_dashboard_analytics_data', 'custom_analytics_filter');

// Action after dashboard data is loaded
add_action('wp_smart_dashboard_data_loaded', 'custom_dashboard_action');

🎨 Customization

Styling

Override plugin styles in your theme:

/* Customize dashboard widget appearance */
.wp-smart-dashboard-stat-card {
    background: #your-color;
    border: 1px solid #your-border-color;
}

/* Customize chart colors */
.wp-smart-dashboard-chart-container canvas {
    /* Chart.js styling */
}

Extending Functionality

Add custom statistics by extending the WP_Smart_Dashboard_Stats class:

class My_Custom_Stats extends WP_Smart_Dashboard_Stats {
    public static function get_custom_stats() {
        // Your custom statistics logic
        return array(
            'custom_metric' => 'value'
        );
    }
}

🚀 Future Enhancements

Planned Features

  • Google Analytics Integration: Real analytics data from GA4
  • WooCommerce Stats: E-commerce metrics for online stores
  • Custom Metrics: User-defined statistics
  • Email Reports: Scheduled dashboard reports
  • Multi-site Support: Network-wide statistics
  • Export Functionality: CSV/PDF exports
  • Advanced Charts: More chart types and customization

Google Analytics Integration

Future versions will include:

  • OAuth2 authentication with Google
  • Real-time data from Google Analytics
  • Custom date ranges
  • Goal and conversion tracking

🐛 Troubleshooting

Common Issues

Widget not appearing

  • Check if plugin is activated
  • Verify user has admin permissions
  • Clear any caching plugins

API errors

  • Check WordPress REST API is enabled
  • Verify nonce security tokens
  • Test API endpoints in Settings page

Charts not loading

  • Ensure Chart.js is loading properly
  • Check browser console for JavaScript errors
  • Verify jQuery is available

Performance issues

  • Increase PHP memory limit if needed
  • Optimize refresh intervals
  • Check server resources

Debug Mode

Enable WordPress debug mode to troubleshoot:

// In wp-config.php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);

📊 Demo Data

The plugin includes sample analytics data for demonstration:

  • 30 days of mock page views and visitor data
  • Realistic bounce rates and session durations
  • Sample posts and comments for testing

Use the "Refresh Sample Data" button in settings to generate new demo data.

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Coding Standards

  • Follow WordPress Coding Standards
  • Use meaningful variable and function names
  • Comment complex logic
  • Test thoroughly before submitting

📝 License

This project is licensed under the GPL v2 or later - see the LICENSE file for details.

👨‍💻 Author

Dhairya Dev

🙏 Acknowledgments

  • WordPress community for excellent documentation
  • Chart.js for beautiful charts
  • All contributors and testers

📊 Project Stats


Star this repository if you find it useful!

Note: This plugin demonstrates WordPress development skills including PHP, MySQL, JavaScript, REST API, and WordPress best practices. It's designed to be recruiter-friendly and showcase full-stack development capabilities.

Made with ❤️ for the WordPress community

Read the full README on GitHub →