Featured strip: count impressions (one per viewer per campaign per hour) so featured advertisers see views and the by-hour chart

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-09-15 05:21:58 -05:00
parent a19a3fc31e
commit 7423347c95
2 changed files with 1 additions and 0 deletions
BIN
View File
Binary file not shown.
+1
View File
@@ -1970,6 +1970,7 @@ const server = http.createServer(async (req, res) => {
// -- featured rotation: the live featured links + dilution stats
if (p === '/api/featured' && req.method === 'GET') {
const items = await ads.serveFeatured(viewerGeo(req));
try { const sv = await auth.fromRequest(req); ads.noteFeaturedViews(items, (sv && sv.email) || clientIp(req)).catch(() => {}); } catch (e) {} // count the view (per viewer per hour)
const names = await accounts.namesForMembers([...new Set(items.map(i => i.memberId).filter(Boolean))]);
for (const i of items) i.by = (i.memberId && names[i.memberId]) ? '@' + names[i.memberId] : (i.memberId ? 'member #' + i.memberId : null);
return json(res, 200, { items });