=== Bot Radar – visitors, AI & search engines ===
Contributors: kostech
Tags: analytics, ai, chatgpt, bots, privacy
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 1.8.5
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Who visits your site and where they come from, and which AI (ChatGPT, Claude, Perplexity, Gemini…) and search engines read it. No cookies, no tracking script required.

== Description ==

Bot Radar shows two things that ordinary analytics miss: **whether AI assistants recommend your site** and **what really brings you customers** – while adding practically nothing to your pages.

**AI & search engines**

* **AI users** (ChatGPT-User, Perplexity-User, Claude-User…): someone asked an AI and it opened your page to answer them – the clearest sign that AI recommends you.
* **AI search** (OAI-SearchBot, Claude-SearchBot, PerplexityBot…) and **AI training** crawlers (GPTBot, ClaudeBot, Google-Extended, CCBot…).
* **Search engines** (Googlebot, Bingbot, Applebot, YandexBot…), verified through DNS so fake bots are exposed.
* Pages read by AI, and pages AI opened for its users.

**Visitors**

* Visitors and page views per day, most popular pages, hours of the day.
* Where they came from: search engines, AI (chatgpt.com, perplexity.ai…), social, other sites, direct.
* Devices, browsers, operating systems and (optional) countries.
* **Customer leads**: taps on the phone number, email, WhatsApp, Viber and map directions, contact form submissions (Contact Form 7, WPForms, Gravity Forms, Elementor, Fluent Forms, Ninja Forms, Formidable, or any form that sends an email) and WooCommerce orders – with the page they came from.
* Link shares (previews in Viber, WhatsApp, Messenger…), 404 pages, other bots and SEO tools, suspicious requests.
* Logged-in administrators are not counted.

**Tools**

* **AI readiness check**: robots.txt (which search engines and AI it blocks), sitemap, llms.txt, noindex, title, description, business schema, language, https – each problem with a fix.
* **Email reports** (weekly, monthly or daily) compared with the previous period, and **alerts**: the first time an AI recommends the site, a sharp drop in visitors, many 404 pages, Googlebot stopped visiting.
* **CSV export** (per day, pages, bots) that opens correctly in Excel.
* **Admin bar** button with today's numbers.
* Optional **central dashboard** by kos-tech: all your sites in one place, also inside any of your WordPress sites (“All sites” tab), with Google Search Console data.

**Light by design**

* With server logs (Plesk, cPanel – detected automatically) visits cost nothing: logs are read hourly in the background, and static files such as robots.txt and llms.txt are counted too.
* Without logs: one small database write per page view, after the page has been sent to the visitor.
* No front-end CSS. The only front-end code is an optional ~0.65 KB script for counting clicks on phone/email/WhatsApp/map links; it can be turned off.
* Charts are server-side SVG; no JavaScript libraries.

