From 32fb07a2eeafaf06620a1a08353b573148ceac8b Mon Sep 17 00:00:00 2001 From: wood chen Date: Mon, 2 Dec 2024 05:53:02 +0800 Subject: [PATCH] feat(public): add top referers display to metrics summary - Introduced a new section in the index.html to display the top referers with their respective counts. - Implemented dynamic rendering of referers based on available data, enhancing user insights into traffic sources. - Ensured the referers are sorted by count for better visibility and understanding of user access patterns. --- public/index.html | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/public/index.html b/public/index.html index 7d00fe5..79d2b80 100644 --- a/public/index.html +++ b/public/index.html @@ -286,6 +286,23 @@ + ${Object.keys(data.top_referers).length > 0 ? ` +
+
+

🔗 访问来源

+
+
+ ${Object.entries(data.top_referers) + .sort(([,a], [,b]) => b - a) + .map(([referer, count]) => ` +
+ ${referer || '直接访问'} + ${count} +
+ `).join('')} +
+
+ ` : ''} `;