fix(analytics): keep readable owner labels server-side

This commit is contained in:
john
2026-07-16 21:09:20 +08:00
parent 320945a485
commit 1f7b288a21
2 changed files with 7 additions and 2 deletions
+4 -1
View File
@@ -95,7 +95,10 @@ export function injectMindSpaceAnalytics(html, {
if (source.includes(ANALYTICS_MARKER)) return source;
const owner = pseudonymizeAnalyticsId(ownerId, config.idSecret);
if (!owner) return source;
const metadata = { owner_id: owner, owner_segment: String(ownerSegment || 'unknown'), owner_label: resolveAnalyticsOwnerLabel({ displayName: ownerLabel }), page_id: String(pageId || ''), publication_id: String(publicationId || ''), channel };
// Public page source must not contain a readable account name. The stable
// pseudonym and coarse plan segment are sufficient for page analytics;
// readable labels are reserved for server-originated events only.
const metadata = { owner_id: owner, owner_segment: String(ownerSegment || 'unknown'), page_id: String(pageId || ''), publication_id: String(publicationId || ''), channel };
const attrs = [
ANALYTICS_MARKER,
`data-website-id="${config.websiteId.replaceAll('"', '"')}"`,