From ade4db36c00fcde1d10bd5e66a7c14c20c8631be Mon Sep 17 00:00:00 2001 From: Sascha Leib Date: Mon, 1 Sep 2025 18:55:56 +0200 Subject: [PATCH] Metrics and design update --- admin.php | 10 +++++++--- pview.php | 4 ++-- script.js | 6 +++++- style.less | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/admin.php b/admin.php index 9685bd9..11c6f1e 100644 --- a/admin.php +++ b/admin.php @@ -30,7 +30,9 @@ class admin_plugin_botmon extends AdminPlugin { */ public function html() { - $svg = ''; + global $conf; + + $pluginPath = $conf['basedir'] . 'lib/plugins/' . $this->getPluginName(); /* Plugin Headline */ echo '
'; @@ -43,6 +45,9 @@ class admin_plugin_botmon extends AdminPlugin { echo 'Today'; echo ''; + // Beta warning message: + echo '
Please note: This plugin is still in the early stages of development and does not (yet) clean up its logs directory.
To avoid taking up too much space on your server, please remove older logs manually!
'; + /* Live tab */ echo '
'; echo '

Today

'; @@ -51,9 +56,8 @@ class admin_plugin_botmon extends AdminPlugin { echo '
Visitor log'; echo '
    '; echo '
    '; - echo ''; + echo ''; echo ''; - echo '
    IMPORTANT: This plugin is still in the early stages of development and does not clean up its logs directory.
    To avoid taking up too much space on your server, please remove older logs manually!
    '; echo ''; } diff --git a/pview.php b/pview.php index 4e48b28..bd9ae12 100644 --- a/pview.php +++ b/pview.php @@ -11,9 +11,9 @@ if (!$json) { $logArr = Array( $_SERVER['REMOTE_ADDR'] ?? '', /* remote IP */ $json['pg'] ?? '', /* DW page ID */ - $_COOKIE['DokuWiki'] ?? session_id() ?? '', /* DokuWiki session ID */ + $_COOKIE['DokuWiki'] ?? session_id() ?? '', /* DW session ID */ $json['u'] ?? '', /* DW User id (if logged in) */ - $json['td'] ?? '', /* load time */ + $json['lt'] ?? '', /* load time */ $json['r'] ?? '', /* Referrer URL */ $_SERVER['HTTP_USER_AGENT'] ?? '' /* User agent */ // $json['lg'] ?? '', /* browser language */ diff --git a/script.js b/script.js index 8fa51ff..a52dfcc 100644 --- a/script.js +++ b/script.js @@ -677,6 +677,9 @@ BotMon.live = { const data = BotMon.live.data.analytics.data; const parent = document.getElementById('botmon__today__content'); if (parent) { + + const bounceRate = Math.round(data.totalVisits / data.totalPageViews * 1000) / 10; + jQuery(parent).prepend(jQuery(`
    Overview @@ -685,7 +688,8 @@ BotMon.live = {
    Web metrics
    Total visits:${data.totalVisits}
    Total page views:${data.totalPageViews}
    -
    Bounce rate:(TBD)
    +
    Bounce rate:${bounceRate} %
    +
    ∅ load time:${data.avgLoadTime} ms
    Bots vs. Humans
    diff --git a/style.less b/style.less index 56eef3f..e78fad2 100644 --- a/style.less +++ b/style.less @@ -139,7 +139,7 @@ } } - #botmon__today__content > details summary { + #botmon__today__content > details summary { & { background-color: #0c0c0d; color: #adadb3;