{"id":23653043,"url":"https://github.com/robertdevore/stats-for-wordpress","last_synced_at":"2025-09-01T04:31:38.380Z","repository":{"id":266402868,"uuid":"889803016","full_name":"robertdevore/stats-for-wordpress","owner":"robertdevore","description":"Stats for WordPress®","archived":false,"fork":false,"pushed_at":"2024-12-04T04:25:46.000Z","size":93,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-04T05:23:30.516Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robertdevore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-17T09:24:45.000Z","updated_at":"2024-12-04T04:25:50.000Z","dependencies_parsed_at":"2024-12-04T05:33:47.182Z","dependency_job_id":null,"html_url":"https://github.com/robertdevore/stats-for-wordpress","commit_stats":null,"previous_names":["robertdevore/stats-for-wordpress"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertdevore%2Fstats-for-wordpress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertdevore%2Fstats-for-wordpress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertdevore%2Fstats-for-wordpress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertdevore%2Fstats-for-wordpress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robertdevore","download_url":"https://codeload.github.com/robertdevore/stats-for-wordpress/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231658610,"owners_count":18407083,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-28T17:40:04.758Z","updated_at":"2024-12-28T17:40:05.380Z","avatar_url":"https://github.com/robertdevore.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stats for WordPress®\n\nStats for WordPress® is a lightweight analytics plugin designed to provide insights into your website's performance directly from the WordPress® admin dashboard. \n\nTrack page views, unique visits, and referrers without relying on third-party services.\n\nYour data, period.\n\n---\n\n## Features\n\n- **Simple Analytics Tracking**: Logs page views, unique visits, and referrers.\n- **Exclusion Rules**: Automatically excludes admin pages, crawlers, bots, and non-content paths (e.g., static assets, API requests).\n- **Admin Dashboard Visualization**: Provides clear data visualization for page views and referrers.\n- **Historical Data Export**: Download stats as a CSV file for further analysis.\n- **404 Tracking**: Logs visits to non-existent pages for debugging purposes.\n\n---\n\n## Installation\n\n1. Download the plugin from [GitHub](https://github.com/robertdevore/stats-for-wordpress/).\n2. Upload the plugin files to the `/wp-content/plugins/stats-for-wordpress/` directory.\n3. Activate the plugin through the 'Plugins' menu in WordPress®.\n4. Visit the **Stats** section in your WordPress® admin dashboard to view analytics.\n\n---\n\n## Usage\n\n### Viewing Stats\n- Navigate to the **Stats** menu in your WordPress® admin dashboard to:\n  - View daily unique and all visits for the past 7 days.\n  - See the most visited pages on your site.\n  - Analyze the top referrers sending traffic to your site.\n\n### Downloading Stats\n- Click the **Download CSV** button on the stats page to export historical data for a custom date range.\n\n### Resetting Stats\n- Append `?delete_stats=1` to your admin URL (e.g., `https://example.com/wp-admin/admin.php?page=sfwp-stats\u0026delete_stats=1`) to clear all recorded stats.\n\n---\n\n## Excluded Pages and Bots\n\n### Pages Excluded by Default\n- WordPress® core pages and assets:\n  - `/favicon.ico`, `/robots.txt`, `/sitemap.xml`, `/wp-json/`, etc.\n- Static files (e.g., `.css`, `.js`, `.jpg`).\n- Admin pages and AJAX endpoints.\n- Feeds and query patterns (e.g., `?utm_`, `?ver=`).\n\n### Bots Excluded by Default\n- Common search engine bots (e.g., Googlebot, Bingbot).\n- SEO tools (e.g., AhrefsBot, SemrushBot).\n- Scrapers and crawlers (e.g., `curl`, `wget`).\n- Headless browsers and security tools.\n\n---\n\n## Database Schema\n\nThe plugin creates a custom database table to store analytics data:\n\n| Field          | Type          | Description                             |\n|----------------|---------------|-----------------------------------------|\n| `id`           | BIGINT(20)    | Auto-incremented unique ID.             |\n| `date`         | DATE          | Date of the visit.                      |\n| `page`         | VARCHAR(255)  | The URL path of the visited page.       |\n| `referrer`     | VARCHAR(255)  | Referring URL, if available.            |\n| `unique_visits`| INT(11)       | Count of unique visitors.               |\n| `all_visits`   | INT(11)       | Total visit count (includes repeats).   |\n\n---\n\n## Hooks \u0026 Filters\n\n### Hooks\n- **`wp`**: Logs page visits, excluding non-content requests.\n- **`register_activation_hook`**: Creates or updates the database table during activation.\n- **`admin_post_sfwp_download_stats`**: Handles CSV downloads.\n- **`admin_init`**: Deletes all stats if triggered via a query parameter.\n\n### Filters\nNone currently available.\n\n---\n\n## Customization\n\n### Adding Excluded Paths\nYou can add more excluded paths by modifying the `$excluded_paths` array in the `sfwp_log_visit()` function.\n\n### Adding Bots to Exclude\nTo exclude additional bots, add their user-agent strings to the `$crawlers` array in the `sfwp_is_crawler()` function.\n\n---\n\n## Troubleshooting\n\n### Stats Not Updating\n1. Ensure the plugin is activated.\n2. Check if the database table `wp_sfwp_stats` exists. If not, deactivate and reactivate the plugin.\n\n### Missing Data for Specific Pages\n- Ensure the page URLs are not part of the excluded paths or patterns.\n\n### Referrers Include My Site\n- Ensure the plugin is properly filtering internal referrers. If you use multiple domains, add them to the internal referrer check in `sfwp_log_visit()`.\n\n---\n\n## Contributing\n\nContributions are welcome!  \n1. Fork the repository on GitHub: [Stats for WordPress](https://github.com/robertdevore/stats-for-wordpress/).\n2. Submit a pull request with your proposed changes.\n\n---\n\n## License\n\nThis plugin is licensed under the [GPL-2.0+](http://www.gnu.org/licenses/gpl-2.0.txt).  \nYou are free to use, modify, and distribute it under the terms of the GNU General Public License.\n\n---\n\n## Support\n\nFor support, visit [Robert DeVore's website](https://robertdevore.com) or open an issue on the [GitHub repository](https://github.com/robertdevore/stats-for-wordpress/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertdevore%2Fstats-for-wordpress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobertdevore%2Fstats-for-wordpress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertdevore%2Fstats-for-wordpress/lists"}