=== AI Bot Monitor === Contributors: straightdigital Tags: ai, bots, crawler, analytics Requires at least: 6.0 Tested up to: 6.7 Stable tag: 1.7 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Tracks and logs AI, Search and Social bots including ChatGPT, Perplexity, Googlebot, Bing and Meta crawlers. == Description == **AI Bot Monitor** tracks and logs visits from major AI crawlers, search bots, and social preview bots — such as ChatGPT, Perplexity, Googlebot, Bingbot, Paddle/Bytespider, and Meta/Facebook. It offers a clean admin dashboard showing today’s activity, an **AI-Layer overview** highlighting key retrieval signatures (including **Chrome/141** used by modern AI assistants), automatic log rotation, and a one-click ZIP export. **Features:** * Detects AI, Search, and Social bots (ChatGPT, Perplexity, Googlebot, Bingbot, Paddle, etc.) * **AI-Layer overview** (incl. Chrome/141, GPTBot, CCBot, PerplexityBot) * Daily auto-rotation (keeps last 30 days) * Admin dashboard with recent activity table * ZIP export of all logs * Single + Multisite compatible * Works as standard plugin or MU-plugin * Path-safe (`plugin_dir_path()` / uploads dir) and sanitized inputs == Installation == 1. Upload the plugin to `/wp-content/plugins/ai-bot-monitor/`, or drop `ai-bot-monitor.php` into `/wp-content/mu-plugins/` to auto-load it. 2. Activate the plugin via **Plugins** (if not using MU mode). 3. Go to **Dashboard → AI Bot Monitor** to view logs and export ZIPs. == Frequently Asked Questions == = Where are logs stored? = In your WordPress uploads directory: `/uploads/ai-bot-monitor/`, one CSV per day (`log-YYYY-MM-DD.csv`). = How does the AI-Layer overview work? = It scans today’s user agents for well-known retrieval/crawler signatures (e.g. Chrome/141, GPTBot, CCBot, PerplexityBot) and counts hits. = Can I exclude my own IPs? = Yes. Add to your theme or a small plugin: `add_filter('ai_bot_monitor_ip_whitelist', fn($w)=>array_merge($w, ['123.123.123.123']));` = Does it impact performance? = Minimal. The plugin writes lightweight, line-based logs and skips admin, AJAX, and cron requests. Key Features Automatic MU-Plugin Migration – activates once, moves itself to /mu-plugins/ for guaranteed uptime AI Crawler Detection – GPTBot, Claude, Perplexity, Copilot, CCBot, Applebot, and 40 + more Daily CSV Logging – per-day files auto-rotated (30-day retention) Dashboard Overview – live stats with AI-layer grouping (e.g. Chrome/141 for ChatGPT) ZIP Export – one-click archive download for all logs Lightweight – no external calls, no database writes, pure file-based logging Privacy-safe – no user tracking, only bot metadata ⚙️ How It Works Upload ai-bot-monitor.zip through Plugins → Add New → Upload Plugin. Activate the plugin. On activation, it: Creates /wp-content/mu-plugins/ai-bot-monitor-loader.php Deactivates the normal plugin copy Loads itself once via MU-plugin Visit Dashboard → AI Bot Monitor to view daily logs. If filesystem permissions block MU-loader creation, the plugin continues as a normal plugin until permissions allow migration. 📊 Dashboard Overview The dashboard groups detected crawlers by signature, including: Signature Description GPTBot OpenAI crawler Chrome/141 ChatGPT / Copilot retrieval layer Chrome/134 Perplexity / Bing AI layer Claude Anthropic web/app crawler CCBot Common Crawl (training datasets) Googlebot, Bingbot Search engine crawlers Bytespider TikTok / ByteDance crawler You can export all logs anytime with “Download All Logs (ZIP)”. 🗂 Log Storage Logs are written to /wp-content/uploads/ai-bot-monitor/log-YYYY-MM-DD.csv Each entry includes: time, ip, user_agent, url Old files older than 30 days are automatically deleted. 🔒 Security & Performance Runs on init hook with early priority 0 Doesn’t touch the database Compatible with caching and static HTML plugins Does not expose data publicly Only administrators can access the dashboard and export 🪶 Changelog 1.4 Complete rewrite with auto-migration to MU-plugin Prevented double-load across plugin/MU contexts Added success notice after migration Hardened Zip export (ZIP extension check) Code cleanup for WordPress.org submission compliance 1.3 → 1.4 migration note If a previous version exists, the new installer will safely create the MU-loader and deactivate the old instance automatically. 📜 License This plugin is open-source and distributed under the GNU GPL v2 or later. You are free to use, modify, and redistribute under the same license.