Designed by [kos-tech](https://kos-tech.eu/).

== Installation ==

1. Plugins → Add New → Upload Plugin → choose the zip → Activate (when updating: “Replace current with uploaded”).
2. Open the “Bot Radar” menu and click “Update now” for a first read.
3. If server logs are not found automatically, set the logs folder in Settings, or leave page tracking on.

== External services ==

**kos-tech central dashboard (optional, off by default).** Only if an administrator enters a site key in Bot Radar → Settings → Central dashboard, the plugin sends to https://kos-tech.eu/radar/api/ingest.php, once an hour, daily totals only: numbers of visitors and page views, sources (e.g. “search engines: 12”), customer leads by type, devices, visitor countries (totals per country, only if “Visitor country” is on), bot visits by category, and the 15 most popular pages and referring sites, together with the site address, plugin version and a short list of problems the plugin detected (e.g. “server logs not readable”, “email could not be sent”), so the dashboard can warn the site owner. No IP addresses, cookies or visitor data are sent. With an account key (read-only) the “All sites” tab reads the totals of all sites of the account from https://kos-tech.eu/radar/api/sites.php; if Google Search Console has been connected in the dashboard, its summary is read from https://kos-tech.eu/radar/api/gsc.php. The service is operated by kos-tech: https://kos-tech.eu/

**Plugin updates.** Bot Radar is not hosted on wordpress.org, so WordPress checks for new versions at https://kos-tech.eu/radar/api/plugin.php (about twice a day, together with its normal update check) and downloads updates from https://kos-tech.eu/radar/plugin/. Only the request itself is sent, as made by WordPress (which includes the site address in its standard user agent); no visitor data. From 1.7.0 every update must carry an ed25519 signature from kos-tech; unsigned or altered files are not installed.

**DB-IP country database (optional, off by default).** Only if “Visitor country” is turned on, the plugin downloads the free “IP to Country Lite” database (~5 MB) from https://download.db-ip.com/free/ once a month and stores it in the uploads folder. No data is sent to DB-IP. The database is licensed under Creative Commons Attribution 4.0 (https://db-ip.com/db/lite.php); a link “IP Geolocation by DB-IP” is shown wherever countries are displayed.

**DNS verification of bots.** For Google, Bing, Apple and Yandex a reverse/forward DNS lookup of the bot's IP address is made through the server's DNS. No data is sent to third parties.

**AI readiness check.** The check requests the site's own pages (home page, robots.txt, sitemap, llms.txt) from the site itself.

== Privacy ==

For bots, the bot name, page and the bot's IP address are stored (for verification). For people, only daily totals are stored (page, source, device, browser, hour, optional country): no IP address, no cookie, no identifier. A “unique visitor” is computed in memory and never stored. To recognise a returning browser that already has the page’s files in its cache, only a 20-bit keyed bucket of IP + browser is kept for 30 days; each bucket is shared by thousands of addresses, so it cannot identify anyone. Time on page and activity within a page are not measured. Data stays in the site's database and is deleted after the retention period (default 365 days).

== Uninstall ==

Deleting the plugin removes its tables, settings, scheduled tasks and the country database.

== Changelog ==

= 1.8.5 =
* New: when a period starts before the first day with visitor data, the page and the email reports say "Visitors are counted from …", so days without data are not mistaken for days without visitors.
* The change arrows for visitors are hidden (also in the email reports and the "All sites" tab) when the previous period has visitor data on fewer than 80% of its days.

= 1.8.4 =
* Fixed: the Bot Radar page could reload again and again while the hourly update was running.
* Fixed: visits from Gmail, Google News and other Google services were counted as "search engines"; only Google Search is now.
* Fixed: people using the built-in browser of LinkedIn or X were not counted as visitors.
* Fixed: search engine bots that crawl over IPv6 were shown as "not verified".
* Fixed: the "All sites" tab stopped on PHP 8 when a site had no data yet.
* The change arrows (up/down) are shown only when the previous period has enough data, and not for "Today" (half a day against a full day).
* Sites without server logs: reloading a page or going back no longer counts a new visitor; the page signal must come from the site itself; daily limits for bot pages, referrers and campaigns so that nobody can bloat the database.
* A machine on Google Cloud can no longer pass as a verified Googlebot.

= 1.8.3 =
* Sites without server logs: a visit is now counted at the first sign of a person on the page (mouse movement, touch, wheel or a key), not when the page loads. Automated browsers that run JavaScript but never touch the page are no longer counted. A visitor who opens a page and leaves without moving at all is not counted either.
* New bot: ElevenlabsCrawler.

= 1.8.2 =
* New period “Today” next to 7 days, 30 days, 3 months and 12 months, on every tab and in the CSV export. The change indicators compare today with yesterday.

= 1.8.1 =
* Sites without server logs: a visit is counted only after the visitor’s browser confirms it with a tiny script at the end of the page (one small request, no cookie). Programs that claim to be a browser but do not run JavaScript, and automated browsers, are no longer counted as visitors. On a shop that was being scraped this removed thousands of false “visitors” a day. Earlier days are not changed.

= 1.8.0 =
* Visitors: the main numbers show the change from the previous period of the same length.
* New card “By AI engine”: for ChatGPT, Perplexity, Claude, Gemini and others, how many visitors each one sent, how often it opened a page to answer someone, and how much it read the site.
* New card “Campaigns”: visitors who arrived through links with campaign tags (utm_campaign, utm_source) or from ads (gclid, fbclid).
* New monthly report for the client, in plain language, to its own recipients, with a “send a sample to me” link.
* Optional automatic llms.txt (a short guide to the site for AI assistants), used only when no real file exists.
* Large sites: the log reader uses less memory and time (the date is parsed once per second of log, crawlers that scan thousands of addresses are grouped, bot verification looks only at recent days) and stops safely with a clear message instead of failing when the server’s memory is not enough.

= 1.7.2 =
* Security: an update is accepted only from the plugin folder of the update server, and its signature now also covers the version number, so an older signed file cannot be served as a newer one.
* WooCommerce: orders from the block-based checkout are counted; an order is no longer also counted as a form.
* AI check: robots.txt files that start with a BOM are read correctly; on a tie “Allow” wins, as for Google; “noindex” is found when the header is sent twice or the meta tag has its attributes in another order.
* Countries: IPv4 addresses written as IPv6 (::ffff:1.2.3.4) are recognised.
* The hourly update re-schedules itself if its schedule is lost; a long run can no longer be interrupted by the next one.
* A database error on one day is no longer hidden by the next day that saves correctly; no false “log format not recognised” on quiet sites.
* Page tracking without logs: after 500 different addresses in a day, existing pages keep counting normally.
* Two identical requests in the same second are counted as two.
* Leads are shown as at most 100% of visitors.

= 1.7.1 =
* Hosts that keep only compressed logs (e.g. one .gz file per day): the hourly update now reads the newest one, so the numbers are fresh every hour instead of once a day, and “logs not read” is not shown by mistake.

= 1.7.0 =
* Reliability: the hourly update runs one at a time (a second run waits), so numbers can no longer double. Each step runs separately; if one fails, the others still run and the error is shown.
* New “Something needs attention” box on the Bot Radar page: logs not read, email not sent, central dashboard not reached, update check failed, country database not updated, database error.
* Emails: a failed report or alert is now recorded and shown, with the reason.
* A day is saved in one database transaction: on an error the previous numbers are kept.
* Pages whose address contains words like “shell” or “vendor” are no longer counted as attacks; only real scanner files are.
* “Yesterday” and daily series are correct on the days the clocks change.
* The visitor-drop alert averages only days that have data.
* Very many different addresses in one day (scans) are grouped as “(other)” instead of growing the database.
* Updates are signed by kos-tech (ed25519) and verified before installation.
* Days without any data are not sent to the central dashboard, so they cannot overwrite good data.
* Clean uninstall: all options and temporary data are removed.

= 1.6.9 =
* Visitors (server logs): a returning visitor whose browser already had the page’s files in its cache is counted again, if the same browser loaded page files on another day in the last 30 days. Only a 20-bit keyed bucket is kept (no IP address).

= 1.6.8 =
* Visitors (server logs): a browser counts as a visitor only if it also loaded the page’s files (CSS, JavaScript or images). Programs that pretend to be a browser (often an “iPhone”) and fetch only the HTML now appear under other tools as “Browser without page files (likely automated)”. If a site’s logs contain no page files at all (e.g. served by a CDN), nothing is filtered.

= 1.6.7 =
* Central dashboard: visitor countries (totals per country) are sent too, when “Visitor country” is on, so clients can see them in the dashboard.

= 1.6.6 =
* 404 alert: addresses are grouped (e.g. 180 removed products appear as one line “/product/…”), and scanners, old theme files and WordPress system addresses are not counted.

= 1.6.5 =
* Server logs on Plesk: a site that is not the main domain of the subscription reads only its own logs. Before, a newly added site whose log folder did not exist yet could read the main domain's visits.

= 1.6.4 =
* AI readiness check: it now asks the site for its own pages as WordPress does. Some hosts' bot protection (e.g. SiteGround) cut off the old check, and the home page, robots.txt and sitemap were reported as problems although the site worked.
* When the site cannot reach itself, the check says so and shows the error, instead of reporting a problem.

= 1.6.3 =
* AI readiness check: business details in schema are recognised for every business type (e.g. HomeAndConstructionBusiness, GeneralContractor, MedicalClinic), inside @graph and when @type is a list.

= 1.6.2 =
* Updates from the kos-tech server: WordPress shows new versions of Bot Radar like any other plugin, and automatic updates can be turned on. Each update file is checked (SHA256) before it is installed.

= 1.6.1 =
* Numbers update by themselves: the Bot Radar page refreshes in the background when its data is older than 15 minutes, and the central dashboard receives data every hour instead of once a day.

= 1.6.0 =
* Email alerts: first AI recommendation, sharp drop in visitors, many 404 pages, Googlebot stopped visiting.
* AI readiness check tab.
* CSV export (per day, pages, bots).
* Optional visitor country (DB-IP Lite).
* Google Search Console summary through the central dashboard.
* English source texts with a Greek translation (ready for translate.wordpress.org).

= 1.5.1 =
* “All sites”: “Refresh now” button, shorter cache, warning when this site is missing from the account.

= 1.5.0 =
* “All sites” tab with an account key (read-only).

= 1.4.0 =
* Optional connection to the kos-tech central dashboard.

= 1.3.0 =
* Customer leads: phone/email/WhatsApp/Viber/map clicks, forms, orders.

= 1.2.0 =
* Email reports.

= 1.1.0 =
* Visitor statistics, admin bar button.

= 1.0.0 =
* First release.
