Description
Site Stats Dashboard is a simple WordPress plugin that displays your website’s statistics in the admin panel. It shows:
- The number of published posts.
- The number of approved comments.
- The total visit count (each front-end page load is counted).
The plugin uses the WordPress REST API to provide the statistics and renders the admin dashboard using React via the wp.element
package.
Features
- Admin Dashboard: A dedicated admin page accessible from the WordPress dashboard under the “Site Stats” menu.
- Live Statistics: Displays post count, comment count, and visit count.
- REST API Integration: Provides a custom REST API endpoint (
ssds/v1/stats
) that returns the site statistics. - React-Based UI: Uses React (via the built-in
wp.element
library) for the admin dashboard interface. - Visit Tracking: Tracks every front-end page load to increment the visit counter.
Usage
- Admin Panel: Once activated, click on the “Site Stats” menu item in the WordPress admin sidebar to see the statistics.
- REST API:
The plugin registers a REST API endpoint at:
http://your-site-url/wp-json/ssds/v1/stats
This endpoint returns a JSON response with the keys post_count
, comment_count
, and visit_count
.
Note: Access to the REST API endpoint is restricted to users with the manage_options
capability (typically administrators).
- Visit Tracking:
Every time a front-end page is loaded (excluding admin pages and AJAX requests), the plugin increments the visit counter. This means the visit count increases on every page load, not only for unique visitors.
License
This plugin is licensed under the GPLv2 or later.
Additional Notes
- The admin dashboard interface is built using React without a build process (JSX is not used). If you later decide to use JSX or more advanced React features, you’ll need to integrate a build system (e.g., webpack with Babel).
- Ensure you are logged in as an administrator (or a user with the
manage_options
capability) when accessing the plugin dashboard or the REST API endpoint.
Installation
-
Download and Upload:
- Download the plugin files and unzip the archive.
- Upload the entire
site-stats-dashboard
folder to the/wp-content/plugins/
directory on your WordPress site.
-
Activate the Plugin:
- Go to the Plugins page in your WordPress admin panel.
- Find Site Stats Dashboard in the list and click Activate.
-
Access the Dashboard:
- In the admin panel, navigate to Site Stats (located in the left-hand menu) to view the statistics dashboard.
FAQ
-
Does the plugin track unique visitors?
-
No, the current implementation simply increments the counter on each page load. It does not differentiate between unique and repeat visitors.
-
What statistics does the plugin display?
-
It displays:
– The total number of published posts (only the default “post” post type).
– The total number of approved comments.
– The total number of page visits (incremented on every front-end load). -
Can I extend this plugin?
-
Yes, the plugin is designed as a starting point. You can modify or extend it to track additional statistics or refine the visit tracking logic (e.g., counting only unique visitors).
Reviews
There are no reviews for this plugin.
Contributors & Developers
“Site Stats Dashboard” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “Site Stats Dashboard” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
1.0
- Initial release:
- Admin page to display site statistics.
- REST API endpoint for fetching stats.
- React-based admin interface.
- Front-end visit tracking.