mirror of
https://github.com/woodchen-ink/random-api-go.git
synced 2025-07-18 13:52:02 +08:00
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.
This commit is contained in:
parent
b252b8313e
commit
32fb07a2ee
@ -286,6 +286,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
${Object.keys(data.top_referers).length > 0 ? `
|
||||||
|
<div class="stats-summary">
|
||||||
|
<div class="stats-header">
|
||||||
|
<h2>🔗 访问来源</h2>
|
||||||
|
</div>
|
||||||
|
<div class="referers-list">
|
||||||
|
${Object.entries(data.top_referers)
|
||||||
|
.sort(([,a], [,b]) => b - a)
|
||||||
|
.map(([referer, count]) => `
|
||||||
|
<div class="referer-item">
|
||||||
|
<span class="referer">${referer || '直接访问'}</span>
|
||||||
|
<span class="count">${count}</span>
|
||||||
|
</div>
|
||||||
|
`).join('')}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
` : ''}
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user