diff --git a/.wordpress-org/screenshot-1.png b/.wordpress-org/screenshot-1.png
new file mode 100644
index 0000000..cbefdcb
Binary files /dev/null and b/.wordpress-org/screenshot-1.png differ
diff --git a/.wordpress-org/screenshot-2.png b/.wordpress-org/screenshot-2.png
new file mode 100644
index 0000000..6572a20
Binary files /dev/null and b/.wordpress-org/screenshot-2.png differ
diff --git a/.wordpress-org/screenshot-3.png b/.wordpress-org/screenshot-3.png
new file mode 100644
index 0000000..9b14af3
Binary files /dev/null and b/.wordpress-org/screenshot-3.png differ
diff --git a/.wordpress-org/screenshot-4.png b/.wordpress-org/screenshot-4.png
new file mode 100644
index 0000000..e692b92
Binary files /dev/null and b/.wordpress-org/screenshot-4.png differ
diff --git a/.wordpress-org/screenshot-5.png b/.wordpress-org/screenshot-5.png
new file mode 100644
index 0000000..32192bc
Binary files /dev/null and b/.wordpress-org/screenshot-5.png differ
diff --git a/.wordpress-org/screenshot-6.png b/.wordpress-org/screenshot-6.png
new file mode 100644
index 0000000..c5be622
Binary files /dev/null and b/.wordpress-org/screenshot-6.png differ
diff --git a/.wordpress-org/screenshot-7.png b/.wordpress-org/screenshot-7.png
new file mode 100644
index 0000000..d02cbba
Binary files /dev/null and b/.wordpress-org/screenshot-7.png differ
diff --git a/.wordpress-org/screenshot-8.png b/.wordpress-org/screenshot-8.png
index ffab48b..4f23784 100644
Binary files a/.wordpress-org/screenshot-8.png and b/.wordpress-org/screenshot-8.png differ
diff --git a/admin/css/webdecoy-admin.css b/admin/css/webdecoy-admin.css
index ec657d9..dce636f 100644
--- a/admin/css/webdecoy-admin.css
+++ b/admin/css/webdecoy-admin.css
@@ -721,6 +721,7 @@
margin-bottom: 20px;
}
+.webdecoy-chart-card h2,
.webdecoy-chart-card h3 {
margin: 0 0 16px;
font-size: 14px;
@@ -1142,3 +1143,74 @@
font-size: 11px;
color: #646970;
}
+
+/* Analytics landing page: scoped so settings, forms and other admin pages retain WP styles. */
+.wd-analytics { --wd-pink: #f90289; --wd-ink: #1a1823; --wd-muted: #706b7a; --wd-border: #e9e5ec; max-width: 1480px; margin: 24px 28px 40px 8px; color: var(--wd-ink); }
+.wd-analytics-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; padding: 12px 0 28px; }
+.wd-analytics .wd-brand { display: flex; align-items: center; gap: 9px; margin-bottom: 20px; font-weight: 750; font-size: 17px; letter-spacing: -.3px; }
+.wd-brand img { object-fit: contain; }
+.wd-brand-divider { color: #d8d1dc; margin: 0 5px; font-weight: 400; }
+.wd-analytics .wd-eyebrow { color: var(--wd-muted); font-size: 10px; font-weight: 650; letter-spacing: 1.5px; }
+.wd-analytics-header .wd-page-title { font-size: clamp(26px, 3vw, 37px); font-weight: 700; letter-spacing: -1.3px; line-height: 1.15; margin: 0 0 9px; padding: 0; color: var(--wd-ink); }
+.wd-analytics-header p { margin: 0; font-size: 14px; color: var(--wd-muted); }
+.wd-period { display: flex; flex-shrink: 0; padding: 4px; gap: 3px; background: #eeebf0; border: 1px solid #e4dfe8; border-radius: 10px; }
+.wd-period a { padding: 8px 16px; color: #65606e; text-decoration: none; font-size: 12px; font-weight: 600; border-radius: 7px; }
+.wd-period a[aria-current] { background: #fff; color: var(--wd-ink); box-shadow: 0 1px 4px #20172b12; }
+.wd-period a:hover { color: #bc0067; }
+.wd-analytics a:focus-visible, .wd-analytics summary:focus-visible { outline: 2px solid #bc0067; outline-offset: 3px; }
+.wd-report-caption { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--wd-muted); font-size: 11px; margin-bottom: 16px; }
+.wd-status-dot { width: 6px; height: 6px; background: var(--wd-pink); border-radius: 100%; }
+.wd-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; margin-bottom: 22px; }
+.wd-metric { display: flex; flex-direction: column; padding: 22px 24px; border: 1px solid var(--wd-border); border-radius: 12px; background: #fff; position: relative; overflow: hidden; }
+.wd-metric:first-child::before { content: ''; position: absolute; top: 0; left: 24px; width: 32px; height: 3px; background: var(--wd-pink); border-radius: 0 0 2px 2px; }
+.wd-metric-label { font-size: 12px; color: #5f5969; font-weight: 550; }
+.wd-metric strong { font-size: clamp(27px,3vw,37px); line-height: 1.25; letter-spacing: -1px; margin: 9px 0 6px; font-variant-numeric: tabular-nums; font-weight: 700; }
+.wd-metric-note { font-size: 11px; color: #756d7e; }
+.wd-chart-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 20px; }
+.wd-panel { min-width: 0; background: #fff; border: 1px solid var(--wd-border); border-radius: 13px; padding: 24px; box-shadow: 0 2px 8px #27152e03; }
+.wd-panel-heading { display: flex; justify-content: space-between; gap: 12px; align-items: flex-end; margin-bottom: 24px; }
+.wd-panel h2 { margin: 5px 0 0; padding: 0; color: var(--wd-ink); font-size: 19px; letter-spacing: -.45px; font-weight: 650; }
+.wd-panel-meta { color: #706b7a; font-size: 11px; white-space: nowrap; }
+.wd-chart-canvas { position: relative; width: 100%; min-width: 0; }
+.wd-chart-large { height: 275px; }
+.wd-chart-ring { height: 190px; max-width: 235px; margin: 0 auto 20px; }
+.wd-chart-ranked { height: 230px; }
+.wd-chart-referrals { height: 210px; }
+.wd-chart-legend { display: flex; flex-wrap: wrap; list-style: none; gap: 16px; margin: 22px 0 0; padding: 0; color: #6d6577; font-size: 11px; }
+.wd-chart-legend li, .wd-breakdown li span { display: inline-flex; align-items: center; gap: 7px; }
+.wd-chart-legend i, .wd-breakdown i { display: inline-block; width: 8px; height: 8px; border-radius: 3px; }
+.wd-dot-ai { background: #f90289; } .wd-dot-search { background: #7565db; } .wd-dot-other { background: #239d98; }
+.wd-breakdown { list-style: none; margin: 0; padding: 0; }
+.wd-breakdown li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; margin: 0; border-top: 1px solid #f1eef3; color: #665f71; font-size: 12px; }
+.wd-breakdown strong { color: var(--wd-ink); font-variant-numeric: tabular-nums; }
+.wd-panel-footnote { margin: 16px 0 0; color: #746b7c; font-size: 11px; line-height: 1.6; }
+.wd-referral-sources { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 18px 0 0; }
+.wd-referral-sources li { display: flex; gap: 10px; align-items: center; background: #f7f5f9; border-radius: 6px; padding: 6px 10px; font-size: 11px; color: #6b6274; }
+.wd-referral-sources strong { color: var(--wd-ink); }
+.wd-chart-empty { min-height: 275px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; border: 1px dashed #e8e1ed; border-radius: 9px; background: repeating-linear-gradient(0deg,#faf9fb 0,#faf9fb 53px,#f1eef5 54px,#faf9fb 55px); padding: 20px; box-sizing: border-box; }
+.wd-chart-empty-small { min-height: 230px; }
+.wd-chart-empty .dashicons { width: 36px; height: 36px; font-size: 30px; color: #c6b4cf; margin-bottom: 10px; }
+.wd-chart-empty h3 { margin: 0 0 8px; color: #504658; font-weight: 600; font-size: 15px; }
+.wd-chart-empty p { max-width: 290px; margin: 0; font-size: 12px; line-height: 1.7; color: #756b7e; }
+.wd-coverage { margin: 16px 0 26px; font-size: 11px; color: #82768c; }
+.wd-coverage summary { cursor: pointer; }
+.wd-coverage p { max-width: 850px; line-height: 1.7; font-size: 12px; }
+.wd-detail-panel { background: #fff; border: 1px solid var(--wd-border); border-radius: 11px; margin: 14px 0; padding: 0 24px; }
+.wd-detail-panel > summary { cursor: pointer; color: #514658; padding: 18px 0; font-size: 13px; font-weight: 600; }
+.wd-detail-panel[open] > summary { margin-bottom: 16px; border-bottom: 1px solid var(--wd-border); }
+.wd-detail-panel .webdecoy-chart-card { border-color: var(--wd-border); }
+.wd-analytics .webdecoy-cloud-upsell { border: 1px solid var(--wd-border); background: #faf7fb; color: var(--wd-ink); border-radius: 11px; padding: 22px 24px; text-align: left; margin-top: 22px; }
+.wd-analytics .webdecoy-cloud-upsell p { color: #74677f; max-width: 850px; }
+.wd-analytics .button-primary { background: #171923; border-color: #171923; color: #fff; box-shadow: none; }
+.wd-analytics .notice-info { border-left-color: var(--wd-pink); border-radius: 5px; box-shadow: none; margin: 0 0 18px; }
+.wd-analytics .notice-info p { font-size: 12px; }
+.wd-analytics .notice-info p:last-child { margin-top: 3px; }
+.wd-analytics .notice-info .button { font-size: 11px; min-height: 26px; line-height: 24px; }
+@media (min-width: 1280px) { .wd-chart-grid { grid-template-columns: 1.6fr 1fr; } .wd-panel-main { grid-column: 1; } .wd-panel-main:last-child { grid-column: 2; } }
+@media (max-width: 1000px) { .wd-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); } .wd-chart-grid { grid-template-columns: 1fr; } .wd-analytics-header { align-items: flex-start; } .wd-brand .wd-eyebrow { display: none; } }
+@media (max-width: 600px) { .wd-analytics { margin: 18px 10px 30px 0; } .wd-analytics-header { flex-direction: column; padding-bottom: 20px; } .wd-analytics .wd-brand { margin-bottom: 16px; } .wd-metric { padding: 16px; } .wd-metrics { gap: 10px; } .wd-metric strong { font-size: 29px; } .wd-panel { padding: 18px; } .wd-panel-heading { gap: 8px; } .wd-chart-large { height: 220px; } .wd-panel-meta { white-space: normal; text-align: right; } .wd-detail-panel { padding: 0 14px; overflow-x: auto; } }
+
+.wd-analytics .webdecoy-cloud-upsell h3 { color: var(--wd-ink); }
+.wd-analytics .notice-info p { display: inline-block; margin: 8px 8px 8px 0; }
+
+.wd-table-scroll { overflow-x: auto; margin-bottom: 24px; }
diff --git a/admin/js/webdecoy-charts.js b/admin/js/webdecoy-charts.js
index 88ada2b..6b56ffa 100644
--- a/admin/js/webdecoy-charts.js
+++ b/admin/js/webdecoy-charts.js
@@ -14,8 +14,8 @@
// Color palette
var colors = {
- primary: '#2271b1',
- primaryLight: 'rgba(34, 113, 177, 0.1)',
+ primary: '#f90289',
+ primaryLight: 'rgba(249, 2, 137, 0.1)',
danger: '#dc3232',
warning: '#f0b849',
success: '#46b450',
diff --git a/admin/js/webdecoy-traffic-charts.js b/admin/js/webdecoy-traffic-charts.js
new file mode 100644
index 0000000..7e8cfe1
--- /dev/null
+++ b/admin/js/webdecoy-traffic-charts.js
@@ -0,0 +1,53 @@
+/** WebDecoy local traffic visualizations. Existing protection charts stay independent. */
+(function () {
+ 'use strict';
+ if (typeof Chart === 'undefined' || !window.webdecoyChartData || !window.webdecoyChartData.traffic) return;
+ var d = window.webdecoyChartData.traffic;
+ var palette = ['#f90289', '#7565db', '#239d98'];
+ var reduced = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
+ var labels = d.labels.map(function (date) { return date.slice(5).replace('-', '/'); });
+ var names = d.names;
+ var totals = ['ai', 'search', 'other'].map(function (key) { return (d.groups && d.groups[key]) || 0; });
+ function options() {
+ return {
+ responsive: true, maintainAspectRatio: false,
+ animation: reduced ? false : { duration: 350 },
+ interaction: { mode: 'index', intersect: false },
+ plugins: { legend: { display: false }, tooltip: { backgroundColor: '#171923', padding: 12, cornerRadius: 8 } },
+ scales: {
+ x: { grid: { display: false }, border: { display: false }, ticks: { color: '#73717d', maxTicksLimit: 8, maxRotation: 0, font: { size: 11 } } },
+ y: { beginAtZero: true, border: { display: false }, grid: { color: '#eeedf1' }, ticks: { color: '#73717d', precision: 0, maxTicksLimit: 5, font: { size: 11 } } }
+ }
+ };
+ }
+ var crawler = document.getElementById('wdCrawlerChart');
+ if (crawler && d.crawlerReady) {
+ var o = options();
+ o.scales.y.stacked = true;
+ o.scales.x.stacked = true;
+ new Chart(crawler, { type: 'line', data: { labels: labels, datasets: ['ai', 'search', 'other'].map(function (key, i) {
+ return { label: names[i], data: d.series[key], borderColor: palette[i], backgroundColor: palette[i] + '24', borderWidth: 2, pointRadius: 0, pointHoverRadius: 4, fill: i === 0 ? 'origin' : '-1', tension: 0.25 };
+ }) }, options: o });
+ }
+ var mix = document.getElementById('wdBotMixChart');
+ if (mix && d.crawlerReady) {
+ new Chart(mix, { type: 'doughnut', data: { labels: names.slice(0, 3), datasets: [{ data: totals, backgroundColor: palette, borderColor: '#fff', borderWidth: 4, hoverOffset: reduced ? 0 : 4 }] }, options: { responsive: true, maintainAspectRatio: false, cutout: '76%', animation: reduced ? false : { duration: 350 }, plugins: { legend: { display: false }, tooltip: { backgroundColor: '#171923', padding: 12 } } } });
+ }
+ var agents = document.getElementById('wdTopAgentsChart');
+ if (agents && d.crawlerReady) {
+ var rank = options();
+ rank.indexAxis = 'y';
+ rank.interaction = { mode: 'nearest', intersect: true };
+ rank.scales.y.grid.display = false;
+ rank.scales.x.grid = { color: '#eeedf1' };
+ rank.scales.x.beginAtZero = true;
+ rank.scales.x.ticks.precision = 0;
+ rank.scales.y.ticks.color = '#34323c';
+ rank.scales.y.ticks.autoSkip = false;
+ new Chart(agents, { type: 'bar', data: { labels: d.agents.map(function (a) { return a.name; }), datasets: [{ label: names[4], data: d.agents.map(function (a) { return a.hits; }), backgroundColor: d.agents.map(function (a) { return palette[a.group === 'ai' ? 0 : (a.group === 'search' ? 1 : 2)]; }), borderRadius: 4, maxBarThickness: 18 }] }, options: rank });
+ }
+ var referrals = document.getElementById('wdReferralChart');
+ if (referrals && d.referralReady) {
+ new Chart(referrals, { type: 'line', data: { labels: labels, datasets: [{ label: names[3], data: d.series.referrals, borderColor: '#239d98', backgroundColor: '#239d981c', borderWidth: 2, pointRadius: 0, pointHoverRadius: 4, fill: true, tension: 0.25 }] }, options: options() });
+ }
+})();
diff --git a/admin/partials/statistics-page.php b/admin/partials/statistics-page.php
index b120395..3fcdb86 100644
--- a/admin/partials/statistics-page.php
+++ b/admin/partials/statistics-page.php
@@ -140,19 +140,135 @@
wp_cache_set($wd_stats_key, [$daily_data, $threat_distribution, $top_signals, $top_ips, $source_distribution, $total_30d, $total_7d, $total_today, $active_blocks, $woo_stats], 'webdecoy_analytics', 60);
}
-// Known crawlers, AI agents and bot tools over 7 days (counters only).
-$crawler_summary = class_exists('WebDecoy_Crawler_Visits') ? WebDecoy_Crawler_Visits::summary(7 * 24) : null;
-
-// Page visits AI products sent over 30 days (counters only).
-$ai_referral_summary = class_exists('WebDecoy_AI_Referrals') ? WebDecoy_AI_Referrals::summary(WebDecoy_AI_Referrals::LOCAL_RETENTION_DAYS) : null;
+require_once WEBDECOY_PLUGIN_DIR . 'includes/class-webdecoy-traffic-report.php';
+// Read-only reporting selector; it never changes site settings.
+// phpcs:ignore WordPress.Security.NonceVerification.Recommended
+$traffic_days = WebDecoy_Traffic_Report::days(isset($_GET['traffic_days']) && is_scalar($_GET['traffic_days']) ? sanitize_text_field(wp_unslash($_GET['traffic_days'])) : '7');
+$traffic_report = WebDecoy_Traffic_Report::read($traffic_days);
+$crawler_summary = $traffic_report['crawler_ready'] ? $traffic_report['crawlers'] : null;
+$ai_referral_summary = $traffic_report['referral_ready'] ? $traffic_report['referrals'] : null;
$request_windows = [1 => WebDecoy_Request_Counts::summary(1), 7 => WebDecoy_Request_Counts::summary(7), 30 => WebDecoy_Request_Counts::summary(30)];
$options = get_option('webdecoy_options', []);
?>
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -266,101 +382,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
-
-
-
-
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
-
-
-
-
-
-
-
-
-
-
-
@@ -401,6 +422,8 @@
+
+
@@ -421,6 +444,15 @@
wp_add_inline_script(
'webdecoy-charts',
'window.webdecoyChartData = ' . wp_json_encode([
+ 'traffic' => [
+ 'labels' => $traffic_report['labels'],
+ 'series' => $traffic_report['series'],
+ 'groups' => $crawler_summary['groups'] ?? [],
+ 'agents' => array_slice($crawler_summary['agents'] ?? [], 0, 6),
+ 'crawlerReady' => $traffic_report['crawler_ready'],
+ 'referralReady' => $traffic_report['referral_ready'],
+ 'names' => [__('AI crawlers & agents', 'webdecoy'), __('Search engines', 'webdecoy'), __('Other known bots', 'webdecoy'), __('AI-referred visits', 'webdecoy'), __('Known bot visits', 'webdecoy')],
+ ],
'trend' => [
'labels' => array_keys($daily_data),
'data' => array_values($daily_data),
diff --git a/admin/partials/traffic-overview.php b/admin/partials/traffic-overview.php
new file mode 100644
index 0000000..d145320
--- /dev/null
+++ b/admin/partials/traffic-overview.php
@@ -0,0 +1,80 @@
+
+
+
··
+
+
+
+
+
+ 0) : ?>
+
+ __('AI crawlers & agents', 'webdecoy'), 'search' => __('Search engines', 'webdecoy'), 'other' => __('Other known bots', 'webdecoy')] as $wd_key => $wd_label) : ?>
+
+
+
+
+
+
+
+
diff --git a/assets/duck.png b/assets/duck.png
new file mode 100644
index 0000000..da48dc2
Binary files /dev/null and b/assets/duck.png differ
diff --git a/bin/deploy-wporg.sh b/bin/deploy-wporg.sh
index a7e76cc..3fc90b8 100755
--- a/bin/deploy-wporg.sh
+++ b/bin/deploy-wporg.sh
@@ -17,7 +17,7 @@
# bin/deploy-wporg.sh
--commit # stage AND commit/publish
#
# What it does: builds the .org variant, syncs it into SVN trunk/, refreshes the
-# directory assets (icon/banner) in assets/, tags tags//, and either
+# directory assets (icon/banner/screenshots) in assets/, tags tags//, and either
# prints or runs the commit.
#
set -euo pipefail
@@ -59,6 +59,13 @@ else
echo " ! rsvg-convert not found — add PNGs to ${SVN_DIR}/assets/ manually"
fi
+echo "==> Staging reviewed listing screenshots"
+# These are directory assets only; the build excludes .wordpress-org/ from trunk.
+for screenshot in "${PLUGIN_DIR}"/.wordpress-org/screenshot-*.png; do
+ [ -f "${screenshot}" ] || continue
+ cp "${screenshot}" "${SVN_DIR}/assets/$(basename "${screenshot}")"
+done
+
echo "==> Asserting trunk carries nothing WordPress.org forbids"
# Two failure modes this has already caught in practice:
# 1. Syncing from a build/ tree left behind by release.sh (the CDN variant)
diff --git a/includes/class-webdecoy-traffic-report.php b/includes/class-webdecoy-traffic-report.php
new file mode 100644
index 0000000..3b9f382
--- /dev/null
+++ b/includes/class-webdecoy-traffic-report.php
@@ -0,0 +1,111 @@
+=');
+ $referral_ready = version_compare($version, WebDecoy_AI_Referrals::SINCE_DB_VERSION, '>=');
+ // phpcs:disable WordPress.DB.DirectDatabaseQuery -- Admin-only aggregates cached for 60 seconds below.
+ if ($crawler_ready) {
+ $table = WebDecoy_Crawler_Visits::table();
+ $crawler_rows = $wpdb->get_results($wpdb->prepare(
+ "SELECT DATE(bucket) AS day, agent_id, verification, SUM(hits) AS hits FROM {$table} WHERE bucket >= %s GROUP BY DATE(bucket), agent_id, verification", // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Escaped plugin-owned table name.
+ $start . ' 00:00:00'
+ ), ARRAY_A);
+ $crawler_ready = is_array($crawler_rows);
+ }
+ if ($referral_ready) {
+ $table = WebDecoy_AI_Referrals::days_table();
+ $referral_rows = $wpdb->get_results($wpdb->prepare(
+ "SELECT day, platform, landing_path, SUM(referrals) AS referrals FROM {$table} WHERE day >= %s GROUP BY day, platform, landing_path", // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Escaped plugin-owned table name.
+ $start
+ ), ARRAY_A);
+ $referral_ready = is_array($referral_rows);
+ }
+ // phpcs:enable
+ $report = self::project(is_array($crawler_rows) ? $crawler_rows : [], is_array($referral_rows) ? $referral_rows : [], $days, $now);
+ $report['crawler_ready'] = $crawler_ready;
+ $report['referral_ready'] = $referral_ready;
+ wp_cache_set($key, $report, 'webdecoy_analytics', 60);
+ return $report;
+ }
+
+ /**
+ * Project the same rows into cards, tables and zero-filled daily series.
+ * Invalid/out-of-window rows never inflate a card independently of its chart.
+ */
+ public static function project(array $crawler_rows, array $referral_rows, int $days, int $now): array
+ {
+ $days = self::days($days);
+ $series = ['ai' => [], 'search' => [], 'other' => [], 'referrals' => []];
+ foreach ($series as &$daily) {
+ for ($i = $days - 1; $i >= 0; $i--) {
+ $daily[gmdate('Y-m-d', $now - $i * 86400)] = 0;
+ }
+ }
+ unset($daily);
+ $crawlers = [];
+ foreach ($crawler_rows as $row) {
+ $day = (string) ($row['day'] ?? '');
+ if (!isset($series['ai'][$day])) {
+ continue;
+ }
+ $one = WebDecoy_Crawler_Visits::summarize([$row]);
+ if ($one['total'] <= 0) {
+ continue;
+ }
+ foreach (['ai', 'search', 'other'] as $group) {
+ $series[$group][$day] += $one['groups'][$group];
+ }
+ $crawlers[] = $row;
+ }
+ $referrals = [];
+ foreach ($referral_rows as $row) {
+ $day = (string) ($row['day'] ?? '');
+ if (!isset($series['referrals'][$day])) {
+ continue;
+ }
+ $one = WebDecoy_AI_Referrals::summarize([$row]);
+ if ($one['total'] <= 0) {
+ continue;
+ }
+ $series['referrals'][$day] += $one['total'];
+ $referrals[] = $row;
+ }
+ return [
+ 'days' => $days,
+ 'labels' => array_keys($series['ai']),
+ 'series' => array_map('array_values', $series),
+ 'crawlers' => WebDecoy_Crawler_Visits::summarize($crawlers),
+ 'referrals' => WebDecoy_AI_Referrals::summarize($referrals),
+ ];
+ }
+}
diff --git a/readme.txt b/readme.txt
index c88999c..bb1fa53 100644
--- a/readme.txt
+++ b/readme.txt
@@ -20,7 +20,7 @@ Everything below works on your own server, free, with no account or API key.
= 1. See every AI crawler and bot =
* **Dashboard widget**: known bot visits in the last 24 hours, with AI crawlers and agents counted separately and the busiest bots by name
-* **Statistics page**: every known bot from the last 7 days, with its operator and type (AI training crawler, AI search crawler, AI agent, AI assistant, search engine, SEO tool, scraper and more)
+* **AI Traffic & Analytics page**: crawler timelines, bot-type breakdowns, ranked agents and AI-referral charts, with a 7- or 30-day UTC calendar view. Expand the details to see each bot, its operator and type (AI training crawler, AI search crawler, AI agent, AI assistant, search engine, SEO tool, scraper and more)
* **Real or fake**: Googlebot, Bingbot, Applebot, DuckDuckBot, Yandex, Baidu and the major social crawlers are checked with reverse and forward DNS. A visitor using one of those names from someone else's address is flagged as an impersonator. Other bots are labelled as identified by name only, so you know how far to trust it.
* **Named from a shared registry** of more than 230 crawlers, AI agents and bot tools, updated with each plugin release
@@ -28,7 +28,7 @@ Everything below works on your own server, free, with no account or API key.
When someone clicks a link to your site in ChatGPT, Perplexity, Claude, Gemini, Copilot, Meta AI, DeepSeek, Grok or another AI product, WebDecoy counts the visit.
-* **By AI product**: which assistants send you the most visitors, on the dashboard (7 days) and the Statistics page (30 days)
+* **By AI product**: which assistants send you the most visitors, on the dashboard (7 days) and the AI Traffic & Analytics page (30 days)
* **By landing page**: the pages AI assistants send people to, so you can see what content they recommend
Only a count per AI product and landing page per day is kept. Nothing about the visitor is stored.
@@ -133,7 +133,7 @@ Registration spam and comment spam are the same disease: automation pointed at y
**Local Dashboard & Analytics**
* Detection log with threat scores and MITRE tactic mapping
-* Statistics page with 30-day trend charts
+* AI Traffic & Analytics page with 30-day trend charts
* Separate request counters: actual blocks, throttles, challenges and withheld enforcement, including repeat IP blocks
* Blocked IPs management
* Dashboard widget: bots seen in the last 24 hours, checkout bot signals, threat overview
@@ -266,11 +266,11 @@ WebDecoy automatically recognizes and allows more than 130 legitimate bots inclu
= Can I see which AI crawlers visit my site without an account? =
-Yes. The WebDecoy widget on your WordPress dashboard shows known bot visits from the last 24 hours, with AI crawlers and agents counted separately, and the Statistics page lists every known bot from the last 7 days. Search engine crawlers are checked with reverse DNS, so you can tell a real Googlebot from an impersonator. It is counted on your own server; no account is needed and nothing is sent anywhere.
+Yes. The WebDecoy widget on your WordPress dashboard shows known bot visits from the last 24 hours, with AI crawlers and agents counted separately, and the AI Traffic & Analytics page lists every known bot from the last 7 days. Search engine crawlers are checked with reverse DNS, so you can tell a real Googlebot from an impersonator. It is counted on your own server; no account is needed and nothing is sent anywhere.
= Can I see how many visitors ChatGPT and other AI assistants send me? =
-Yes, with no account. WebDecoy counts page visits that arrive from a link in ChatGPT, Perplexity, Claude, Gemini, Copilot and other AI products, and shows them by AI product and landing page on your dashboard and Statistics page. Only counts are kept, nothing about the visitor. Pages served from a page cache never reach WordPress, so the numbers are minimums.
+Yes, with no account. WebDecoy counts page visits that arrive from a link in ChatGPT, Perplexity, Claude, Gemini, Copilot and other AI products, and shows them by AI product and landing page on your dashboard and AI Traffic & Analytics page. Only counts are kept, nothing about the visitor. Pages served from a page cache never reach WordPress, so the numbers are minimums.
= Does WebDecoy change my robots.txt? =
@@ -311,24 +311,24 @@ All requests are made server-side over HTTPS. This is an optional cloud service
Terms of Service: https://webdecoy.com/terms
Privacy Policy: https://webdecoy.com/privacy
-**Without an API key, the plugin operates 100% locally, with no external connections on the front end or back end.** Chart.js (used for the admin Statistics charts) is bundled with the plugin, not loaded from a CDN.
+**Without an API key, the plugin operates 100% locally, with no external connections on the front end or back end.** Chart.js (used for the admin analytics charts) is bundled with the plugin, not loaded from a CDN.
= Bundled third-party libraries =
-Chart.js v4.5.1 (MIT license) is included at admin/js/vendor/chart.umd.min.js for the admin Statistics charts. It is the official distribution build; the human-readable source is available at https://github.com/chartjs/Chart.js/releases/tag/v4.5.1 . No other third-party libraries are bundled.
+Chart.js v4.5.1 (MIT license) is included at admin/js/vendor/chart.umd.min.js for the admin analytics charts. It is the official distribution build; the human-readable source is available at https://github.com/chartjs/Chart.js/releases/tag/v4.5.1 . No other third-party libraries are bundled.
= Reference URLs in the good-bot database =
The bundled good-bot list (sdk/src/GoodBotList.php) stores a documentation URL for each known bot (e.g. developer.amazon.com/amazonbot, api.slack.com/robots) purely as reference metadata shown alongside detections. These URLs are never requested by the plugin. No connection of any kind is made to them.
== Screenshots ==
-1. Protection settings: configure detection and blocking
-2. Statistics page: 30-day detection trends and threat distribution
-3. Detections log: view threats with scores and MITRE tactics
-4. Blocked IPs: manage blocked addresses with expiration
-5. Dashboard widget: threat overview at a glance
-6. WebDecoy Cloud: optional premium features
-7. WooCommerce checkout protection settings
-8. AI crawler and bot counts on the dashboard, with no account
+1. AI Traffic & Analytics: crawler timelines, bot mix and AI referrals in the branded dashboard (demo data)
+2. Crawler details: named bots, categories and verified versus claimed identity evidence (demo data)
+3. AI referral details: referring AI products and landing pages, separate from crawler activity (demo data)
+4. Detections: inspect labeled setup-test findings and their evidence (demo data)
+5. Protection settings: configure detection and monitor mode
+6. Blocked IPs: manage addresses and expirations (documentation-only demo addresses)
+7. WooCommerce settings: configure checkout protection
+8. Dashboard widget: local crawler counts, AI referrals and detection activity (demo data)
== Changelog ==
diff --git a/tests/TrafficReportTest.php b/tests/TrafficReportTest.php
new file mode 100644
index 0000000..6cec20b
--- /dev/null
+++ b/tests/TrafficReportTest.php
@@ -0,0 +1,48 @@
+ '2026-11-12', 'agent_id' => 'gptbot', 'verification' => 'claimed', 'hits' => '4'],
+ ['day' => '2026-11-18', 'agent_id' => 'googlebot', 'verification' => 'verified', 'hits' => 3],
+ ['day' => '2026-11-18', 'agent_id' => 'retired-agent', 'verification' => 'claimed', 'hits' => 2],
+ ['day' => '2026-11-11', 'agent_id' => 'gptbot', 'verification' => 'claimed', 'hits' => 90],
+ ['day' => '2026-11-18', 'agent_id' => 'gptbot', 'verification' => 'invalid', 'hits' => 80],
+ ['day' => '2026-11-19', 'agent_id' => 'gptbot', 'verification' => 'claimed', 'hits' => 70],
+ ], [
+ ['day' => '2026-11-18', 'platform' => 'ChatGPT', 'landing_path' => '/', 'referrals' => '5'],
+ ['day' => '2026-11-18', 'platform' => 'ChatGPT', 'landing_path' => '', 'referrals' => 1],
+ ['day' => '2026-11-11', 'platform' => 'Claude', 'landing_path' => '/', 'referrals' => 50],
+ ], 7, strtotime('2026-11-18 00:01:00 UTC'));
+ TestRunner::assertSame(['ai' => 4, 'search' => 3, 'other' => 2], $r['crawlers']['groups']);
+ TestRunner::assertSame(9, $r['crawlers']['total']);
+ foreach ($r['crawlers']['groups'] as $group => $n) {
+ TestRunner::assertSame($n, array_sum($r['series'][$group]));
+ }
+ TestRunner::assertSame(6, $r['referrals']['total']);
+ TestRunner::assertSame(6, array_sum($r['series']['referrals']));
+ TestRunner::assertSame(5, $r['referrals']['pages'][0]['referrals']);
+});
+
+TestRunner::test('thirty-day report includes the UTC first day and rejects older rows', function () {
+ $r = WebDecoy_Traffic_Report::project([
+ ['day' => '2026-10-20', 'agent_id' => 'gptbot', 'verification' => 'claimed', 'hits' => 2],
+ ['day' => '2026-10-19', 'agent_id' => 'gptbot', 'verification' => 'claimed', 'hits' => 9],
+ ], [], 30, strtotime('2026-11-18 23:59:00 UTC'));
+ TestRunner::assertSame(30, count($r['labels']));
+ TestRunner::assertSame(2, $r['crawlers']['total']);
+ TestRunner::assertSame(2, $r['series']['ai'][0]);
+});
diff --git a/webdecoy.php b/webdecoy.php
index b22c7ef..e9b832b 100644
--- a/webdecoy.php
+++ b/webdecoy.php
@@ -2411,51 +2411,33 @@ private function output_honeypot_field(string $context): void
*/
public function admin_menu(): void
{
+ // Keep the existing settings slug for saved links and Cloud callbacks.
+ // The top-level menu opens the reporting surface instead of configuration.
add_menu_page(
- __('WebDecoy', 'webdecoy'),
+ __('AI Traffic & Analytics', 'webdecoy'),
__('WebDecoy', 'webdecoy'),
'manage_options',
- 'webdecoy',
- [$this, 'settings_page'],
+ 'webdecoy-statistics',
+ [$this, 'statistics_page'],
'dashicons-shield',
80
);
- add_submenu_page(
- 'webdecoy',
- __('Settings', 'webdecoy'),
- __('Settings', 'webdecoy'),
- 'manage_options',
- 'webdecoy',
- [$this, 'settings_page']
- );
-
- add_submenu_page(
- 'webdecoy',
- __('Statistics', 'webdecoy'),
- __('Statistics', 'webdecoy'),
- 'manage_options',
- 'webdecoy-statistics',
- [$this, 'statistics_page']
- );
-
- add_submenu_page(
- 'webdecoy',
- __('Blocked IPs', 'webdecoy'),
- __('Blocked IPs', 'webdecoy'),
- 'manage_options',
- 'webdecoy-blocked',
- [$this, 'blocked_ips_page']
- );
-
- add_submenu_page(
- 'webdecoy',
- __('Detections', 'webdecoy'),
- __('Detections', 'webdecoy'),
- 'manage_options',
- 'webdecoy-detections',
- [$this, 'detections_page']
- );
+ foreach ([
+ 'webdecoy-statistics' => [__('AI Traffic & Analytics', 'webdecoy'), 'statistics_page'],
+ 'webdecoy-detections' => [__('Detections', 'webdecoy'), 'detections_page'],
+ 'webdecoy-blocked' => [__('Blocked IPs', 'webdecoy'), 'blocked_ips_page'],
+ 'webdecoy' => [__('Settings', 'webdecoy'), 'settings_page'],
+ ] as $slug => $page) {
+ add_submenu_page(
+ 'webdecoy-statistics',
+ $page[0],
+ $page[0],
+ 'manage_options',
+ $slug,
+ [$this, $page[1]]
+ );
+ }
}
/**
@@ -2660,7 +2642,7 @@ public function dashboard_widget(): void
{
wp_add_dashboard_widget(
'webdecoy_dashboard_widget',
- __('WebDecoy - Threat Overview', 'webdecoy'),
+ __('WebDecoy - AI Traffic & Bot Analytics', 'webdecoy'),
[$this, 'render_dashboard_widget']
);
}
@@ -2719,7 +2701,7 @@ public function admin_scripts(string $hook): void
]);
// Load Chart.js and charts script on statistics page
- if ($hook === 'webdecoy_page_webdecoy-statistics') {
+ if ($hook === 'toplevel_page_webdecoy-statistics' || $hook === 'webdecoy_page_webdecoy-statistics') {
// Chart.js is bundled locally (admin/js/vendor/) rather than loaded
// from a CDN, so the plugin makes no external requests.
wp_enqueue_script(
@@ -2737,6 +2719,13 @@ public function admin_scripts(string $hook): void
WEBDECOY_VERSION,
true
);
+ wp_enqueue_script(
+ 'webdecoy-traffic-charts',
+ WEBDECOY_PLUGIN_URL . 'admin/js/webdecoy-traffic-charts.js',
+ ['webdecoy-charts'],
+ WEBDECOY_VERSION,
+ true
+ );
}
}