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:
@@ -1970,6 +1970,7 @@ const server = http.createServer(async (req, res) => {
|
|||||||
// -- featured rotation: the live featured links + dilution stats
|
// -- featured rotation: the live featured links + dilution stats
|
||||||
if (p === '/api/featured' && req.method === 'GET') {
|
if (p === '/api/featured' && req.method === 'GET') {
|
||||||
const items = await ads.serveFeatured(viewerGeo(req));
|
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))]);
|
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);
|
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 });
|
return json(res, 200, { items });
|
||||||
|
|||||||
Reference in New Issue
Block a user