<% const palette = ['#cee5ff', '#39a8ff', '#ffcf5f', '#ff7a7a', '#c08bff', '#5ff0d0', '#ff9f43', '#8fbf00', '#ff5fd2', '#7a8cff']; const flag = (cc) => { if (!cc || cc.length !== 2) { return ''; } return String.fromCodePoint(...[...cc.toUpperCase()].map(c => 0x1F1E6 + c.charCodeAt(0) - 65)); }; const maxOf = (arr, key) => arr.reduce((m, e) => Math.max(m, e[key]), 0) || 1; const urlMax = maxOf(topUrls, 'count'); const countryMax = maxOf(topCountries, 'count'); const providerMax = maxOf(topProviders, 'count'); const browserMax = maxOf(browsers, 'count'); const osMax = maxOf(operatingSystems, 'count'); const deviceMax = maxOf(devices, 'count'); const dailyMax = maxOf(daily, 'count'); const hourMax = maxOf(hourly, 'count'); const dailyTotal = daily.reduce((s, d) => s + d.count, 0); const hourlyTotal = hourly.reduce((s, h) => s + h.count, 0); const totalCountry = topCountries.reduce((s, c) => s + c.count, 0) || 1; let acc = 0; const stops = []; topCountries.slice(0, 6).forEach((c, i) => { const start = (acc / totalCountry) * 360; acc += c.count; const end = (acc / totalCountry) * 360; stops.push(`${palette[i]} ${start}deg ${end}deg`); }); if (acc < totalCountry) { stops.push(`#333 ${(acc / totalCountry) * 360}deg 360deg`); } const conic = stops.length ? `conic-gradient(${stops.join(', ')})` : 'var(--admin-surface-3)'; const dowLabels = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; const fmtRange = (d) => d ? new Date(d).toLocaleString() : 'n/a'; %> <%- include('../partials/head'); -%> <%- include('../partials/admin-base'); -%> Admin - Analytics <%- include('../winter'); -%>
Back to dashboard

Analytics

<%= kpi.totalVisits.toLocaleString() %> Total visits First: <%= fmtRange(span.first) %>
<%= kpi.uniqueIps.toLocaleString() %> Unique visitors by IP address
<%= kpi.uniqueUrls.toLocaleString() %> Distinct pages Last visit: <%= fmtRange(span.last) %>
<%= kpi.countries.toLocaleString() %> Countries geolocated sources
<%= peakHour.count.toLocaleString() %> Peak hour <%= String(peakHour.hour).padStart(2, '0') %>:00
<%= busiestDay.count.toLocaleString() %> Busiest day <%= busiestDay.date %>

Traffic over time visits per day

<% if (dailyTotal > 0) { %>
<% daily.forEach(d => { %>
<%= d.date %> · <%= d.count %> <%= d.label %>
<% }) %>
<% } else { %>

No visits recorded in this period.

<% } %>

Visits by hour server time

<% if (hourlyTotal > 0) { %>
<% hourly.forEach(h => { %>
<%= String(h.hour).padStart(2, '0') %>:00 · <%= h.count %> <%= h.hour %>
<% }) %>
<% } else { %>

No visits recorded in this period.

<% } %>

Most visited pages

<% if (topUrls.length) { %>
<% topUrls.forEach(u => { %>
<%= u.url %> <%= u.count %>
<% }) %>
<% } else { %>

No page data yet.

<% } %>

Top countries

<% if (topCountries.length) { %>
<%= kpi.countries %> countries
<% topCountries.slice(0, 6).forEach((c, i) => { %>
<%= flag(c.code) %> <%= c.country %> <%= c.count %>
<% }) %> <% if (topCountries.length > 6) { %>
Other <%= topCountries.slice(6).reduce((s, c) => s + c.count, 0) %>
<% } %>
<% } else { %>

No geolocation data yet.

<% } %>

Top providers / ISPs

<% if (topProviders.length) { %>
<% topProviders.forEach(p => { %>
<%= p.provider %> <%= p.count %>
<% }) %>
<% } else { %>

No provider data yet.

<% } %>

Browsers

<% if (browsers.length) { %>
<% browsers.forEach(b => { %>
<%= b.name %> <%= b.count %>
<% }) %>
<% } else { %>

No user agent data yet.

<% } %>

Operating systems

<% if (operatingSystems.length) { %>
<% operatingSystems.forEach(o => { %>
<%= o.name %> <%= o.count %>
<% }) %>
<% } else { %>

No OS data yet.

<% } %>

Devices

<% if (devices.length) { %>
<% devices.forEach(d => { %>
<%= d.name %> <%= d.count %>
<% }) %>
<% } else { %>

No device data yet.

<% } %>

Activity heatmap day of week × hour, darker = busier

<% if (heatMax > 0) { %>
<% for (let h = 0; h < 24; h++) { %> <%= h %> <% } %> <% for (let d = 0; d < 7; d++) { %> <%= dowLabels[d] %> <% for (let h = 0; h < 24; h++) { const v = heatmap[d][h]; const a = heatMax ? v / heatMax : 0; %> <% } %> <% } %>
<% } else { %>

No activity to display yet.

<% } %>

Top visitors

<% topIps.forEach(ip => { %> <% }) %> <% if (!topIps.length) { %> <% } %>
IP Location ISP Visits
<%= ip.ip %> <% if (ip.info.country) { %> <%= flag(ip.info.countryCode) %> <%= [ip.info.city, ip.info.country].filter(Boolean).join(', ') %> <% } else { %> Unknown <% } %> <%= ip.info.isp || ip.info.org || '—' %> <%= ip.count %> Details
No visitors yet.
<%- include('../footer'); -%>