openvibers/openvibe.report Commits

Traffic: pages beside pages (the browser count sits under each site, not beside every request)

OP OpenVibers committed 6 h ago · 1ce9d05c14 · 2 files, +7 −8

Follow-up to #326. Its column put the browser's pages beside People, which counts every request a browser-like client
made (pages, assets, API calls): openvibe.network read 206,634 beside 108. The count now sits under the site name with
the log's own pages: "40 pages opened by people · 31 ran in a browser"; nothing is said where there is no beacon. The
table is back to five columns. Test: traffic-browser.

Changes

ddiff --git a/server/views/traffic.js b/server/views/traffic.js
iindex f454b58..39f837a 100644
---- a/server/views/traffic.js
++++ b/server/views/traffic.js
@@@ -129,10 +129,9 @@ function overview({ data: d = null, days = 7, now = [] } = {}) {
+ `<span role="cell" data-l="Read most by" class="tf-chips">${readerChips(f.readers) || '<span class="tf-muted">—</span>'}</span>`
+ `<span role="cell" data-l="Last read">${f.last_at ? whenTag(f.last_at) : '—'}</span></div>`))
: '<p class="rp-fine">No file for machines was asked for in this window.</p>';
-- const sites = folded('<div class="rp-table is-6" role="table" aria-label="Sites">', `<div class="rp-tr rp-th" role="row"><span role="columnheader">Site</span><span role="columnheader">Requests</span><span role="columnheader">People</span><span role="columnheader">Opened in a browser</span><span role="columnheader">Bots</span><span role="columnheader">AI</span></div>`,
-- d.sites.map((s) => `<div class="rp-tr" role="row"><span role="cell" class="rp-site"><a href="${esc(siteHref(s.host))}">${esc(s.host)}</a><small>${exact(s.people_pages)} pages opened by people</small></span>`
++ const sites = folded('<div class="rp-table" role="table" aria-label="Sites">', `<div class="rp-tr rp-th" role="row"><span role="columnheader">Site</span><span role="columnheader">Requests</span><span role="columnheader">People</span><span role="columnheader">Bots</span><span role="columnheader">AI</span></div>`,
++ d.sites.map((s) => `<div class="rp-tr" role="row"><span role="cell" class="rp-site"><a href="${esc(siteHref(s.host))}">${esc(s.host)}</a><small>${exact(s.people_pages)} pages opened by people${s.browser_pages != null ? ` · ${exact(s.browser_pages)} ran in a browser` : ''}</small></span>`
+ `<span role="cell" data-l="Requests">${exact(s.requests)}</span><span role="cell" data-l="People">${exact(s.people)}</span>`
-- + `<span role="cell" data-l="Opened in a browser">${s.browser_pages != null ? exact(s.browser_pages) : '<span class="tf-muted">—</span>'}</span>`
+ `<span role="cell" data-l="Bots">${exact(s.bots)} <span class="tf-muted">${share(s.bots, s.requests)}</span></span><span role="cell" data-l="AI">${exact(s.ai)}</span></div>`));
const kinds = d.kinds.map((k) => `<li><b>${esc(KIND[k.kind] || k.kind)}</b> ${exact(k.requests)} <span class="tf-muted">(${share(k.people, k.requests)} people)</span></li>`).join('');
const body = `${head}
@@@ -143,7 +142,7 @@ ${arrivals(d)}
<section aria-labelledby="tf-bots-h"><h2 id="tf-bots-h">${glyph('robot')}Bots</h2><p class="rp-fine">Every bot and program that asked for something, most requests first. Search engines that publish how to check are checked: "not really" counts requests that use a crawler's name from somewhere else.</p>${botsTable(d.bots)}</section>
<section aria-labelledby="tf-files-h"><h2 id="tf-files-h">${glyph('file')}Files for machines</h2><p class="rp-fine">What sites publish for search engines and AI: llms.txt and llms-full.txt, robots.txt, sitemaps, agent cards, the OpenAPI documents and each page's Markdown twin.</p>${files}</section>
<section aria-labelledby="tf-sites-h"><h2 id="tf-sites-h">${glyph('globe')}Every site</h2>${sites}</section>
--<section aria-labelledby="tf-how-h"><h2 id="tf-how-h">${glyph('info')}How this is counted</h2><ul class="tf-kinds">${kinds}</ul><p class="rp-fine">Counted on the server from every request the sites answered, so bots that never run a page's script are here too. A request is a person when a browser asks and nothing in it says bot; who a bot is comes from its user agent. "Opened in a browser" is the other count: pages a browser actually ran, from the sites' own page beacon (a bot that only fetches never counts there; a site without the beacon shows —). Days and hours are counted in UTC; each time is shown in your own zone. No address and no person is kept: a page is counted by its section ("/c/*"), and a link's code or a share token never is. The same numbers: <a href="/api/v1/traffic?days=${esc(days)}"><code>/api/v1/traffic</code></a>.</p></section>`;
++<section aria-labelledby="tf-how-h"><h2 id="tf-how-h">${glyph('info')}How this is counted</h2><ul class="tf-kinds">${kinds}</ul><p class="rp-fine">Counted on the server from every request the sites answered, so bots that never run a page's script are here too. A request is a person when a browser asks and nothing in it says bot; who a bot is comes from its user agent. Under each site, "ran in a browser" is the other count: pages a browser actually ran, from the sites' own page beacon, beside the pages the log calls people's (a fetcher that only asks like a browser never runs one; a site without the beacon says nothing). Days and hours are counted in UTC; each time is shown in your own zone. No address and no person is kept: a page is counted by its section ("/c/*"), and a link's code or a share token never is. The same numbers: <a href="/api/v1/traffic?days=${esc(days)}"><code>/api/v1/traffic</code></a>.</p></section>`;
return layout({ title: 'Who visits OpenVibe', description: 'People and bots on every OpenVibe site: search engines, AI crawlers and assistants, link previews, and the files sites publish for machines.', body, active: '/traffic', path: `/traffic${days === 7 ? '' : `?days=${days}`}` });
}
ddiff --git a/test/traffic-browser.test.js b/test/traffic-browser.test.js
iindex e46174a..7f69abf 100644
---- a/test/traffic-browser.test.js
++++ b/test/traffic-browser.test.js
@@@ -28,10 +28,10 @@ const { boot, check, done } = require('./helpers/boot');
assert.deepStrictEqual([help.people, help.browser_pages], [40, 31], 'the log says 40 people, the browser ran 31 pages');
assert.strictEqual(zone.browser_pages, null, 'no beacon there: null, not 0');
const page = await t.get('/traffic');
-- assert.match(page.text, /<span role="columnheader">Opened in a browser<\/span>/);
-- assert.match(page.text, /openvibe\.help<\/a>[\s\S]*?data-l="People">40<\/span><span role="cell" data-l="Opened in a browser">31<\/span>/);
-- assert.match(page.text, /openvibe\.zone<\/a>[\s\S]*?data-l="Opened in a browser"><span class="tf-muted">—<\/span>/);
-- assert.match(page.text, /class="rp-table is-6" role="table" aria-label="Sites"/, 'six columns get their own grid');
++ // Pages beside pages: the log's pages opened by people, and the pages a browser ran (12-01: the People column
++ // counts every request, 206,634 on openvibe.network beside 108 pages run, so the pair sits under the site).
++ assert.match(page.text, /openvibe\.help<\/a><small>40 pages opened by people · 31 ran in a browser<\/small>/);
++ assert.match(page.text, /openvibe\.zone<\/a><small>3 pages opened by people<\/small>/, 'no beacon there: nothing said');
});
} finally {
await t.close();