Stats for WordPress® is a lightweight analytics plugin designed to provide insights into your website's performance directly from the WordPress® admin dashboard.
Track page views, unique visits, and referrers without relying on third-party services.
Your data, period.
- Simple Analytics Tracking: Logs page views, unique visits, and referrers.
- Exclusion Rules: Automatically excludes admin pages, crawlers, bots, and non-content paths (e.g., static assets, API requests).
- Admin Dashboard Visualization: Provides clear data visualization for page views and referrers.
- Historical Data Export: Download stats as a CSV file for further analysis.
- 404 Tracking: Logs visits to non-existent pages for debugging purposes.
- Download the plugin from GitHub.
- Upload the plugin files to the
/wp-content/plugins/stats-for-wordpress/directory. - Activate the plugin through the 'Plugins' menu in WordPress®.
- Visit the Stats section in your WordPress® admin dashboard to view analytics.
- Navigate to the Stats menu in your WordPress® admin dashboard to:
- View daily unique and all visits for the past 7 days.
- See the most visited pages on your site.
- Analyze the top referrers sending traffic to your site.
- Click the Download CSV button on the stats page to export historical data for a custom date range.
- Append
?delete_stats=1to your admin URL (e.g.,https://example.com/wp-admin/admin.php?page=sfwp-stats&delete_stats=1) to clear all recorded stats.
- WordPress® core pages and assets:
/favicon.ico,/robots.txt,/sitemap.xml,/wp-json/, etc.
- Static files (e.g.,
.css,.js,.jpg). - Admin pages and AJAX endpoints.
- Feeds and query patterns (e.g.,
?utm_,?ver=).
- Common search engine bots (e.g., Googlebot, Bingbot).
- SEO tools (e.g., AhrefsBot, SemrushBot).
- Scrapers and crawlers (e.g.,
curl,wget). - Headless browsers and security tools.
The plugin creates a custom database table to store analytics data:
| Field | Type | Description |
|---|---|---|
id |
BIGINT(20) | Auto-incremented unique ID. |
date |
DATE | Date of the visit. |
page |
VARCHAR(255) | The URL path of the visited page. |
referrer |
VARCHAR(255) | Referring URL, if available. |
unique_visits |
INT(11) | Count of unique visitors. |
all_visits |
INT(11) | Total visit count (includes repeats). |
wp: Logs page visits, excluding non-content requests.register_activation_hook: Creates or updates the database table during activation.admin_post_sfwp_download_stats: Handles CSV downloads.admin_init: Deletes all stats if triggered via a query parameter.
None currently available.
You can add more excluded paths by modifying the $excluded_paths array in the sfwp_log_visit() function.
To exclude additional bots, add their user-agent strings to the $crawlers array in the sfwp_is_crawler() function.
- Ensure the plugin is activated.
- Check if the database table
wp_sfwp_statsexists. If not, deactivate and reactivate the plugin.
- Ensure the page URLs are not part of the excluded paths or patterns.
- Ensure the plugin is properly filtering internal referrers. If you use multiple domains, add them to the internal referrer check in
sfwp_log_visit().
Contributions are welcome!
- Fork the repository on GitHub: Stats for WordPress.
- Submit a pull request with your proposed changes.
This plugin is licensed under the GPL-2.0+.
You are free to use, modify, and distribute it under the terms of the GNU General Public License.
For support, visit Robert DeVore's website or open an issue on the GitHub repository.